Skip to content

Commit

Permalink
EV_adaptive_charging: reduce the load on the Emporia server
Browse files Browse the repository at this point in the history
In order to comply with magico13/PyEmVue#19,
the service will only poll the by second data if it is actively
charging.

Signed-off-by: Jeremy Compostella <[email protected]>
  • Loading branch information
jeremy-compostella committed Aug 23, 2021
1 parent 454cd47 commit 7a31499
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion EV_adaptive_charging.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ def main():
entered_at = datetime.now()
while True:
try:
usage=vue.read(scale=Scale.SECOND.value)
if charger.isCharging():
scale = Scale.SECOND.value
else:
scale = Scale.MINUTE.value
usage=vue.read(scale)
break
except:
if entered_at + timedelta(seconds=90) < datetime.now():
Expand Down

0 comments on commit 7a31499

Please sign in to comment.