Hi everyone!
I was a bit inspired by reading a previous post by sebby (http://forum.micasaverde.com/index.php/topic,119190.0.html), and been playing around with a bit of the functionality rigpapa demonstrates with counting >n devices being on. Not sure I’m going about this the best way so wanted to get some thoughts from the experts.
So I have 3 lights I’d like to have automatically turn off if they’re left on for more than 30 mins. For simplicity let’s call them device 1, 2 & 3.
I was examining rigpaps custom expression to check the number of devices that are on, as such:
I defined a new service variable “NumDevicesOn” and used this:
len( iterate( list(1,2,3), ‘if( getstate( dev, “urn:upnp-org:serviceId:SwitchPower1”, “Status” )==“1”, 1, null )’, “dev” ) )
This works… but the problem is what do I execute if NumDevicesOn is >0? (and using the sustained for for 1800 sec / 30 min)
I could execute a trip action that turns off device 1,2 & 3, that’s easy…
But if device 1 has been on for 30 mins and device 2 has only been on for 5 mintues, I don’t really want device 2 to be turned off yet… Just device 1. hmm… :-\
Do I have to build a separate reactor sensor for each light? Checking the status of each and if they’ve been sustained for 30 min, then execute a trip action to turn off each individual light?
I could use delay light as well, as it has a feature to turn off after a set period on manual activation, but same issue… I can set each light as a trigger, but I can only run 1 scene to turn off ALL devices from a single delay light sensor… otherwise, I’m creating separate delaylight sensors for each light.
Is there a way to do this all with 1 reactor sensor, using the expression code above that monitors all the lights I’d want to have 30 the minute auto-off cycles assigned to? and selectively executes a “turn off” only for the light that’s been on for 30 min? ???