LWT incorrectly shows system offline


I have found one point which I cannot explain

The Node send mqtt LWT (last will) simply comes after a time in mqtt that it is offline although this is not the case.

If I lock in and trigger a debung to get a takeover afterwards, the LWT is up to date online again.
Here I do not understand why mqtt does not maintain the LWT, especially since every second the Cerbo node_red is sent via mqtt ( other MQTT server) values

Are there better settings for Retain and QoS than the default ones?

What version of Node-RED are you running?

Which MQTT nodes are you using (i.e. are you using built in MQTT nodes, or some contrib nodes installed from the palette)?

Lastly, what broker are you using?

I am using Node.-Red v3.1.5 with the built in mqtt. (preinstalled on a Victron Cerbo device)
A function node is sending every second a payload to the mqtt out node to send it to a mosquito mqqt broker running on a raspberry

So, every second a message is sent.

Put a MQTT IN node somewhere and see if all the messages are being received.

In the MQTT config:
Which version of MQTT do you have installed?

Could you also share this page?

Hi and thx for your respond
I am having a grafana DB where the data are stored. And I am using MQTT explorer to monitor the traffic.

1 Like

Ok, that looks good.
(Worth checking.)

Nothing there screaming a problem to me.

Sorry, but how often is it happening?

At the same time daily?

I'm not really understanding this part.
Could you screen shot that part of the flow - please?
(the mqtt out and a few nodes before it.)

Well, I think I know - as I have similar problems - but I think it is worth checking.

Forgive me not being able to translate but looking at the second picture:

I'm guessing it is the MQTT OUT node.

Just on my version it is more like Messages not news. (Lost in translation?)

Oh, sorry. My mistake. I wasn't looking on the BROKER machine.

Yes, that looks ok.

Interesting your Birth Certificate is set to qos 1.
But you are talking about the LWT.
(I like how some messages are in German and some in English.) :wink: Sorry, just saying.

The first picture: The bottom is cropped off.

what is the session set to?
use clean session?

I'll start with the language mix. I received an IoT as a gift when I was still at the very beginning and was happy that something lit up. Then I never changed it and the howl environment has grown.

Yes, it's mqtt out node and “Nachrichten” are messages.

Nachrichten bei Verbindungsaufbau = birth message and that works . I have adjusted retain and QoS to your values.
The cut off part of picture one I have never seen before and it is by default set to “Bei allen Flows” which translates to all flows.
I can translate with "use clean session" only so delete all MQTT to target MQTT 160 and redo?
Is that correct? I haven't done that yet.

This is what I am using in this Flow:
Getting Infos from Victron Nodes and from Victron MQTT, filtering and formatting, then send it to MQTT Server

At first I had no MQTT read and send to MQTT. I did this to reduce the traffic and the entries in the database. There is no way to tell a mqtt in node to fetch a value only every second. The NodeRed, MQTT and all other Victron features are pre-installed on the Cerbo GX by the manufacturer Victron. you can do all this in this device without any loss of performance.

To the last question, how often it happens, I am trying to find out. I send a time stamp to the MQTT server every minute. It feels like it happens every 2 days if I don't do anything to the NodeRed systems

Sorry, I'm not sure.

But on mine it is ticked. Use clean session.

(Nothing to do with the problem as stated however this is confusing for me.)

This is confusing / not good.

Looking at your first picture:
The blue nodes are getting their messages from the device. Not sure if that is Victron or Cerbo, but....

So - to me - what ever the device is sending is being seen at the output of the blue nodes.
I'm not sure how/why you use/need the MQTT node.

Towards the right there are 3 link nodes.
I'm guessing they are tied together.

Ok, also a bit confusing. (To me)

You don't need to ping the broker.

A LWT message comes through on its own topic.

(tangent - and sorry for this)

I looked again at your MQTT config.

The Retain for the LWT is blank.
Try setting to to falsch.

This may not be a problem but I do have a feeling leaving those things blank/empty isn't good.

(End tangent)

So you would have a MQTT-IN node with the topic set to LWT Topic/Victron_NodeRed

Then see when you are receiving messages on that node.


I am not sure it is a good idea to have spaces in the topic name. Causes confusion if I remember correctly.

What mqtt broker are you using?

Have a look at the broker logs in order to better understand what is going on.