rianadon / timer-bar-card

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

10s Countdown timer skips 1 or more seconds seemingly to catch up on 1.24 w/ sync_issues: fix. #66

Open alexruffell opened 1 year ago

alexruffell commented 1 year ago

Describe the bug Sync issues were causing my 10s countdown timer to sometimes start from 8s. I rarely, if ever, see it start from 10s but that was not an issue and actually more accurate as counting down 9 to 0 is 10 seconds anyway. After updating to 1.24 and adding the sync_issues: fix I am now seeing a more annoying issue where the timer often starts from 10s but it skips 9s and sometimes 7s. The issue is repeatable but it does not happen 100% of the times. I noticed the issue on my Win11 desktop.

In my use case, the actual time is not relevant as I use it to trigger an alarm that wakes up my kids and the trigger is on a 10s delay so I can turn it off if done by mistake. Once they are awake... they are awake... so it IS mission critical ;-)

Your card configuration

title: Kids Wake-Up Alarm
type: entities
show_header_toggle: false
card_mod:
  style: |
    .card-header {
      font-size: 18px;
      padding: 2px 15px 2px 15px
    }
entities:
  - type: section
  - entity: input_boolean.delay_wake_up_alarm_kids
    name: Delay Alarm
  - entity: input_boolean.delay_wake_up_alarm_auto_off_kids
    name: Delay Alarm Auto Off
  - entity: input_select.wake_up_alarm_delay_kids
    name: Alarm delay (minutes)
  - entity: sensor.next_wake_up_alarm_kids
    name: Next Alarm
  - entity: sensor.scheduled_wake_up_alarm_kids
    name: Scheduled Alarm
  - entity: sensor.adjusted_wake_up_alarm_kids
    name: Adjusted Alarm
  - type: divider
  - entity: input_boolean.trigger_kids_wake_up_alarm
    name: Trigger Alarm
  - entity: timer.trigger_kids_wake_up_alarm
    type: custom:timer-bar-card
    name: Triggering in...
    bar_background: gray
    bar_radius: 5px
    invert: true
    sync_issues: fix
    modifications:
      - elapsed: 40%
        bar_foreground: orange
      - elapsed: 70%
        bar_foreground: red

Debug information Please add debug: true to your configuration and either take a screenshot or paste the output here!

State: idle (state mode = idle)
Mode: idle (auto mode = N/A, unused)
Duration: 10 second
Time remaining: -495.582
Counter: -495.563
Attr: {"duration":"0:00:10","editable":true,"icon":"mdi:av-timer","friendly_name":"Trigger Kids Wake-Up Alarm"}

Thank you for the awesome card!

rianadon commented 1 year ago

Hmm I'll have to look into why this is.

Until I stop the timer from jumping around, you can use sync_issues: ignore. The timer will start counting down from 8 again, but you won't see the sync warning or this issue.