# MQTT question - LWT and Death Certificates

**URL:** <https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742>\
**Category:** General\
**Created:** [8 September 2021 06:17 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742 "2021-09-08T06:17:01Z")\
**Posts on this page:** 13\
**Page:** 1

<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:** [8 September 2021 06:17 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/1 "2021-09-08T06:17:01Z")

</div>

Sorry, but I'm stuck again.

First off this is the message in question:

```auto
{"topic":"EOM","qos":0,"retain":true,"_msgid":"73cc5798.fb9508","settings":{"input":"2021-09-07T19:01:01.537Z","input_format":"","input_tz":"Australia/Sydney","output_format":"YYYY-MM-DD HH:mm:ss","output_locale":"en_AU","output_tz":"Australia/Sydney"},"time":"2021-09-08 05:01:01","payload":"TimePi Comms Up"}

```

Points of _concern_:  
1 - EOM  
2 - message **Comms Up**

Nah.

EOM is Comms Failure.

See picture.

 ![Screenshot from 2021-09-08 16-15-45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/d/ddd0cf45d5ad1520ebde8844119f06e19103cd8f.png)

So, what am I not understanding?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 September 2021 06:48 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/2 "2021-09-08T06:48:30Z")

</div>

Took me a minute to work out what you were asking.

From what I think you are saying, you have received a payload of `TimePi Comms Up` on the topic `EOM`, but the node is configured to send that payload on the topic `SOM`.

What version of Node-RED are you using?

---

<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:** [8 September 2021 07:04 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/3 "2021-09-08T07:04:35Z")

</div>

(Sorry)

NR 1.2.7

Yes. And/or.... If it is receiving an EOM, why am I getting the wrong message.  
The message/topic don't match how MQTT is configured.

---

<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:** [8 September 2021 07:06 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/4 "2021-09-08T07:06:32Z")

</div>

Are you logging the msg direct from MQTT In node or does it pass through some other functions/nodes before the debug node? Just in case something is changing the topic or message before you view it.

---

<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:** [8 September 2021 07:11 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/5 "2021-09-08T07:11:07Z")

</div>

(Bit of a blush)

As directly as possible but I think I have found the problem.

Originally I was filtering the message with the word UP DOWN and FAILURE.  
By your asking I checked and I was filtering on Up Down and Failure.

Changed them to now all be upper case and shall see if it continues.

Greatest apologies. I've been away form playing with NR for a few weeks.

---

<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 September 2021 07:44 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/6 "2021-09-08T07:44:47Z")

</div>

The moral is, whenever you have a node not sending the data you expect _always_ check the inputs to that node to see if it is the input or the node that is not correct.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [8 September 2021 08:41 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/7 "2021-09-08T08:41:08Z")

</div>

> [@Colin](#):
>
> whenever you have a node not sending the data you expect _always_ check the inputs to that node to see if it is the input or the node that is not correct.

That must henceforth be known as @Colin's Law 🙂

---

<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:** [8 September 2021 21:54 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/8 "2021-09-08T21:54:37Z")

</div>

Thanks folks.

But the messages were erratic and throwing me with what is happening.

I log `Birth Certificates` and `Last Will and Testament` messages.

When a `Birth Certificate` is received a different message is sent to request the device to confirm its identity.

2 layer authentication kind of stuff.

I was seeing weird messages happening.

I noticed the incorrect message to topic association.

`EOM` and `Birth certificate`.

I now see/found the problem that the _important part_ was wrong - as in incorrect case this time.

Ok.

But (I shall have to start a new thread) I am now seeing erroneous other things happening.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [9 September 2021 04:51 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/9 "2021-09-09T04:51:45Z")

</div>

The message you posted has the `retain` flag set, so it was sent by the broker, not Node-RED.

Maybe that's a leftover from testing? Did you originally use the `EOM` topic for your Comms UP message and change it to `SOM` afterwards?

Anyway, I would just try to clear the retained message from your broker and see if it works then.

---

<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:** [9 September 2021 07:01 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/10 "2021-09-09T07:01:58Z")

</div>

Yaeh, thanks.

I'm not sure.

But I've flushed them and cleared the `retain` flag.

I'll see what happens now.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [9 September 2021 09:40 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/11 "2021-09-09T09:40:28Z")

</div>

> [@Trying\_to\_learn](#):
>
> When a `Birth Certificate` is received a different message is sent to request the device to confirm its identity.

Andrew, why not add the device identify to the end of the topic you set up for Birth Certificates? Something like `SOM/device1`.

Then for the`mqtt-in` nodes topic you use `SOM/#` and you can get the device id from the topic and save having to confirm the device id.

---

<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:** [9 September 2021 21:25 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/12 "2021-09-09T21:25:19Z")

</div>

> [@zenofmud](#):
>
> Andrew, why not add the device identify to the end of the topic you set up for Birth Certificates? Something like `SOM/device1` .

Fair enough but what I am doing is a kind of "two factor authentication" thing.

A device is connected and sends a "SOM" message. That has the device's name, as the message is "_Device name_ comms UP"  
The three are: UP DOWN and FAILURE. I think it is obvious which is which.

So.... the SOM message is received.

An `IFF` message is sent to request the device confirm who it is.  
That then gets a check with the device's name.

To digress slightly:  
A fair while back I was getting weird things happening with MQTT and I replaced 3 device's power supplies from _generic_ to **OFFICIAL**. The problem has gone away.  
BUT!  
Another one has since happened.

I am getting sporadic IFF, SOM and EOM messages. But _luckily_ no MQTT device resets.  
While investigating this - or as a result - I found I forgot to roll out some changes to the SOM EOM messages.  
The _new_ standard is to have them with upper case UP DOWN and FAILURE.  
and the IFF messages.....

---

<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:** [23 September 2021 21:25 UTC](https://discourse.nodered.org/t/mqtt-question-lwt-and-death-certificates/50742/13 "2021-09-23T21:25:28Z")

</div>

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