kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
3.05k stars 236 forks source link

state_map - only works for first entity when multiple entities exists #802

Closed Sam01101101 closed 2 years ago

Sam01101101 commented 2 years ago

This example from the usage page no longer works on HA 2022.6.

when the first entity changes, the state_map updates correctly, However, when the any of the other entity changes state the state_map doesn’t update or work.

type: custom:mini-graph-card
entities:
  - entity: binary_sensor.living_room_motion
    name: Living room
  - entity: binary_sensor.corridor_motion
    name: Corridor
  - entity: binary_sensor.master_bed_motion
    name: Master bed.
    color: green
  - entity: binary_sensor.bedroom_motion
    name: Bedroom
name: Motion last hour
hours_to_show: 1
points_per_hour: 60
update_interval: 30
aggregate_func: max
line_width: 2
smoothing: false
state_map:
  - value: "off"
    label: Clear
  - value: "on"
    label: Detected

image

ildar170975 commented 2 years ago
  1. Please use triple "`" to format a code. Currently your code is absolutely unclear and possibly may have problems with indentation.

when the first entity changes, the state_map updates correctly, However, when the any of the other entity changes state the state_map doesn’t update or work.

  1. In your picture only a state for the 1st entity is shown. How do you know that states are not updated for other entities?
Sam01101101 commented 2 years ago

Apologies, i've updated the code.

I understand, for some reason I was under the impression that statement was global based on all entities but there is a different statement for each entity.

ildar170975 commented 2 years ago

that statement was global based on all entities but there is a different statement for each entity.

Stop-stop-stop, currently the state_map option is GLOBAL. In future it will be per-entity. Please reopen the issue if you still have a problem.

What I suggest you for testing - show a state for each entity, see what is displayed.