question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MQTT Binary Sensor Unavailable

See original GitHub issue

The 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.

Screen Shot 2022-02-19 at 7 41 17 PM Screen Shot 2022-02-19 at 7 42 08 PM

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:open
  • Created 2 years ago
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Mastiffencommented, Jun 13, 2022

@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… 🤣

0reactions
mkornmuecommented, Nov 29, 2022

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found