Locally attached sensors are hanging with MQTT Gateway (W5100 LAN Interface)
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:
1880017 GWT:RMQ:MQTT RECONNECT
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?
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.