I am trying to receive a message using node red mqtt on the raspberry pi.
I ran well without mqtt problem in node red, but there is one problem.
Mqtt messages suddenly become unsubscribed.
For example, when booting from the Raspberry Pi,
node red is automatically executed and sensor data is received through the flow.
However, after about 3 to 6 hours,
the mqtt message cannot be subscribed and sensor data cannot be received from node red.
I check mqtt status and it says that it is active,
but when I check mosquitto_sub -t -v'#' in cmd command window, there is no message.
So, when I reboot the Raspberry Pi again, the sensor data comes in without any problems.
Is there any way to solve a case like this?
For example, is there a flow method that can give a command in node red to reboot the raspberry pi if mqtt message is not received, or is there a way to configure the raspberry pi?
In node red configure an inject node feeding a value to an mqtt Out node with a topic of, for example, "test", and an mqtt In node subscribing to that topic and feed that into a debug node. Check that when you click the inject button that the value appears in the debug output. Wait till your sensor stops and see if the test still works. If it does then that shows that node red and the mqtt broker are still going ok. If it does then probably the problem is the sensor or its connection to mqtt.
I don't think it's a sensor problem.
In the case of the sensor, it works properly on a directly connected platform.
The problem is that when connecting mqtt on the Raspberry Pi, publishing suddenly stops after 3 to 6 hours.
Is there a case where mqtt is suspended due to overload due to too many messages?
If that is happening I believe it implies a bug in the device or in the broker. But we are pretty much in the dark until we are given more information.
hi,(first, sorry about my english) i had a similar problem with node red and mqtt communication.
i had connected my sensor to Arduino (or ESP) and then i used the pubSubClient library for mqtt, ran mqtt broker on my raspberry pi, but after a time, the conexion lost.
You can check your code on device (Pub) if you had the loop() function. this function should:
Nick Olleary. - "This should be called regularly to allow the client to process incoming messages and maintain its connection to the server."