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
Just use a basic piston for what you are doing there, and I would change those conditions to solid circle triggers.
Solid circle triggers?
The wait and the set level 0% should be two tasks in the same action. You can add multiple tasks to each action…
Also, I would use a simple piston:
IF
Door is open
THEN
Using light...
> Set level to 100%
> Turn on
ELSE
Using light...
> Wait 5 minutes
> Turn off
The Turn on is there because some devices may not turn on as a result of level setting, but most will.
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.
is there s way to trigger a virtual switch with a variable in the name? I want to do something like this.
On motion turn on scene${currentMode}
I’ve been unsuccessful with my attempts.
You can technicaly set a string variable to “scene{variable}” but not sure how you will send the variable. What device? What task?
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…
Thanks again for all your help!
Nitin
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.
Whats wrong with this piston?
It keeps reseting the timer to 15 min with motion even though lux it above the threshold.
I had the same issue and was advised tof use 'only on piston state change ’ in the else part.
Worked or me.
Ok, I’ll give that a try. Thank you!
Can you upload an image of this piston from your dashboard? I don’t have any tasks in “Else” so I’m not able to toggle that feature.
Make it a latching piston, you don’t need it else if because piston state turns true if any of your IFs is true. Make it latching, then set thestate change only on the action that contains the wait.
The problem with your approach is that your lights turn off some time after motion became active. If you keep moving for that period of time, you will get the lights turned off on you. It is generally better to use motion active to turn on and use motion inactive to turn off after some time. I use latching pistons for anything involving movement for this reason.