Letting a piston know that alexa turned on the lights


#1

1) Give a description of the problem
I’d like to know the best way of making the lights stay on when I have turned them on via Alexa. I see there is an option for “physical interaction” so I could say:

“if the switch is turned on physically then do something else”

But how would I go about letting webcore know that alexa has turned on the lights? I assume a virtual switch would be the way to go?

2) What is the expected behaviour?
If I ask Alexa to turn the lights on, they stay on until I ask them to be turned off.

3) What is happening/not happening?
The timer in the piston is running from whenever the lights are switched on and if there is no motion, they turn off. This is what I want to happen and is working perfectly however I’m looking for the best way to keep the lights on if I ask for them to be turned on by alexa.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS)
No logs needed as my piston is working, just looking for advice.


#2

What I did was used a Boolean variable that if motion sensor turns on the light I set variable to true. if turned on manually or by Alexa it sets variable to false. Then I set a condition for the motion sensor that check the variable first. If it is false the motion detector will control lights. If it is true it will basically disable the motion detector


#3

Tell Alexa to turn on a virtual switch. That virtual switch in webcore turns on your actual switch. Add conditions so your other logic doesn’t mess with the switch while your virtual switch is on. When you turn off the actual switch then also turn off the virtual switch. This then frees up the piston to control it again.