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

Retry on connection error to GW API #63

Open
valentijnscholten opened this issue Mar 16, 2022 · 1 comment
Open

Retry on connection error to GW API #63

valentijnscholten opened this issue Mar 16, 2022 · 1 comment

Comments

@valentijnscholten
Copy link

valentijnscholten commented Mar 16, 2022

I regularly have gaps in my pvo graphs due to gw2pvo being unable to get the data for a specific iteration of run_once.

INFO     Normal, 381.0 W now, 13.1 kWh today, 110.7 kWh all time, 233.9 V grid, 333.1 V PV
INFO     Normal, 378.0 W now, 13.1 kWh today, 110.7 kWh all time, 233.1 V grid, 329.2 V PV
INFO     Normal, 360.0 W now, 13.2 kWh today, 110.8 kWh all time, 233.2 V grid, 329.3 V PV
WARNING  HTTPSConnectionPool(host='semsportal.com', port=443): Read timed out. (read timeout=10)
ERROR    Failed to call GoodWe API (code 100002)
INFO     Normal, 314.0 W now, 13.2 kWh today, 110.8 kWh all time, 232.7 V grid, 321.6 V PV
INFO     Normal, 294.0 W now, 13.2 kWh today, 110.8 kWh all time, 232.9 V grid, 326.0 V PV
INFO     Normal, 279.0 W now, 13.3 kWh today, 110.9 kWh all time, 233.3 V grid, 332.2 V PV

I suggest to implement some retries as on subsequent requests the portal works fine.

For example via: https://stackoverflow.com/questions/15431044/can-i-set-max-retries-for-requests-request or https://www.peterbe.com/plog/best-practice-with-retries-with-requests

Workaround:

  • Use --data xxxxx to reupload the data for every day or days with gaps
@valentijnscholten
Copy link
Author

hmm looking at the code, there is already some custom retry mechanism with increasing backoff (4 tries with 3s, 6s, 9s, 12s delay).

so I shouldn't have gaps in my graphs, except when it exceeds 4 retries:

INFO     Normal, 117.0 W now, 13.5 kWh today, 111.1 kWh all time, 233.6 V grid, 322.4 V PV
WARNING  HTTPSConnectionPool(host='semsportal.com', port=443): Read timed out. (read timeout=10)
WARNING  HTTPSConnectionPool(host='semsportal.com', port=443): Read timed out. (read timeout=10)
ERROR    Failed to call GoodWe API (too many retries)
INFO     Normal, 115.0 W now, 13.5 kWh today, 111.1 kWh all time, 233.3 V grid, 325.0 V PV

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

No branches or pull requests

1 participant