Time of Day - Cron every minute or at fixed times

One advantage to the separate triggers instead of one per minute is if you add the “Schedule” tag to your rule, it will show up on the calendar on the Schedule page in MainUI showing you when the rule will run and therefore show you graphically when your times of day transition. If you run it every minute that won’t work.

One other approach which is a little more configuration but might give you more flexibility would be to use the Time Based State Machine [3.2.0;3.4.9]. Where this gives you more flexibility is:

  • you don’t have to write any rules code at all, all you need is a set of DateTime Items with some metadata, and a Group
  • you can use DateTime List Item and DateTime Standalone Widget to set your fixed times of day from MainUI. That means you and/or your family could have the option to change the schedule without needing to modify rules. The schedule is all held in Item states.
  • you have the option to have a different set of times set for different types of day (weekdays, weekends, hoilidays, etc.).

For static Items, you might also need To Today [3.2.0;3.4.9) to move the date times that don’t come from Astro or other sources forward at to the current day at midnight.

Don’t miss the new Time is <item> rule trigger. I suspect you might be able to apply that to your system.

Speaking of that new trigger, @MadFrankie, if your timing needs are simple and you don’t need the Time based State Machine, perhaps still using a set of DateTime Items (with the DateTime widgets for the fixed times of day) and separate super simple rules using that Time is <item> trigger to transition would be the best balance between flexibility and simplicity. I don’t know if these rules will currently show up on the Schedule but bet they will eventually. Then you can see not only when your transitions between times of day are, but what the transitions are (assuming you name your rules well).

2 Likes