(and a load of things not relevant for this piston)
What I’d like to achieve, and have setup through lighting director right now is to have the lounge lights, (can be individually and set level, using a group switch, or using a momentary scene switch), turn on when:
lux is below 20 AND there is motion
Turn off if no motion for 3 mins
BUT
If the lights are manually turned on using: hue widget/smartthings/sharptools - whatever. Then don’t worry about the former.
Any pointers would be greatly appreciated.
Nitin
EDIT: actually, something close to this type of logic with an external variable looks like it may be how I should structure this? (credit to ady624)
Yeah that is what I am using for my kitchen lights. It uses an internal (local) variable and works as requested by you above. You do not need the time of the day condition, but add the lux condition. And adjust the waits accordingly.
How is this catered for in the above dashboard?.. I’m having some training in understanding the variable logic and how a manual turn on as described in my original post, comes into play here?
Well, here’s the trick: if motion is detected and the light is off, it turns it on and sets a variable to true (meaning I - the piston - turned the light on). When motion stops, if the variable is true (meaning I - the piston - turned it on), then it schedules an action to turn it off later. When the light was turned on manually or by any other means other than the piston, the light will already be on when motion is detected, so nothing will happen. That’s the whole piston logic, in plain English
That looks better. I guess I should clarify though. It’s not the turning off that’s the issue, it’s the turning on/setting level. The lights in question are currently at 1%, but do not raise when the door is open. I created a simple piston if door is open, then set level to 100. Nothing happens.
Thanks for laying it down, it’s going to take me a while to get my head around this. I don’t understand the 2nd ‘then’ conditions and the ‘tcp cancel on…’ part… I think I may need to take some CoRE courses!
Anyway, I will persevere. Btw, is there a way to create Pistons on a web GUI, going around the smartapp can be a little cumbersome…
If you are doing a lot of them, and know Android a bit, some people use the Android emulators like MeMu or Bluestacks. When I first moved all my rules over I did this.