Bathroom light level based on Mode night/home


#1

1) Give a description of the problem
Noob trying to figure out simple logic, piston runs, but light turns off as soon as motion ends

2) What is the expected behavior?
During Night mode, bathroom fan light turns on to 5 percent for 7 minutes and then turns off
During home/away mode, bathroom fan light and main light turn on to 100 percent and turn off after 20 minutes

3) What is happening/not happening?
Lights come on correctly, but shut off as soon and motion stops


#2

You have 2 things working against you. The first - your piston is written so anytime Motion is Inactive, it will execute “With bulb 1 and 2, turn off” since that’s in your ELSE section for your first condition.

After you fix that, they WON’T turn off the way the piston is written. More details on that here, with an easy fix:


#3

Thanks for pointing me in the right direction.


#4

Another way to write it would be:

  1. Remove the WAIT commands from your action blocks
  2. Make a new IF statement (not nested in the original):
    IF
    (Motion stays inactive for 7 minutes AND mode is Night)
    OR
    Motion stays inactive for 20 minutes
    THEN
    With bulb 1 and 2
    Turn off