cyberumb15
(Cyberumb15)
November 27, 2018, 9:01pm
1
How to manually reset water leak sensor via script execution?
here is my binary sensor:
platform: mqtt
name: “Basement Leak”
state_topic: “tele/RF_Bridge/RESULT”
value_template: ‘{{value_json.RfReceived.Data}}’
payload_on: “15829521”
device_class: moisture
#off_delay: 30 {I want to manual reset instead self reset after xx seconds}
retain: false
Here is my reset script but it did not work
sequence:
service: mqtt.publish
data:
entity_id: binary_sensor.basement_leak
state_topic: “tele/RF_Bridge/RESULT”
value_template: ‘{{value_json.RfReceived.Data}}’
payload_off: “15829521off”
Thanks,
gumbo
November 27, 2018, 11:44pm
2
It looks like you might be using the wrong type of quotes. Plus I would also add the payload_off line into your sensor.
I would suggest the following changes to your sensor language:
platform: mqtt
name: “Basement Leak”
state_topic: "tele/RF_Bridge/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: "15829521"
payload_off: "15829521off"
device_class: moisture
#off_delay: 30 {I want to manual reset instead self reset after xx seconds}
retain: false
Hope that helps.
Your “Basement Leak” sensor has a “payload_on” defined, but not a “payload_off”.
If you are going to send “15829521off” to turn it off, you need to define that as the payload_off attribute in your sensor entity.
I would also look at the MQTT stream and check that the payload off is getting published in the right place, and formatted correctly. In my own automations for this, I build the JSON manually because I find it simpler. That looks something like this, in the automation
service: mqtt.publish
data:
topic: "tele/Sonoff_RFBridge/RESULT"
payload: "{\"RfReceived\":{\"Data\":\"15829521off\"}}"
retain: "true"
cyberumb15
(Cyberumb15)
November 28, 2018, 2:02am
5
Thanks. I got mine working too. I didn’t know that I don’t need to have water leak entity_id to reset it, just proper payload.
service: mqtt.publish
data:
topic: tele/RF_Bridge/RESULT
payload: 15829521off