Bathroom light automation using motion, contact and illuminance with manual override need help\suggestions


#1

1) Give a description of the problem
I fused my piston with a couple others example pistons and its kind of working but im not sure how to fix it.
2) What is the expected behaviour?
The idea is that when theres motion the lights turn on, when the motion stops with a delay the lights go off. If the switch is pressed, it overrides motion and the lights stay on until the switch is pressed again(kids bath time), and if the door is closed the lights stay on until the door is opened. The brightness is set from a global variable, and that part works great.

3) What is happening/not happening?
The manual override isnt keeping the lights on.

*4) Post a Green Snapshot of the piston![image|45xI 37]


5) Attach logs after turning logging level to Full


#2

At the moment, I don’t have time to analyze this piston, but a quick observation:

I would move lines 88-92 to the appropriate section, and remove that extra trigger.

It is never a good idea to do this:

IF Sensor does X
    Then Turn off Bulb 1
END IF
IF Bulb 1 turns off
    Then do Y
END IF

It is better to stick “do Y” into the first block to reduce your triggers.

I would also do this reduction on White Bulb’s switch turning ON. (lines 77-87)


Another way to say all of this:
Don’t make a trigger that is reacting to a command sent in the same piston.

The reason behind all of this is preventing the piston from starting all over at the top in the middle of an execution.