magico13 / PyEmVue

Python Library for the Emporia Vue Energy Monitor
MIT License
185 stars 36 forks source link

Fix for usage responses missing more data than intended #70

Closed magico13 closed 3 months ago

magico13 commented 3 months ago

Also ran formatter, so that makes this a little harder to follow. Should be easier to follow PRs afterward, or just look at individual commits.

Main changes are in pyemvue.py and get_device_list_usage around line 150 (in the new side). That function now allows passing the retry parameters in case you don't want to use them or want different amounts, likely need to do something similar for the retries within auth.py.

Main bugfix in that function is to continue iterating over the whole set of data and not quitting immediately. That could result in missing data for anyone but is most obvious when there are two root devices and one is offline, if the offline device is first in the list then we will never get data for the second device. Sometimes the order changes but not consistently.