On your original flow... Note... the status node reports it's information on msg.status and not msg.payload - so your switch needs to monitor msg.status....
Thank you for your response, which seems interesting to me. Is the software paid? I see that the server is a demonstration server. How did you implement it in Node-RED?
Steve told me earlier in the discussion that to receive a message upon server disconnection, it's configured here. That's why I asked him if he knew what I needed to fill in for it to work and for me to understand how it works for future reference.
When does the MQTT Broker Send the LWT Message?
According to the MQTT 3.1.1 specification, the broker sends a clientâs Last Will and Testament (LWT) message in the following situations:
I/O error or network failure: If the broker detects any issues with the input/output or network connection, it will distribute the LWT message.
Failed communication within Keep Alive period: If the client fails to communicate with the broker within the specified Keep Alive period, the LWT message is sent. In Part-10 of our MQTT Essentials, we will explore the concept of MQTT Keep Alive time and delve into its significance it.
Client closes connection without DISCONNECT: When the client terminates the network connection without sending a DISCONNECT packet, the broker ensures the LWT message is distributed.
Broker closes connection due to protocol error: If the broker closes the network connection due to a protocol error, it will send the LWT message.
Understanding when and why the broker sends the Last Will and Testament (LWT) messages lays the groundwork for implementing best practices in leveraging this feature, which we will delve into in the next section.
Alright, I understand, thank you. Have you added any other parameters or just those? Because I have additional parameters, and how do you handle the payload you receive? Is it in a debug? Is it possible to receive it via email? Or is the payload only visible in the MQTT server?
So on TELEPI when I set up the broker I put in TIMEPI IP address, (in the first tab) then on the third tab I do this with the name TELEPI.
So if the link fails between TIMEPI and TELEPI:
TIMEPI broadcasts a message on the EOM topic and you can process that and see who died, and act accordingly.
On each of your devices configure the broker - setting the IP address.
On the third tab (messages) set up the bottom one with a TOPIC (I chose EOL) and a message that will identify the machine.
If the link from the BROKER to that machine fails the BROKER will send out a message containing the message you entered above.
So you have a MQTT IN node subsribing to that topic.
Do this on ANOTHER machine.
Break the link to the other machine.
Wait for the time out and you will/should see the message arrive via that MQTT IN node.
You then add code (nodes) there to alert you that that machine has died.
Having a LOCAL BROKER you can do this on the BROKER machine.
But if you use a REMOTE one, you can't.
This is a graphical attempt to explain what I said.
(given that "machine 1" is the problematic one.)
and "machine 2" is another local machine.
I am rather puzzled by all this focus on the MQTT LWT message.
@Paul seems to believe that the broker is going down.
If that happens, nobody is going to be sending out LWT messages.
The LWT message will be issued, after a couple of minutes, if Paul's device goes down or looses internet connection.
He would have to be monitoring that topic from a third machine since his will be off-line when it is published. (The behaviour might be different if the birth, death and last will messages are persistent, which I advise against)
If it's the broker that's unreliable, he should be tracking the Birth message which will be issued when either the broker or his own server comes back on line.