I have just finished a major renovation including new windows. All of my windows came equipped with built in magnets and wires coming out of them.
As I use Z2M and have devices all over the place, I naturally wanted to connect these two wires up as well.
When the window is closed the two wires complete a circuit.
I chose the aqara water sensor as it has two screws exposed on the back so really easy to attach to. My problem was that when the circuit is completed on the back of the water sensor it shows status leak.
So here is what I did. I added the following to my Z2M configuration file:
'0x54ef441000efa3ff':
friendly_name: Sensor - Kitchen window
homeassistant:
water_leak:
payload_on: false
payload_off: true
And then I changed the type of sensor from moisture to window in Home Assistant.
I searched a while for this solution which is pretty straight forward so thought I would share. It was the reversing of water_leak I couldn’t figure out initially.