Conditional helper

Devices:
Motion Sensor
Door Sensor
Switch

  1. Walk into bathroom motion sensor turns switch on
  2. When there is no motion the light will stay on for x mins
  3. If the light is on and the door is shut the light should stay on even though there is no motion. example in the shower
  4. Once the door opens it should keep the light on for x mins

Let me know if that makes sense. Basically I want to use the door being closed to make sure the condition is met to keep the light on.

This is what I have so Far. It seems to work but not sure if it's the most efficient code. :slight_smile:

Thanks
Mikfe

1 Like

I think the only thing I see is that by default the the Else is only executed when motion event becomes Inactive so no need to test for that in the And's as that condition has already been satisfied - inactive.