Privatecoder / seplos-mqtt-remote-rs485

fetch data from one or multiple Seplos battery packs via (a) (remote) RS485 connection(s)
9 stars 3 forks source link

Container stops on power loss #5

Closed jwillmer closed 4 months ago

jwillmer commented 4 months ago

I rewired my Waveshare RS485 only to find out that the docker container stopped working afterwards. Can we keep the container running and trying to reconnect / self recover?

2024/03/01 23:22:29 socat[7] E read(7, 0x14b2a8c6c000, 8192): Connection reset by peer
ERROR:SeplosBMS:Serial port disconnected, cleaning up and exiting...
Privatecoder commented 4 months ago

if the container is started with --restart unless-stopped any error will cause a restart of the container which can be considered self recover in my opinion

jwillmer commented 4 months ago

Good idea. Will do for now. But might not be the best for prolonged downtime.

Privatecoder commented 4 months ago

For prolonged downtimes, the container could be stopped. Adding a logic here would require monitoring socatwhich itself does not have built-in logic to retry a connection after it's been closed or reset.