Different pistons controlling lights, so they turn off before expected


#1

So I have some outdoor lighting-my “garden lights”
I use to just have them on from sunset to midnight, but to save energy I want to have them on sensors. I have various sensors in different locations that I now have operating the lights.
They are on different pistons, as some of the sensors are actual motion sensors (Homeseer and SmartThings) and some are cameras that turn on virtual switches through webhooks with motion.
It’s working but the problem is that the pistons have waits that will turn off the lights after three minutes. So when that one piston times out-the lights turn off even if another piston has been activated.
For example-I pull in the driveway and camera one sends a Webhook that activates a piston that turns on the lights. I then go in the foyer and the sensor in there activates another piston that I want to keep the lights on, but the first piston will time out and turn the lights off, requiring another motion event in the foyer to turn them back on. Make sense?
Should I just have all the pistons just keep turning the lights on, and create another piston for the timer? Will the “turn on” pistons keep resetting the timer piston to 0 at each event?
Thanks, I know there’s got to be a better way.


#2

So I solved it by having the various “sensing” pistons turn on a virtual switch that would automatically get turned off as soon as it was turned on (By another piston).
I then created a piston that would turn on the lights when this virtual switches status changes to “on”.
Then it starts a timer that keeps going back to 0 each time there was an event on one of the sensing pistons.
Seems kind of convoluted but it seems to work.
Thoughts?-no need to be gentle-I know just enough about Webcore to thoroughly confuse myself.


#3

I lashed up something very similar, but my ‘turn off / reset to standby’ piston just runs every minute, checking if the doors have been closed for at least x time, no CCTV motion detected for x time, no arrivals for x time etc.

If it’s ok to turn off, it has different actions based on the time of day, i.e. 1% brightness between sunset and 1am, otherwise turn everything off.

You method is more efficient though, and certainly spams the ST servers a lot less than mine. Been planning to re-write mine at some point.

I will probably use a global Boolean variable instead of a simulated switch though, to save having clutter in the app (not that I use the crappy ST app anymore, the Alexa app is much faster for manual control)


#4

Could you explain that further? My ST interface is LOADED with virtual switches that I needed to create for scripts, but don’t need access to.
Thanks


#5

When you are editing a piston, you will see the option to add global variables in the right hand margin. Global variables must have a name starting with the @ symbol.

A Boolean variable has two ‘states’… true or false, thus can be used as a replacement for a simulated switch.

Global variables can be accessed from any piston, either as a trigger or a condition, by choosing ‘variable’ instead of ‘physical device’ in the ‘what to compare’ field.

Global variables can be set from any piston using the ‘set variable’ action.

Other types of Global variable can be used to share numbers, dates, device lists etc. between pistons, so if you use a value or group of devices in a lot of pistons, put it in a global and you will only ever need to edit in one place should the need arise.


#6

AHA!. Got it. (I think.)
Will have to experiment.
Thanks!