Curious, is there a way to turn on/off lights depending on time of day, but all in one rule?

I already have this behaviour setup, on sunrise/sunset.. but i have 2 rules in the RM. I figured each rule created has resource impact on the hub, right? So I've been trying to figure out how to reduce some of my rules.... I've a C8 with almost 100 devices.

From what I understand, multiple rules for things like this would have negligible impact on the performance of the hub, or at least not likely enough to warrant time spent doing the re-structuring of the rules. They would likely just be sitting in the background waiting to be woken up when the time comes twice a day. It is chatty devices, repeatedly resource expensive rules or inefficient LAN / cloud integrations that are likely to cause more drain on the hub. I would try to work through identifying things that are impacting performance and then focus on those.

That's not to say it isn't an interesting exercise to work through as a simple example, if you still want to, it just may not provide the performance impact you are looking for. Post some screenshots of what you have at the moment and a bit more detail of what you are thinking or what you have tried so far.

1 Like

thanks for the insights.. im glad to know that. I thought Hubitat goes through all the rules at every set interval or every device activity. I'm glad it wasn't designed like that.

My rule for this is simple, here's the rule for turning it off on sunrise

and i have another one for sunset. That's pretty much it. I just wanted to cut it down to 1 rule or trigger but as you said, too much work for negligible benefits. :slight_smile:
o

Chatty devices?
Hmm... i tend to prefer and use devices that checks in regularly because that's my only way to know if the device is still alive. for example, I tested several motion and door sensors, and only used the ones that report back their status (ie battery) regularly (every few minutes). Is the latter considered chatty?

I was being conveniently vague.... :slight_smile: I would expect for battery reporting, probably not. Simple, single value being updated every minute or so I also don't expect to have a significant drain on performance, but keep an eye on it.

If you are wanting to keep a closer check on things, have you looked at things like the Hub Information Driver and some of the options for capturing some of the data over time, like in an InfluxDB / Grafana setup, or using WebCore charts?

2 Likes

Just to expand on that a little... For time-based stuff I believe the hub runs cron or something very similar to schedule time-based tasks, with a nightly assessment of sunrise and sunset for the next day. So there would be a schedule setup for your rule, then when the time comes the rule is run and goes back to being dormant once again until the next scheduled time, adjusted as the sunrise / sunset changes each day. If you click the cog icon in the page for your rule, you will likely see something like this at the bottom (this is for a rule I have to turn off my A/C at 10PM):

For devices, the triggers you configure in your rule setup what is referred to as a subscription to an event on the device. The driver records events as it needs to, such as battery level changes, changes to lights turning on or off. etc. Any Apps that have a subscription to that event are then notified that the event has occurred. So the hub is not polling for events or assessing rules en-masse when any event occurs, only events with a subscription trigger only the Apps that are listening for them.

1 Like

This app might be of interest to you: App: Switch Scheduler and More. (Schedule: Lights, Outlets, Switches, Relays, Sprinklers, Valves, and more..)

Also, here is my rule which turns the lights on and off, twice per day, all in one rule. The double turn on/off with the 10 second delay is optional for if you have stubborn devices that don't always turn on.

1 Like

ahh this explains a lot. thanks for your inputs!

thanks!

im not that great with RM conditions so your settings, I can't understand completely, but I do get the concept, thanks!

Have a look at the room lighting app. It'll give you a nice single location to configure the on/off behavior. After getting familiar with it, I use it in a lot of scenarios.

Performance wise, I wouldn't worry about something that triggers twice a day.

It's easy enough to do it in one rule:

Triggers:
Sunset
Sunrise

Actions:
If time is sunset turn on lights (only if off)
else
turn off lights (only if on)
end-if