Add configuration variable to define timeout/reconnect of mySensors TCP gateway

It seems the mySensors integration has a heartbeat of 10 seconds into the mySensors TCP gateway. If the gateway doesn’t respond fast enough (=immediately) , the connection is closed and re-opened.

In large mySensors networks, the gateway may be eventually busy due the volume of messages to receive/transmit per second. This is should not be interpreted as a network error. And the frequent reconnection from HA may eventually create lags, for example in lights on/off upon a switch, in the exact moment the integration is re-connecting.

If the integration offers a configuration variable, say ‘tcp_timeout’, the user could modify the default 10 seconds of polling and creates a better experience for mySensors hard-core users.

Answering to myself — It looks that changing the baud rate of ESP8266 to 921600 in the Arduino sketch (#define MY_BAUD_RATE 921600 ) did the trick. Go figure out what baud rate has to do with intermittent connection…

Hope it helps someone else with same issue.