I tried to code even with ChatGDP help I still can get it to work right.
I was trying to get to that so if the door is open turn the light off after 6 mins, but only if someone didn’t turn the light back on during that time.
Rather than turning off with a trigger, when the light turns on you could start a timer. When the timer finishes, turn off the light. If somebody physically turns the switch on, cancel the timer which will prevent it from turning off the light.
I have a similar situation where:
A motion sensor turns the light on and starts a timer for 5 minutes
If somebody hits the Hue dimmer, they’re saying “I want the light to stay on until I turn it off”
If the light has turned on and the door is closed, leave the light on until the door is opened again and then turn the light off after 5 minutes (it’s a bit more complex than this due to closing the door as you exit)