Repository navigation
Scheduler and Events
Events let Radio Automation do things on its own: start or stop the player, or announce the time or temperature. Open the editor with Edit > Events.
An event has a trigger (what causes it to run) and an action (what it does). Triggers are either a cron schedule or an MQTT message.
| Column | Meaning |
|---|---|
| Name | The event name. The checkbox enables/disables the event |
| Trigger |
Cron or Mqtt
|
| Expression | The cron expression, or the MQTT topic |
| Demand |
Immediate or Delayed
|
| Action | What the event does |
Buttons: New, Edit, Delete, Open, Save, then Ok to apply. Open and Save load and save the schedule as an .evs file (JSON). The last schedule is reloaded at startup. Click Ok to rebuild the running schedule from the list.
A new event defaults to a Time Announcement with Delayed demand.
| Setting | Description |
|---|---|
| Event Name | Free text, shown in the lists |
| Start Date and Time | Informational. The scheduler currently begins at the next matching time after the schedule is loaded |
| Expires / Expire Date and Time | When checked, the event stops firing after the expire time. When unchecked it never expires |
| Demand Type |
Immediate or Delayed - see below
|
| Trigger Type |
Cron shows the cron expression box; Mqtt shows Topic and Message boxes |
| Event Type | The action - see below |
Disabled events (checkbox cleared) are not scheduled and do not subscribe to MQTT topics.
| Action | Behavior |
|---|---|
| Play | Starts playback if the player is stopped or paused. Does nothing if already playing |
| Stop | Stops playback |
| Time Announcement | Plays the current time using the time/temp files |
| Temperature Announcement | Plays the current temperature from Weather Underground using the time/temp files |
| Pause, Humidity Announcement | Listed in the editor but not implemented yet - the event fires but nothing happens |
Demand decides when an event that has fired actually runs.
| Demand | Player playing or paused | Player stopped |
|---|---|---|
| Immediate | Runs right away, interrupting the current track | Runs right away |
| Delayed | Queued, and runs after the current track ends. Queued events run in the order they fired, before the next playlist track | Discarded - delayed events never run while stopped |
Guidance:
- Use Delayed for announcements you'd like to land between songs.
- Use Immediate for Play/Stop events, for anything that must happen at an exact time, and for internet streams (they have no gap between tracks).
- A Play event that should start the show must be Immediate. A Delayed Play never fires because the player is stopped.
Time and temperature announcements that interrupt playing music play over it on a second player while the music fades down, then it fades back up.
Radio Automation uses a six-field cron expression. The first field is seconds:
second minute hour day-of-month month day-of-week
0-59 0-59 0-23 1-31 1-12 0-6
or JAN-DEC or SUN-SAT
A common mistake: a standard five-field expression such as
*/15 * * * *is rejected. The event is not scheduled, an error is written to the log, and no message is shown. Always include the seconds field.
Examples:
| Expression | Runs |
|---|---|
0 0 * * * * |
Every hour, on the hour |
0 */15 * * * * |
Every 15 minutes |
0 0,30 * * * * |
On the hour and half hour |
0 */10 7-17 * * * |
Every 10 minutes from 07:00 to 17:59 |
0 0 7 * * * |
Every day at 07:00 |
0 0 18 * * MON-FRI |
Weekdays at 18:00 |
0 30 17 * * SAT,SUN |
17:30 on weekends |
Times are in the computer's local time. The scheduler is provided by NCrontab.Advanced, so its extended syntax (ranges, lists, steps, names) is available.
| Name | Trigger | Expression | Demand | Action |
|---|---|---|---|---|
| Show start | Cron | 0 0 17 * * * |
Immediate | Play |
| Announce time | Cron | 0 0,30 17-23 * * * |
Delayed | Time Announcement |
| Announce temp | Cron | 0 15,45 17-23 * * * |
Delayed | Temperature Announcement |
| Show end | Cron | 0 0 23 * * * |
Immediate | Stop |
The Events panel on the main window lists events due in the next 5 minutes. An event leaves the list once it runs (or, for a Delayed event, once it's discarded because the player is stopped).