rianadon / timer-bar-card

A progress bar display for Home Assistant timers
Other
340 stars 15 forks source link

`resolution: automatic` showing 60mins instead of an additional hour #151

Open JCPvanHooren opened 1 month ago

JCPvanHooren commented 1 month ago

First: thank you for this card; it's a very nice card!

Bug Description When selecting resolution: automatic, the remaining time is nicely truncated to show hours and minutes, but no seconds, when there's more than 1 hour remaining. Unfortunately, it rounds the minuntes up, even when there's X:59:SS left, meaning it'll show X hours and 60 minutes.

Card configuration (nothing exciting)

type: custom:timer-bar-card
entities:
  - timer.a_c
invert: true
layout: full_row
resolution: automatic

Debug information I haven't included this, as the card is function fine, just showing an odd number in the GUI. If you do want me to include, please let me know.

I guess the solution could be to round the minutes down, instead of up, which would avoid a more complicated logic to add another hour. If this is undesirable, of course it could be done to add an hour when the minutes would be 60.

rianadon commented 1 month ago

Good find! We agreed in #86 to round the minutes up, so I'll go with the more complex logic of making 1:59:59 seconds round to 2:00 minutes.