rianadon/timer-bar-card

Active state wrongly classified as idle

Closed this issue · 1 comments

Describe the bug
I am trying to use the timer-car-card to create a progress bar of the charging procedure of my electric car. The HomeAssistant integration for the car provides an entity which can take one of three states:

  • 'charging' when the vehicle is being charged
  • 'readyForCharging' when there is a charging cable plugged in but no charge session ongoing
  • 'notReadyForCharging' when no cable is plugged in

I have also created entities for extracting the start time when a new charging session is started as well as an entity which indicates when the charge session is expected to end. Both of these are timestamps.

I then configured the card using active_state, start_time, and end_time, however, the active_state is wrongly classified as "idle" and therefore no progress bar is shown (see img1 below). Surprisingly, the classification of the pause_state (which I have set to the situation when the state is equal to 'readyForCharging' works correctly (see img2 below).

Your card configuration

type: custom:timer-bar-card
name: Charge Session
entity: sensor.id_4_pro_performance_150_kw_204_ps_charging_state
active_state: charging
pause_state: readyForCharging
start_time:
  entity_id: sensor.id_4_pro_performance_150_kw_204_ps_charge_session_start_time
end_time:
  entity_id: sensor.id_4_pro_performance_150_kw_204_ps_charge_session_end_time
mushroom: null
debug: true

Debug information

img1 When vehicle is being charged:
image

img2 When cable is plugged in but charge session not active:
Screenshot 2024-08-23 141018

img3 Details for state entity whilst vehicle is being charged:
image

img4 Details for the start_time entity whilst vehicle is being charged:
image

img5 Details for the end_time entity whilst vehicle is being charged:
image

Additional Details
image
image

I figured it out... the config should have been

type: custom:timer-bar-card
name: Charge Session
entity: sensor.id_4_pro_performance_150_kw_204_ps_charging_state
active_state: charging
pause_state: readyForCharging
start_time:
  entity: sensor.id_4_pro_performance_150_kw_204_ps_charge_session_start_time
end_time:
  entity: sensor.id_4_pro_performance_150_kw_204_ps_charge_session_end_time
mushroom: null
debug: true

Note the use of entity rather than entity_id in the start_time and end_time props.