Skip to content

Commit

Permalink
Update sensor.py
Browse files Browse the repository at this point in the history
Fix wrong EVU time calculation
  • Loading branch information
BenPru authored Nov 15, 2024
1 parent fde3dd2 commit ecc9909
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions custom_components/luxtronik/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,18 @@ def _handle_coordinator_update(
# evu start
if (
self._attr_cache[SA.EVU_FIRST_START_TIME] == time.min
or time_now.hour <= self._attr_cache[SA.EVU_FIRST_START_TIME].hour
or (
self._attr_cache[SA.EVU_SECOND_START_TIME] != time.min
and time_now.hour < self._attr_cache[SA.EVU_SECOND_START_TIME].hour
time_now.hour <= self._attr_cache[SA.EVU_FIRST_START_TIME].hour
or (
self._attr_cache[SA.EVU_SECOND_START_TIME] != time.min
and time_now.hour < self._attr_cache[SA.EVU_SECOND_START_TIME].hour
)
or time_now.hour <= self._attr_cache[SA.EVU_FIRST_END_TIME].hour
)
and (
self._attr_cache[SA.EVU_FIRST_END_TIME].hour > time_now.hour
or self._attr_cache[SA.EVU_FIRST_END_TIME] == time.min
)
or time_now.hour <= self._attr_cache[SA.EVU_FIRST_END_TIME].hour
):
self._attr_cache[SA.EVU_FIRST_START_TIME] = time_now
else:
Expand Down

0 comments on commit ecc9909

Please sign in to comment.