Multiple triggers? Setting mode based on time & presence


#1

1) Give a description of the problem
No problem, looking for a better/less intensive way to trigger on multiple changes.

2) What is the expected behaviour?
At any time change interval, check & set mode. But must also trigger from phones changing status at any time, not just at the start of the scheduled time slots.

3) What is happening/not happening?
Works, but the ideal scenario is that I could trigger the piston any time a phone changes, as well as at 12:00:00 AM, 6:00:00 AM, etc…

**4) Post a Green Snapshot of the piston![image|45x37]

My only thought is to use a virtual switch with Rules Machine (Hubitat) to trigger the change of the virtual switch based on the start of time intervals. Not sure I like that, adding 1 additional component to something that works reliably today already. (basically at 6:00:00, have rules machine turn switch on, Webcore would trigger on that, and turn the switch off after running)


#2

have you considered:

ie you can aggregate the triggers you want in an if statement at top (or bottom) of the piston without anything in the else clause, then have your logic using conditions, so the piston creates the result regardless of the reason it started.


#3

Currently you are using a timer (the every minute do ... done block) to run your code every minute. So basically polling. That’s simply not necessary.

If you get rid of the every minute do ... done and just use your two if ... endif blocks as they are the piston will fire and run your code whenever the phone presence changes and at the start and end times of the between conditions.