gw2pvo
gw2pvo copied to clipboard
Retry on connection error to GW API
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
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