MQTT question - LWT and Death Certificates

Sorry, but I'm stuck again.

First off this is the message in question:

{"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.

So, what am I not understanding?

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?

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

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.

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

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.

2 Likes

That must henceforth be known as @Colin's Law :slight_smile:

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.

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.

1 Like

Yaeh, thanks.

I'm not sure.

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

I'll see what happens now.

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 themqtt-in nodes topic you use SOM/# and you can get the device id from the topic and save having to confirm the device id.

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