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?


  • Mod

    @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....


  • Mod

    @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...


  • Mod

    @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.


Log in to reply
 

Suggested Topics

  • 3
  • 8
  • 5
  • 6

12
Online

11.4k
Users

11.1k
Topics

112.7k
Posts