Open loeffelpan opened 2 years ago
Looks like this is a side effect of the way state_map has been implemented in computeState()
: if the value is an integer smaller than the amount of items in state_map, it will find a corresponding item in the state_map and show that instead.
As a workaround, you could simply have - label: 0
as the first state_map
As a workaround, you could simply have
- label: 0
as the first state_map
Thanks for that. I will use that workaround in the meantime.
Another thing in this context I've noticed is a flood of warnings (in browser console) from your card when using state_map
.
In my case that are values from other sensors in the graph, which could be rendered without state_map
.
Not sure if this is possible: Maybe state_map
should be defined within an entity? That would possibly avoid that values from other entities are searched in the state-map.
EDIT: Just took a look at the milestone and saw that this is exacly what you're planning to do. Thanks!
I reached the same problem today when trying to show switch and cover states on the same chart:
state_map:
- value: off
label: 0
- value: on
label: 1
- value: closed
label: 0
- value: open
label: 1
No matter how I rearrange the values, half of them are out of the 0-1 range. I suspect this could be solved either by actually taking label:
's into account (this issue) or with #398.
I also see the same bunch of warnings for temperature sensors (which are on a different Y axis), but this is due to #271.
Not sure if this is a bug or a misconfiguration. If have this mini-graph with following config.
My issue is that the label on primary y-axis shows the (first) value of the
state_map
even when the sensor with mapped values isn't on the graph. In my casesensor.senec_system_state
has text values I want to display as main state without graph. Evenlower_bound
or setting that sensor on secondary y-axis doensn't make any difference to that lower label.