kalkih / mini-graph-card

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

adaptive color not working as expected #688

Open pachi81 opened 2 years ago

pachi81 commented 2 years ago

In version v0.10.0 the adaptive colors does not work as expected.

  1. Color names like "blue" does not work, only if it is the last color in the color_thresholds. (picture 1 and 2)
  2. color_thresholds_transition: smooth is not working for the second entity. (picture 2)
  3. color_thresholds at the step to next color are shown incorrect for the second entity (picture 3)

Example configuration:

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_number.test_nummer
  - type: custom:mini-graph-card
    name: Apaptive Color
    entities:
      - entity: input_number.test_nummer
        state_adaptive_color: true
      - entity: input_number.test_nummer
        state_adaptive_color: true
        show_state: true
    color_thresholds_transition: hard
    show:
      name_adaptive_color: true
      icon_adaptive_color: true
      graph: false
    color_thresholds:
      - value: 0
        color: green
      - value: 20
        color: yellow
      - value: 60
        color: orange
      - value: 80
        color: blue
      - value: 90
        color: purple
  - type: custom:mini-graph-card
    name: Apaptive Color
    entities:
      - entity: input_number.test_nummer
        state_adaptive_color: true
      - entity: input_number.test_nummer
        state_adaptive_color: true
        show_state: true
    color_thresholds_transition: smooth
    show:
      name_adaptive_color: true
      icon_adaptive_color: true
      graph: false
    color_thresholds:
      - value: 0
        color: '#02FF15'
      - value: 20
        color: '#ECFF02'
      - value: 60
        color: '#FFC902'
      - value: 80
        color: '#0215FF'
      - value: 90
        color: '#F002FF'

Different Results: If the value is higher then the last value, all work like expected: image If the value is lower then the last value, color names are not working and smooth is not working for the second entity: image For value 90, which is the border to use purple color, the second entity still shows the color from color threshold 80: image

jlsjonas commented 2 years ago

Likely related to config handling for the first entity vs others; to be checked/confirmed before next release

pachi81 commented 2 years ago

Anything I can do for confirmation?

ghost commented 2 years ago

I think I am getting the same issue, state_adaptive_color: true does not have smooth transitions, while name_adaptive_color: true works correctly: grafik

I only have one entity in my configuration though.

color_thresholds: - color: '#0000FF' value: 5 - color: '#FFFFFF' value: 15 - color: '#FFFFFF' value: 30 - color: '#FF0000' value: 35