MQTT Binary Sensor Unavailable
See original GitHub issueThe problem
I have a MQTT Binary Sensor setup with Home Assistant along with the Mosquitto broker add on.
However, it seems to be stuck at Unavailable, even after sending a bunch of messages that should trigger the state.
What version of Home Assistant Core has the issue?
core-2022.2.9
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
MQTT Binary Sensor
Link to integration documentation on our website
https://www.home-assistant.io/integrations/binary_sensor.mqtt/
Diagnostics information
No response
Example YAML snippet
binary_sensor:
- platform: mqtt
name: "Laundry Room Power"
state_topic: "home-assistant/laundryroom/power/state"
payload_on: "on" # Power
payload_off: "off" # No Power
availability:
- topic: "home-assistant/laundryroom/power/availability"
payload_available: "online"
payload_not_available: "offline"
qos: 1
device_class: power
value_template: "{{ value_json.state }}"
expire_after: 120
off_delay: 300
Anything in the logs that might be useful for us?
No response
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (2 by maintainers)
Top Results From Across the Web
MQTT Binary Sensor - Home Assistant
If availability is not defined, the binary sensor will always be considered available and its state will be on , off or unknown...
Read more >MQTT Binary Sensor - Home Assistant 中文网
The mqtt binary sensor platform optionally supports an availability_topic to receive online and offline messages (birth and LWT messages) from the MQTT device....
Read more >MQTT Sensor Help, Unknown or Unavailable : r/homeassistant
Starting to connect my MQTT sensors again and I'm having trouble. I only get "Unknown" or "Unavailable" although I did see one success ......
Read more >Your MQTT Sensors need your attention. - YouTube
Seeing an error in in your Home Assistant settings that says you need to fix your MQTT sensors ? This video can help....
Read more >Binary Sensor Component - ESPHome
Information about the base representation of all binary sensors. ... If MQTT enabled, all other options from MQTT Component.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Lavaerius I just managed to fix it myself! Weird thing, I had to add qos : 0 to get it working. Or maybe the stars just aligned after 20-30 restarts and attempts… 🤣
@dro159 I did find a fix for that. THe main issue was that this configuration is not working when you put it into sub configs. e.g. sensors/mqttsensors.yaml
It is only working in the main configuration file.
mqtt: sensor: - name: “mqttespheatwatertempin” state_topic: “espheat/water/temperature/in” unique_id: “mqttespheatwatertempin” unit_of_measurement: “°C” force_update: true qos: 0 - name: “mqttespheatwatertempoven” state_topic: “espheat/water/temperature/oven” unique_id: “mqttespheatwatertempoven” unit_of_measurement: “°C” force_update: true qos: 0