Skip to content

Commit

Permalink
fix timers bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tillsteinbach committed Feb 28, 2024
1 parent 77c4f32 commit 3d69ea5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions weconnect/elements/charging_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,15 @@ def __init__(
def update(self, fromDict):
LOG.debug('Update nextChargingTimer from dict')

if 'id' in fromDict and fromDict['id'] < len(self.parent.profiles):
self.timer = self.parent.profiles[fromDict['id']]
if 'id' in fromDict and fromDict['id'] is not None:
foundTimer = False
for profile in self.parent.profiles.values():
if fromDict['id'] in profile.timers:
self.timer = profile.timers[fromDict['id']]
foundTimer = True
break
if not foundTimer and self.timer is not None:
self.timer = None

self.targetSOCreachable.fromDict(fromDict, 'targetSOCreachable')

Expand Down

0 comments on commit 3d69ea5

Please sign in to comment.