alarm
#
- class platypush.plugins.alarm.AlarmPlugin(**kwargs)[source]#
Bases:
Plugin
Alarm/timer plugin.
Requires:
The
platypush.backend.alarm.AlarmBackend
backend configured and enabled.
- add(when: str, actions: list | None = None, name: str | None = None, audio_file: str | None = None, audio_volume: float | int | None = None, enabled: bool = True) str [source]#
Add a new alarm. NOTE: alarms that aren’t configured in the
platypush.backend.alarm.AlarmBackend
will only run in the current session. If you want an alarm to be permanently stored, you should configure it in the alarm backend configuration. You may want to add an alarm dynamically if it’s a one-time alarm instead- Parameters:
when – When the alarm should be executed. It can be either a cron expression (for recurrent alarms), or a datetime string in ISO format (for one-shot alarms/timers), or an integer representing the number of seconds before the alarm goes on (e.g. 300 for 5 minutes).
actions – List of actions to be executed.
name – Alarm name.
audio_file – Path of the audio file to be played.
audio_volume – Volume of the audio.
enabled – Whether the new alarm should be enabled (default: True).
- Returns:
The alarm name.
- disable(name: str)[source]#
Disable an alarm. This will prevent the alarm from executing until re-enabled or until the application is restarted.
- Parameters:
name – Alarm name.