rianadon / timer-bar-card

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

The last modification is not reset when timer restart #20

Open SAOPP opened 3 years ago

SAOPP commented 3 years ago

Hi!

Thanks for this awesome card! :)

I have a question about saving the last modification by the card if timer was restarted, for example it's is my mod:

              modifications:
                - greater_than: 50
                  bar_foreground: orange
                  active_icon: mdi:circle-slice-4
                - greater_than: 75
                  bar_foreground: red
                  active_icon: mdi:circle-slice-6
                - greater_than_eq: 94
                  active_icon: mdi:timer-10

when greater_than: 75 is active phase, for example, and my timer is restarted, the progress bar is still got red bar foreground, so I need reload lovelace. Dunno, if it's card issue or lovelace. My browser is latest Chrome.

Any suggestion? Thanks in advance!

SAOPP commented 3 years ago

Here is what I'm talking 'bout:

20210910-165649

rianadon commented 3 years ago

How are you restarting the timer?

When I open Home Assistant in chrome and restart the timer by clicking cancel and start, I don't see the timer keeping the red bar. Perhaps we are restarting differently?

SAOPP commented 3 years ago

My timer restarting by motion. Service cancel then start.

SAOPP commented 3 years ago
- alias: corridor_light_timer_reload
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.corridor_mi_motion
    from: 'off'
    to: 'on'
  condition:
    - condition: state
      entity_id: light.philips_e27_bulb_lobby
      state: 'on'
  action:
  - service: timer.cancel
    entity_id: timer.corridor
  - service: timer.start
    entity_id: timer.corridor
rianadon commented 3 years ago

I wonder if the issue may be that the timer is embedded inside another card.

Does it work if you add the timer bar card directly to your lovelace dashboard?

SAOPP commented 3 years ago

Yep, my timer is under conditional card:

          - type: conditional
            conditions:
              - entity: timer.corridor
                state: "active"
            card: 
              type: custom:timer-bar-card
              bar_width: 40%
              entities:
                - entity: timer.corridor
                  name: Corridor
              modifications:
                - greater_than: 50
                  bar_foreground: orange
                  active_icon: mdi:circle-slice-4
                - greater_than: 75
                  bar_foreground: red
                  active_icon: mdi:circle-slice-6
                - greater_than: 98
                  active_icon: mdi:timer-10