BlackZork / mqmgateway

MQTT gateway for modbus networks
GNU Affero General Public License v3.0
42 stars 18 forks source link

Fast modbus reconnecting or mqtt "waiting for online" log message at startup #42

Open BlackZork opened 4 months ago

BlackZork commented 4 months ago

With nothing connected to serial port:

2024-May-03 22:21:00.794580: [ERROR]    modbus connection failed(5) : Input/output error
2024-May-03 22:21:00.795080: [INFO] modbus: connecting
2024-May-03 22:21:00.795150: [ERROR]    modbus connection failed(5) : Input/output error
2024-May-03 22:21:00.795823: [INFO] modbus: connecting
2024-May-03 22:21:00.795884: [ERROR]    modbus connection failed(5) : Input/output error
2024-May-03 22:21:00.796549: [INFO] modbus: connecting
2024-May-03 22:21:00.796610: [ERROR]    modbus connection failed(5) : Input/output error
2024-May-03 22:21:00.797276: [INFO] modbus: connecting

ModbusThread probably gets init messages in mToModbusQueue and after processing it retries again very fast. Do not retry after incoming message we should respect idleWaitDuration in this case.

If modbus network is connected then there are repetitive Waiting for mqtt network to become online messages until MsgMqttNetworkState arrives.