LWT MQTT Sensor (Weather station)

Hello,

I build a weather station with an ESP8266 on battery, and it’s works with the MQTT Protocol.
I implement the LWT to know if my esp8266 work well, but I don’t understand the integration in HA.
I use correctly the “available_topic” but I don’t have an information (sensor or icon) if my LWT is Off or On, on HA.

    availability_topic: "weather_station/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"

Could you help me ?

Hello, @weado. The availability topic isn’t generate any separate sensor. It will only tell HA if your device is available or not, which in turn will tell if the device is comunicating or not with the broker. If your device goes off-line your device will show as unavailable as its main state

Thank for your return but how is it possible to show when my device is unavailable ? Because appart of to see the update value of the sensor , I don’t a good way to know if my MQTT device is off-line ( at least, I think so.)

You can create an specific binary sensor which will show as off when your sensor is unavailable.

binary_sensor:
  - platform: mqtt
    name: state tv
    state_topic: "tele/hub/LWT"
    payload_on: "Online"
    payload_off: "Offline"

I use this to know when my tv is on off based on a nodemcu conected to USB of the TV.

1 Like

Yes, it’s a solution. Thank you for the tip.