Broker doesn't send lwt offline message after migrating to openhab 2.4

Hi, after migrating to openhab 2.4 lwt does not work anymore. I’ve followed this tutorial to setup my sonoffs devices: Sonoff Tasmota with MQTT Binding 2.4 (using config files)

Is there any config keyword to add here?
Bridge mqtt:broker:mosquitto “Mosquitto” [ host=“localhost”, port=1883, secure=false, username=“USERNAME”, password=“PASSWORD”, clientID=“openHAB2” ]
{

Thank you

I have a similar issue, no fix.

There shouldn’t be any difference for lwt messages and regular messages from the subscribers perspective. The client (i.e. Sonoff) registers a lwt topic and message when it connects to the broker and if it disconnects from the broker, the broker publishes the message to that topic. From OH’s perspective, it’s just another message. There is nothing special to set up except a Channel to subscribe to that topic.

Can you confirm that the lwt message is indeed being published using MQTT.fx or mosquito_sub? If not the problem is with either the Sonoff or Mosquitto.

If so then we need further exploration.

this got me thinking. when a node goes away and the LWT message is supposed to fire, would you still see it stored in the broker?

If it’s configured to be retained then yes. If not then it’s ephemeral. If a client doesn’t happen to be subscribed when the message fires it’s lost to the ether.

If that’s the case then AFAIK it’s not working

image

the third line

/beacon/binary_sensor/gti/state OFF 

is the LWT of the beacon in my car that is most definitely disconnected at the moment.

This is what’s not working.

I had posted a topic about it that didn’t get much traction

The client (i.e. the device sending the message or in this case configuring the lwt message to be sent on it’s behalf) defines whether the message gets retained or not. That parameter on the MQTT Broker Thing does not control that. I’m not sure that parameter on the broker does anything at all.

You topic is different. OP here is using Mosquitto. You are having problems with the Embedded Broker.

It tells if the broker connection will by default send retained or non retained messages. But that can be overridden for every channel.

1 Like

so it is.