kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.96k stars 232 forks source link

color_thresholds don't work in multiple entities config (with a hack/fix) #926

Closed Mariusthvdb closed 1 year ago

Mariusthvdb commented 1 year ago

While a mini-graph with a single entity and


        - entity: sensor.schimmel_sensor
          name: Schimmel
          color_thresholds:
            - value: 40
              color: skyblue
            - value: 50
              color: green
            - value: 60
              color: lightsalmon
            - value: 65
              color: orange
            - value: 70
              color: maroon

works as expected,

Scherm­afbeelding 2023-02-19 om 17 45 35

using the exact same mapping in a multiple entities graph shows only a fixed (and un configured ) color:

      entities:
        - entity: sensor.luchtvochtigheid_living
          name: Vocht
          color: skyblue
        - entity: sensor.schimmel_sensor
          name: Schimmel
          color_thresholds:
            - value: 40
              color: skyblue
            - value: 50
              color: green
            - value: 60
              color: lightsalmon
            - value: 65
              color: orange
            - value: 70
              color: maroon
#           y_axis: secondary
        - entity: sensor.temperatuur_living
          name: Temperatuur
          color: gold
          y_axis: secondary
Scherm­afbeelding 2023-02-19 om 17 44 34

not really sure this is a documented feature, and hence a bug. sorry if it isnt.

I did find a way to 'fix' this btw, by setting the color_thresholds on the main config, and overriding this in the entity object:

      type: custom:mini-graph-card
      height: 100
      line_width: 3
      font_size: 75
      color_thresholds:
        - value: 40
          color: skyblue
        - value: 50
          color: green
        - value: 60
          color: lightsalmon
        - value: 65
          color: orange
        - value: 70
          color: maroon

      show:
        fill: fade
        extrema: true
        icon: false
#         name: false
      entities:
        - entity: sensor.luchtvochtigheid_living
          name: Vocht
          color: skyblue
        - entity: sensor.schimmel_sensor
          name: Schimmel
#           y_axis: secondary
        - entity: sensor.temperatuur_living
          name: Temperatuur
          color: gold
          y_axis: secondary
Scherm­afbeelding 2023-02-19 om 17 49 45
akloeckner commented 1 year ago

I just checked the docs and that seems to be expected behaviour. The colour thresholds can only be set for the entire card and not for single entities. It's also quite involved to make options work for single entities, so, I think this will not be added as a feature any time soon.

ildar170975 commented 1 year ago

Duplicate https://github.com/kalkih/mini-graph-card/issues/153