mini-graph-card
mini-graph-card copied to clipboard
bug(color_thresholds): no longer appearing after introducing a `state_map`
Hi!
First of all I would like to throw a very big 'thanks' for your work(s) as this card is almost the only card type in my HA config and I really love it. So really lot of thanks for your efforts so far!
But from another aspect I got a soft problem/bug at my use cases.
Environment:
- Home Assistant 2022.4.7 ('Core' through Docker)
- Latest 0.11.0 'Mini Graph Card' (through HACS)
If we use state_map
s we can not use color_thresholds
with them (and I do not really see the reason of that), as the result is always the usage of the defined color in the thresholds object. Check the following sample.
The config:
type: custom:mini-graph-card
entities:
- entity: sensor.u_s_air_pollution_level
name: Air quality
font_size_header: 10
font_size: 66
hour24: true
height: 50
line_width: 1
hours_to_show: 168
align_state: center
show:
labels: false
color_thresholds:
- value: hazardous
color: '#ff3d00'
- value: very unhealthy
color: '#ffff00'
- value: unhealthy
color: '#ffff00'
- value: unhealthy for sensitive groups
color: '#ffff00'
- value: moderate
color: '#ffff00'
- value: good
color: '#64dd17'
state_map:
- value: hazardous
label: Hazardous
- value: very unhealthy
label: Very unhealthy
- value: unhealthy
label: Unhealthy
- value: unhealthy for sensitive groups
label: Unhealthy for sensitive groups
- value: moderate
label: Moderate
- value: good
label: Good
And the result:
Could anybody please help on it? Thanks for it in advance!
Hey, could you try using the label
value instead of the incoming value? It shouldn't do that though :)
Hi, I can confirm the same, I also have the described problem.
Is there any progress on this? @jlsjonas what do you mean to use label
instead of incoming value
? do you mean in the colour_thresholds using label
instead of value
? If so, I tried it and it throws an error...
Hey, I meant to use the label as value (f.e. Hazardous instead of hazardous) as we're not using the raw values.
For backwards compatibility, we'll have to support both when(/if) fixing this
I tried to use the label value as well (however one must still indicate the label value as value: Hazardous
instead of label: Hazardous
- the color thresholds requires a value, if using label as an indicator, it throws an error.
Regardless of the test, it did not work anyway unfortunately...