fgonza2
(Fgonza2)
November 8, 2020, 4:52pm
1
i have a binary MQTT sensor that tracks an online/offline status. But i am having the following issue:
When the device sends an “online” MQTT message, the sensor shows as “off”
When the device sends an “offline” MQTT message, the sensor shows as “unavailable”
Here is the yaml code:
binary_sensor:
- platform: mqtt
name: frigate server
availability_topic: "frigate/available"
state_topic: "frigate/available"
I also tried:
binary_sensor:
- platform: mqtt
name: frigate server
state_topic: "frigate/available"
availability:
topic: "frigate/available"
payload_available: "online"
payload_not_available: "offline"
device_class: connectivity
The result is the same, i get “off” when the MQTT message is “online” and get “unavailable” when the MQTT message is “offline”
Any ideas on what is wrong here ? i am running 117.4
sahni
September 3, 2021, 11:41am
2
No response? I’m having the same issue…
francisp
(Francis)
September 3, 2021, 11:52am
3
If you receive an offline message on your availability_topic, the sensor will be unavailable.
So don’t define an availability_topic
stokesy
September 4, 2021, 6:45am
4
EDIT: better understand MQTT binary sensors now, so this simplified one works without a template (which was throwing LOTS of errors):
binary_sensor:
- platform: mqtt
name: "Frigate NVR"
icon: hass:cctv
state_topic: "frigate/available"
payload_on: "online"
payload_off: "offline"
device_class: connectivity
And for the alert:
alert:
frigate_offline:
name: Frigate Status Alert
entity_id: binary_sensor.frigate_nvr
state: "off"
repeat: 60
can_acknowledge: true
done_message: "Frigate NVR is online ({{states('sensor.time')}})"
message: "Frigate NVR is offline ({{states('sensor.time')}})"
notifiers:
- person
data:
data:
importance: 'high'
1 Like