Mysensors ethernet TCP gateway loses connection to HA after 2-5 minutes

Good afternoon. Please help me, the following appears in my HA logs in 2-5 minutes: 2021-08-11 15:39:48 DEBUG (MainThread) [mysensors.gateway_tcp] Connection lost with <_SelectorSocketTransport closing fd=24 read=idle write=<idle, bufsize=0>> After this message, the information from the mysensors sensors is not transmitted until the HA core is restarted.

Hi,
Can you share some more detailed information about the sensor itself. Like make (is ‘mysensors’ a make?), model, protocol etc. Also, are you seeing any acutual issue with the function of the sensor, or is it just this error?

The mysensors gateway is assembled from arduino nano, wiznet5500, nrf24l01+. The firmware is up-to-date from this page. Connected to the network and visible on port 5003. It is perfectly visible and it transmits data to MYScontroller, it is also visible and it is available in mycontroller org. I do not observe any problems with the sensor, only a problem with communication in HA 2-5 minutes after restarting the HA core.

Hi,

  • When you say you don’t observe any problems with the sensor, does that mean you can observe the sensor output via it’s local web server, even after it stops communicating with HA?
  • What happens if you leave the direct connection to your sensor open for a while. Does it still stop communicating with HA?
  • Could the sensor be going into sleep mode or is there some kind of timeout setting in the code that breaks connection if no data received in a few minutes. I read in the HA documentation for mysensors that there is a ‘smart sleep’ feature.
  • Have you enabled the debug logging option to see what (if anything) is reported?

Cheers

I’m using a moteino mega programmed as a standard MySensors serial gateway connected to a raspberry pi running ser2net with great results. The MySensors integration is then programmed to connect to the pi at port 5003. In the past three months it’s never gone down.

Let me know if your interested in this setup and I’ll post the details.

I can monitor the sensor in the serial monitor, node mysensors does not have a local web server, but I could be wrong. Through the serial monitor, I see that the sensor continues to send information, but HA does not update it.
As for the sleep mode, I cannot answer, but if I connect the sensor (without changing the sensor firmware) via the Wi-Fi gateway on the ESP8266, then through this gateway, the information in the HA is updated and no loss of connection with the HA occurs.

Did I understand you correctly? You connect the mysensors gateway directly via usb to the raspberry pi using the serial gateway, then do you use this gateway to connect the ethernet gateway mysensors?

MySensors HA Integration —> ser2net —> MySensors serial gateway

ser2net is converting the serial port from the MySensors gateway to a TCP port.

This allows the MySensors gateway to be plugged into a raspberry pi and the pi can be located anywhere in my house as long as it has network connectivity. Could be Ethernet or WiFi. Prefer Ethernet though.

I can then run other things on the raspberry pi as well, such as zwavejs2mqtt, nut upsd, rfc 433, etc. Basically I have many devices plugged into the raspberry pi and it acts as a serial or usb gateway. The raspberry pi is then connected to my network via poe Ethernet and I can easily monitor and remotely reboot (power cycle the poe port) if there are any issues.

Also highly recommend using moteinos for MySensors gateways and nodes as they have the wireless transceiver built in.