Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto reconnect to socket #22

Open
zuidwijk opened this issue Feb 25, 2021 · 5 comments · Fixed by #23
Open

Auto reconnect to socket #22

zuidwijk opened this issue Feb 25, 2021 · 5 comments · Fixed by #23

Comments

@zuidwijk
Copy link

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.

@svrooij
Copy link
Owner

svrooij commented Feb 25, 2021

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)

@zuidwijk
Copy link
Author

Nope, the container keeps running without any error.

@svrooij
Copy link
Owner

svrooij commented Feb 25, 2021

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.

svrooij added a commit that referenced this issue Feb 25, 2021
@zuidwijk
Copy link
Author

So I can change

socket.setTimeout(0);

To (30000 milliseconds)

socket.setTimeout(30000);

@svrooij svrooij linked a pull request Feb 26, 2021 that will close this issue
svrooij added a commit that referenced this issue Feb 26, 2021
* wip: Luxemburg meter parsing

* fix: Timeout on socket connection

Fixed #22

* feat: Basic support for reading encrypted meters

Fixed #21

* fix: Final changes to support decrypting

* docs: Started documentation

* docs: Another docs update

* chore: Remove duplicate screenshot

* chore: Lint errors
@github-actions
Copy link

🎉 This issue has been resolved in version 1.7.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants