rianadon / timer-bar-card

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

waiting_state and start_time { entity } config showing "Invalid Date" #131

Open gwilford opened 8 months ago

gwilford commented 8 months ago

Describe the bug "Invalid Date" is displayed instead of the start time while in waiting state:

Bosch Dishwasher - Operation state         Delayed Start Invalid Date

Both start_time and end_time entities are defined and are of type device_class: timestamp:

2024-03-12T00:06:39+00:00
2024-03-12T02:25:06+00:00

Is the start_time entity config being ignored or overriden by the main entity state/start_time attribute?

Your card configuration

type: custom:timer-bar-card
entities:
  - sensor.402100530466009091_bsh_common_status_operationstate
active_state: BSH.Common.EnumType.OperationState.Run
waiting_state: BSH.Common.EnumType.OperationState.DelayedStart
icon: mdi:clock-end
start_time:
  entity: sensor.dishwasher_delayed_start_time
end_time:
  entity: sensor.402100530466009091_bsh_common_option_remainingprogramtime
debug: true
translations:
  BSH.Common.EnumType.OperationState.Ready: Ready
  BSH.Common.EnumType.OperationState.Finished: Finished
  BSH.Common.EnumType.OperationState.DelayedStart: Delayed Start
  BSH.Common.EnumType.OperationState.Run: Run

Debug information

State: BSH.Common.EnumType.OperationState.DelayedStart (state mode = waiting)
Mode: waiting (auto mode = N/A, unused)
Duration: 8307 second
Time remaining: 11140.116
Counter: 11140.116
Did you set active_state? Attr: {"device_class":"home_connect_alt__status","icon":"mdi:gauge-full","friendly_name":"Bosch Dishwasher - Operation state"}
gwilford commented 8 months ago

I'm now pretty sure the start_time entity config is being ignored/overriden as the following sensor template causes the card to work as expected, i.e. shows the delayed start time when in waiting mode:

      - name: Dishwasher state
        state: >
          {{ states('sensor.402100530466009091_bsh_common_status_operationstate') }}
        attributes:
          start_time: >
            {% set relhm = states('sensor.402100530466009091_bsh_common_option_startinrelative') %}
            {{ (now() + as_timedelta(relhm + ":00")).isoformat() }}
          end_time: >
            {{ states('sensor.402100530466009091_bsh_common_option_remainingprogramtime') }}

with this simplified config:

type: custom:timer-bar-card
entities:
  - sensor.dishwasher_state
active_state: BSH.Common.EnumType.OperationState.Run
waiting_state: BSH.Common.EnumType.OperationState.DelayedStart
icon: mdi:clock-end
translations:
  BSH.Common.EnumType.OperationState.Ready: Ready
  BSH.Common.EnumType.OperationState.Finished: Finished
  BSH.Common.EnumType.OperationState.DelayedStart: Starting at
  BSH.Common.EnumType.OperationState.Run: Run

Hope this helps...

rianadon commented 8 months ago

You're right! Thanks for digging into this. The waiting state is using the attribute instead of the entity.

I'll fix this for the next release.