smartmeter2mqtt
smartmeter2mqtt copied to clipboard
Auto reconnect to socket
I've been playing with your smartmeter2mqtt and found an issue:
If the connection to a network device get lost, it won't reconnect.
version: "3.7"
services:
smartmeter:
image: svrooij/smartmeter:1.6.0-beta.5
restart: unless-stopped
ports: # Depending on your situation you'll need to expose some ports
- 3000:3000
- 3010:3010
- 3020:3020
environment:
- TZ=Europe/Amsterdam
- SMARTMETER_socket=192.168.0.10:23
- SMARTMETER_web-server=3000
- SMARTMETER_tcp-server=3010
- SMARTMETER_raw-tcp-server=3020
When I disconnect and reconnect my ethernet reader, it won't reconnect.
At that point the app will exit with an error code. Then you can use docker to just restart the container (by adding restart: on-failure
)
Nope, the container keeps running without any error.
It had the code in the program, but I overlooked the documentation. By default a socket has no timeout....
Now it will exit as expected when there isn't any data for 60 seconds.
So I can change
socket.setTimeout(0);
To (30000 milliseconds)
socket.setTimeout(30000);
:tada: This issue has been resolved in version 1.7.0-beta.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket: