# LWT incorrectly shows system offline

**URL:** <https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718>\
**Category:** General\
**Created:** [5 May 2024 11:21 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718 "2024-05-05T11:21:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [5 May 2024 11:21 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/1 "2024-05-05T11:21:15Z")

</div>

Hello

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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2024 11:24 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/2 "2024-05-05T11:24:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [5 May 2024 12:10 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/3 "2024-05-05T12:10:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 May 2024 21:49 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/4 "2024-05-05T21:49:08Z")

</div>

So, every second a message is sent.

Thought:  
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?

 ![Screenshot from 2024-05-06 07-48-05](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/d/2d8ab7a5bd4ea1ffe9d302de9c81d6087d9e7662.png)

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [6 May 2024 06:25 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/5 "2024-05-06T06:25:49Z")

</div>

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.  
 ![mqtt1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/f/dfc5b09184d108bc5ccc09dd0204c9f953929867.jpeg)

 ![mqqt2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/0/50d5b2fc6ffcf9af4fd47a2b17078b8559be6378.jpeg)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [6 May 2024 09:05 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/6 "2024-05-06T09:05:59Z")

</div>

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?

> [@edstobi](#):
>
> If I lock in and trigger a debung to get a takeover afterwards, the LWT is up to date online again

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:  
`news`?

 ![Screenshot from 2024-05-06 18-58-36](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/a/6a85b55ac14205799e1f74e9263169cd34c49cf6.png)

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.) 😉 Sorry, just saying.

The first picture: The bottom is cropped off.

what is the `session` set to?  
`use clean session`?

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [6 May 2024 12:20 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/7 "2024-05-06T12:20:36Z")

</div>

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

 ![mqtt3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/6446209a084ae46e8a830a1585e9607788e01c6d.jpeg)

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.  
 ![cerbvo](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c337f1a4da241f9cc90b528c87e5cde00d9a3650.jpeg)

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  
 ![mqtt5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/16a8c32d6110e77d0b8103f6c7dd858be523fa34.jpeg)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [6 May 2024 21:49 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/8 "2024-05-06T21:49:13Z")

</div>

> [@edstobi](#):
>
> 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.

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

> [@edstobi](#):
>
> 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

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.

> [@edstobi](#):
>
> 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

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.

# EDIT

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 May 2024 13:28 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/9 "2024-05-08T13:28:33Z")

</div>

> [@edstobi](#):
>
> 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

What mqtt broker are you using?

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 August 2024 13:29 UTC](https://discourse.nodered.org/t/lwt-incorrectly-shows-system-offline/87718/10 "2024-08-06T13:29:23Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
