kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
3.06k stars 237 forks source link

adaptive_color feature not working correctly with binary values #1159

Open enselerizer opened 1 month ago

enselerizer commented 1 month ago

Sorry in advance if this issue is a duplicate. I am using mini-graph-card to display state history of binary sensors. It works great, and even color_thresholds feature colors the graph correctly, as shown in an example below. However, name_adaptive_color and icon_adaptive_color features don't seem to work with binary values, always displaying a color that is mapped to zero value.

Here is an example:

type: custom:mini-graph-card
icon: mdi:door-closed
name: Office door state
hours_to_show: 24
points_per_hour: 10
update_interval: 1
animate: true
hour24: true
lower_bound: 0
upper_bound: 1
aggregate_func: max
line_width: 4
color_thresholds:
  - value: 0
    color: "#76FF03"
  - value: 0.6
    color: "#FF1744"
entities:
  - binary_sensor.access_control_module_v1e_office_door
state_map:
  - value: "off"
    label: " "
  - value: "on"
    label: " "
  - value: unavailable
    label: " "
show:
  fill: fade
  points: false
  labels: false
  name_adaptive_color: true
  icon_adaptive_color: true

Resulting card appearance: image