MQTT devices being reset fairly frequently

I have some TUYA devices connected / controlled by NR.

One of which is a 3 outlet main power board.

I use one of the outputs to control something else.

Daily (or when scheduled) the outlet it turned on for about 10 minutes (5 either side of when it has to happen) and then turns off.


But I am recently finding the entire set of 3 outputs/outlets are turned on.
OK, there is a button to turn them all on/off. It seems it is the cause, as it too is in the on position.

Yes, I need to monitor the MQTT topic/channel and see what is going on.

How can I see who is sending the message though?


(Why am I asking? For the past 1.5 years I have been 50% of the time away and never really got to see this happening. I would get home and maybe one of the machines had rebooted or locked up and I then had to reboot it. I put it down to that. I'm not sure that is the reason, so I am looking into it.)

There is no way for an MQTT subscriber to know who published a message unless that information is somehow included in either the topic or payload.

Add a debug node everywhere you publish to the topic that switches the light. Give each node a name and set them to output to the console. Then after it happens you can search syslog to find what happens. Or use the flogger node if you prefer to do the same thing.
If the debug node names are all of the form mqtt_debug_something then you can use
grep "mqtt_debug_" /var/log/syslog
to find them all.

Is the pi resetting when this happens? Or node-red restarting?

[Edit] Also, if you restart node-red or reboot the pi does it happen?

TBH, I can't way.

None show they rebooted, so I can rule that out for now.

I suspect it is a message being published by another device with all it's last known conditions of all devices.

I did put a MQTT IN node listening to that topic/channel and weirdly the problem hasn't happened AFAIK.

I did goof and set the channel/topic so it sees ALL messages and so the queue also has that device's regular publishing of its status.

I'll change the topic to where the command is sent and see what I get.

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