I'm struggling with the best way to achieve this, I imagine I'll need a couple of separate rules to do it. I have some ambient lights in the kitchen. Rather than use motion I'd like these to be on/off automatically following a few conditions.
On - I'd like them to come on at sunset or if the blind position is at 0 so long as the alarm system is off (I have a contact device that is open when the alarm is off). That bit is easy enough for me, I can use the alarm status as a required expression, but I need to ensure that they also come on automatically if I come home after sunset (when I switch the alarm off)
Off - I'd like them to go off when the alarm contact goes closed (as I've gone out/gone to bed), or at midnight. That is also easy enough for me but I want to make sure that if they're on because the blind is closed that they go off when it's opened, ONLY if it's outside of the sunset to midnight time.
I was thinking I might need to create a hub variable but any suggestions for the most efficient way of doing this would be appreciated. TIA
Edit: I might be overcomplicating things with the blind position as I already have a sunset close/sunrise open rule attached to that. It would be rare for me to close it outside of those times so could probably be disregarded.
My brain organized this into 4 rules...
Rule A: on #1
Required expression: alarm contact open
Trigger: blinds closed OR time==sunset
Rule B: on #2
Required expression: time between sunset-midnight
Trigger: alarm contact opened
Rule C: off #1
Trigger: alarm contact closed OR time==midnight
Rule D: off #2
Required expression: time between midnight(sunrise?)-sunset
Trigger: blinds opened
1 Like
Use predicate conditions to achieve this in one rule
@rlithgow1 Thanks - I looked at that but was not sure. My thought was that if I was out when sunset arrived the light would remain off (as the alarm was on) which is what I want, but if I then arrive home and turn the alarm off, while the predicate/required expression is then met, there is no trigger as sunset has already passed. Or should I also add the alarm off as a trigger to get around that?
My rule B proposal covers this case... I honestly have not used the new Rule Machine 5.1 (with predicate/required expressions) - but my impression was that they were applied to all triggers whereas your conditions are different for different triggers - thus I split into different rules. Could use some if/then logic if desired to consolodate, but I believe that makes the rule execution less efficien
It's possible,, of course, that I've missed or mis-understood part of the concept of predicate conditions
1 Like
2 rules maybe
If mode=x and time=sunset then light off
Or
time=sunset and blind position=x
then run x
End if
if mode=away/armed/whatever you call the mode
Turn light off
end if
I think that would be the simplest way
1 Like
I've not progressed to modes yet - coupling modes with Rule Machine...,that's just pure wizardry to me at this stage lol
It's simply a set of conditions created based on the mode. For instance. You arm your slam which trips away mode. Away mode tells x lights to turn off or on or what have you. Being you would make the mode as part of a predicate condition, that tells he that if the mode is set to away and this other thing though is false then set off the dynamite in the garage at sunset... But if the other thing is true, the set off the alarm at 4am to annoy neighbors
1 Like
haha - I wouldn’t want to blow up my Street Triple in the garage, so I’ll plump for blowing up the neighbours at 4 AM instead
1 Like
So I've come up with the attached. Rather than using any wait conditions, I've used multiple triggers and conditional actions (it was handy finding that I could add brackets, I hadn't noticed that before)
I've tried to imagine each scenario and it looks as though it should work....