Motion sensor turns on/off master light except when turned on via Alexa


#1

1) Give a description of the problem
Never setup a piston before. I’d like my motion sensor to turn on a master bulb with motion and off when motion stops. This would be 15mins before sundown and 15mins after sunrise… I’d like to keep the lights on if manually turned on via Alexa and then stay on until manually turned off via Alexa. I have set up a virtual switch via IFTTT that turns on/off when Alexa turns on/off the bulb I’d like to control and was hoping to use that virtual switch to override the motion sensor controls

2) What is the expected behavior?
(PUT YOUR INFO HERE)

3) What is happening/not happening?
(PUT YOUR INFO HERE)

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE HERE)

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS)


#2

I’ll help you out on your first one… I believe this should do it. Just change up the variables to your physical devices and then change how long you want the lights to stay on after they are triggered by the motion (or delete that line if you want them to go off right away).

I put the two triggers in the same IF/ELSE IF block to take advantage of the Restrictions at the top of the piston. I could have split them up into two separate triggers, but that would have meant more lines of code for not much value (or functional difference).

See one, do one, teach one… :slight_smile:


#3

Wow thanks! I’ll have a look. I’m still getting used to the terminology


#4

It works perfectly!