I'm starting to work on a bit more complex setup and would like some advice if there is a better (or preferred) way of accomplishing this.
I have several lights on the outside of the house. I initially setup both a motion group and a light group to work as dusk to dawn and security lighting. It was pretty simple. At dusk three lights came on and at midnight they dimmed. Then if there was a motion trigger it would light them all up full until the motion stopped, then they would go back to the original setting. It has been working very well.
Now I'm starting to expand it to include holiday lighting. Previously I just overrode the system from time to time but I want to automate it. So I started expanding the rule and it looks something like this:
If (motion changed)
if (time between sunset and sunrise)
if (motion active)
set lights to full
if (variable = 'holloween')
set Holloween scene
set dusk to dawn lights
I'm using a variable sort of as another mode condition. As you can imagine this will get bigger and more complex as I add more holiday scenes. The dusk to dawn lights also behave differently depending on the time of night. I just wanted the pseudo code to give the idea of the main flow.
So my primary question is - is this the best way to go about it? It is an ugly bit of nesting but it works. Maintenance becomes a bit problematic as it expands. This brings up another issue - is it possible to edit rules outside of the UI? Or is that what the apps are intended for? The "insert before" mechanism is a bit unwieldy on larger projects.
Probably not, best to break down what your after 1st but for starts a better way would be.
Trigger motion changed
IF(NOT time between sunset and sunrise) Exit rule
IF (motion active) THEN
Set lights to full
IF(variable = 'holloween') THEN
Set Halloween scene (I'm assuming you want this instead of OFF?)
Set dusk to dawn light?
This has no off? I'm reading it like when motion and it's dark turn the lights on full. When the motion goes inactive go to scene if it's a holiday else go to another dusk to dawn scene?
It does trigger off of motion changed. Sorry, don't have access to the Hub from the office so the pseudo code might be a little misleading there.
Correct, this does not have an off setting. That is handled by a different routine.
<heh, you keep editing while I'm typing my response.>
During the day it does nothing. This is just motion lighting for night.
So it triggers on motion changed. If motion is active then it goes full otherwise it sets the dusk/dawn lighting. When it reverts back to dusk/dawn there are other conditions to determine the non-active light state (holiday, before midnight, after midnight).
I think you may be able to use a variable scene or something then use a switch to decide if it should be used. This will keep the rule simple and allow you to adjust it depending on the holiday.
On for all holidays off for not.
Yes always if you know how to write them. If not I'm sure RM should be able to do it just need to think about it
The rule is currently working. I just don't like the interface as it continues to expand.
I've been completely confused by the apps but that is only due to lack of information. I recently found the ST documentation and will take a look at that. Apps should be a piece of cake but was lost for a starting off point. I've found that now.
So I guess I'll leave the rule for now since it is working and look at migrating to an app before the next holiday rolls around.