Skip to content

Commit

Permalink
Feed Countdown Take into account Hour
Browse files Browse the repository at this point in the history
  • Loading branch information
dkramarc committed Apr 14, 2024
1 parent 3664a97 commit 19f152b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions custom_components/apex/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def get_value(self, ftype):
apex_type = self.coordinator.data["feed"]["apex_type"]

# Apex Classic does feed with 6 as OFF and 1-4 as ON
# 5 min as 17992
if apex_type == 'old':

_LOGGER.debug(f"get_value[state:feed]: old_data|{self.coordinator.data["feed"]}")
Expand All @@ -73,11 +72,18 @@ def get_value(self, ftype):
return 0 # feed is off
else:
feed_value = self.coordinator.data["feed"]["active"]
hour = feed_value / 60
hour = feed_value
show_hour = 0
if ( feed_value > 3600 ):
show_hour = 1
hour = feed_value / 60
total_minutes = hour / 60
min = int(total_minutes)
sec = (total_minutes - min) * 60
time = f"{min:.0f}:{sec:.0f}"
if show_hour == 1:
time = f"{hour:.0f}{min:.0f}:{sec:.0f}"
else:
time = f"{min:.0f}:{sec:.0f}"
return time

# Handle "feed" if not Apex Classic
Expand Down

0 comments on commit 19f152b

Please sign in to comment.