Contact sensor automation

I’ve created an automation that turns on the light in the laundry room when the door opens.

It works fine, but when the door is left open, the light turns on randomly. Apparently, the contact sensor reports its state from time to time, not just when it changes.

Any ideas on how to solve it? Thanks a lot!

Play around with a toggle node that is set to pass messages only ‘if changed’, and a trigger node at e.g. 30 seconds. I have some Bluetooth sensors that constantly resend on or off messages and I’ve managed to get them working perfectly that way.
If it doesn’t work for you then you should post this on the Node-red forum.

Thanks, I’ll give it a try.
Let’s see if I can make it work :sweat_smile: