Lighting schedule multiple steps

First off I'm brand new to Hubitat and I hope I selected the right forum topic. If not, I apologize in advance.

I want to make a fairly complex rule, and I'm not quite sure how to go about it in Hubitat's ecosystem. My son is struggling with staying on track with his school schedule, so I want to make it a bit easier for him to know when he's "in class" vs on break/lunch. I have a Zigbee RGB bulb that I want to configure as follows.

1 minute before his first class starts, turn on the bulb at red. At class start time, change to white. When class ends, change to green. I want to repeat that 7 times throughout the day, with one longer green period in the middle for lunch.

Outside of HE I can think of several ways to do it.

  1. Set up cron entries for each change time throughout the day calling individual scripts/commands to set the bulb state.
  2. Have one big script that has the times to change in it, and calling that script once per minute via cron
  3. Have a script that changes green for 3 minutes, red for one, then white, and call it via cron 4 minutes prior to the first class, and 4 minutes prior to the next class starting throughout the rest of the day.

I'm sure there are others if I sat down and put a bit more thought into it. The problem I can see with trying to do it really any of those methods in Rules Machine (or even Simple Automation Rules) is it's going to clutter up the rule list, and/or it will be "expensive" to run in terms of system load due to checking every minute to see if there is something that needs to be run, and having "waits" in the scripts.

If Rules Machine isn't the best way to accomplish this, I would be open to any suggestions. Simple Automation seems like it would suffer from the same concerns. Thank you in advance for any pointers in the right direction so I can learn the "proper" way to do this within HE.

Does the schedule stay the same day to day?

If so , your trigger would be something like 8AM, and the action would be to turn bulb red, then delay 1 minute and turn bulb white.

Then for the next period, with a new rule, have a trigger of 9AM and for actions do whatever.

Then just do the same for every period of the day and lunch.

Sure you will end up with lots of rules, but it will be easier to do. And troubleshooting and editing will be so much better. And if one rule fails, the others should still work.

At some point you could then combine into one large rule. Leave the individual ones alone, but paused, until the combined one works!

1 Like

If the lights turn on red at a specific time, turn white 1 minute later, then turn green; couldn't this be done in 1 rule with 6 triggers of starting times if classes are all same length?

Then create a similar rule just for lunch if you want light white during lunch?

1 Like

If the classes are all the same duration I would be one rule with the appropriate delays and then add multiple time based triggers. You could wrap the whole thing in an If statement and build a virtual switch for school days

I really appreciate the input, Based on the advice here I set up a rule with all of the start times to trigger the routine before the first class, and at the end of all classes with the exception for lunch. I set up a separate rule with those two times. Inside the rules, I turn the Zigbee bulb Green, then red on a 3 minute delay, then white on a 4 minute delay. Breaks are 4 minutes long, so it turns green when break starts, red as a 1 minute warning, then back to white until the rule runs again. I plan to set up the school day if-then switch too as another phase of the project. I have a week to do that before the weekend or I can just turn that lamp off altogether if I don't get a chance to work on it prior.

I did find out that the bulb is too far away to respond when it's at his desk, so I ordered a couple of Zigbee plugs that have repeaters built in as well. I can place one where I have the lamp now (same room, just opposite side) and it should be enough to relay the signal from there.

I'm sure I'll have more questions as I dive deeper into this, but so far setting most of it up has been pretty easy. The biggest place I need to pick up on is what the "best practices" are for balancing ease of configuration vs. system load. Thanks again for the quick replies!

Just wanted to give an update, it's working great. Today was the first day it actually worked due to needing a Zigbee repeater to reach his desk. I had to go in to the office today so I asked him if it worked when I got home. He said it worked great, and it was very helpful.

Thank you to everyone that replied, I wish I could mark each one as the solution as you each gave me a piece of the puzzle.