Hi! Trying to setup an MQTT binary_sensor that reports a state of 'on' when value received over mqtt is anything thats not "0" and a value of "off" when value received is "0". This is the code I have put together so far:
- platform: mqtt
name: "Sink Leak Sensor"
state_topic: "homeassistant/binary_sensor/tasmoleak01/water_leak"
device_class: moisture
qos: 0
value_template: "{{ 'off' if value == 0 else 'on' }}"
payload_on: 'on'
payload_off: 'off'
force_update: true
The binary_sensor reports as wet when value changes from 0 to anything higher but when the value returns to 0 (after I dry the sensor) it does not return to 'off' (or Dry). What am I doing wrong? Any Help would be much appreciated?