Locally attached sensors are hanging with MQTT Gateway (W5100 LAN Interface)
-
Dear all,
I have a centrally controlled system for my Lights and Blinds. I use Arduino MEGA with Ethernet shield and MQTT Gateway. There is no radio, it is cotrolling only locally attached sensors (Lights and Blinds -> buttons and relays). When I have good LAN connection everything is working fine, but when I disconnect the cable, or switch off the Router, then it is not responding. The serial is printing this info only:
(...)
1879015 GWT:TPC:IP=0.0.0.0
1880017 GWT:RMQ:MQTT RECONNECT
1880321 GWT:TPC:IP=0.0.0.0
1881324 GWT:RMQ:MQTT RECONNECT
(...)Is there a way to say, that locally sensors and logic have a priority if there is problem with connection?
-
@gryzli133 yes. Use MY_TRANSPORT_WAIT_READY_MS
If you search the forum for that keyword you'll find some helpful discussions and code.
-
I forgot to mention, I already use this at the beginning:
#define MY_TRANSPORT_WAIT_READY_MS 1
It is working for Serial Gateway, but seems no to work with MQTT Gateway....
-
@gryzli133 sorry about that. MY_TRANSPORT_WAIT_READY_MS is used for communication between MySensor nodes.
There doesn't seem to be a similar parameter for the connection between the gateway and the controller/broker.
-
@mfalkvidd can it be requested as new feature? For serial gateway this works without any problems...
-
@gryzli133 MySensors is a community project. Anyone is welcome to wish for, or contribute new features. See https://www.mysensors.org/download/contributing for a guide on how to get started in case you want to contribute.
As can be seen in the comment on https://github.com/mysensors/MySensors/blob/development/core/MyGatewayTransportSerial.cpp#L37 Serial prints are always deemed successful, regardless if the serial is connected or not (the Arduino can not know if someone is listening or if the sent messages are lost). There is no need to reconnect a serial port, so writing to serial never disturbs the rest of the code. That's why the serial gateway doesn't have any problems with disconnections. I am not familiar with the mqtt code, so I don't know how much effort would be required to develop a solution.
Hopefully someone familiar with the mqtt code has som spare time to assist you, in case you need help.
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
Echo request is not set
Troubleshooting • 12 Aug 2024, 15:36 • kamilb85 3 Sept 2024, 08:58 -
JSN SR04T - Temperature Influencing Readings
Troubleshooting • 6 Sept 2019, 07:51 • Timbergetter 2 days ago -
Getting system time from the controller
Troubleshooting • 27 Feb 2025, 01:39 • dpcons 27 days ago -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting • 27 Aug 2024, 13:20 • igo 27 Aug 2024, 13:20 -
Can not compile MySensors on esp8266
Troubleshooting • 24 Aug 2024, 15:35 • TheoL 29 Aug 2024, 20:47