I have a bedroom door is usually open during the day, and closed at night. The door now has a window/door sensor. In front of the door there is a corridor with a smart bulb.
Goal is
at night when door opens turn ON corridor light
if light ON for more then 3 minutes then turn OFF
when door closes turn OFF corridor light.
Below is my code, but is not working, do not know why
Your automation to open it will turn on the light, and turn it off after 2 minutes and 30 seconds, regardless of what happens. Isn’t that what you want? It will turn it off after 2:30. The second automation will turn it off immediately.
How many times does the log say that the automation executed? You should “tail” the OZW_log.txt file in /home/homeassistant/.homeassistant directory to see if that device is being turned on or off via Z-wave:
tail -f OZW_Log.txt
Run that on the commandline and then execute your automation and see what it says...