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

Question about disconnection #616

Open
pamukcu09 opened this issue Feb 29, 2024 · 6 comments
Open

Question about disconnection #616

pamukcu09 opened this issue Feb 29, 2024 · 6 comments

Comments

@pamukcu09
Copy link

If the internet is disconnected while charging and the charger cannot connect to the server, how to re-establish the connection when the internet connection is restored?

Copy link

github-actions bot commented Dec 9, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 9, 2024
@J0ergL
Copy link

J0ergL commented Dec 20, 2024

Hi @pamukcu09,
I am having a similar matter.
Mine is in the direction on how to automatically reconnect once the connection is disconnected.
Connecting to a local CS (SteVe in the local network, without SSL) my clients stays connected for at least 1200h and more.
Connecting to a CS on the internet with I get disconnects after ~36hours and I am not able to automatically reconnect .

Any suggestion on how to code an automatic reconnect is very welcome.

@proelke
Copy link
Collaborator

proelke commented Dec 20, 2024

How to automatically reconnect will depend on the library you use for websockets. I would refer to the documentation of that library and what the specific best case practice is.

@J0ergL
Copy link

J0ergL commented Dec 20, 2024

I am using websockets as in the example.

@proelke
Copy link
Collaborator

proelke commented Dec 20, 2024

Then I would refer to the documentation of the websockets library and look to see what the best strategy is for your application, as this is out of scope of the OCPP library.

@github-actions github-actions bot removed the stale label Dec 21, 2024
@J0ergL
Copy link

J0ergL commented Jan 9, 2025

The following code works in my case:

    try:
        cp = ChargePoint('CP_1', ws)
        await asyncio.gather(
            cp.start(), cp.send_boot_notification(),
            )
    except websockets.exceptions.ConnectionClosed as exception_error:
            logging.exception(
                'Websockets.ConnectionClosed(): %s', exception_error,
            )
            time.sleep(20)
            continue

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

No branches or pull requests

3 participants