Depends on what values does you attribute have.
If you have numericals - state_map not need.
Otherwise - surely yes.
Seems you are treating state_map in a wrong way.
It associates a real value with a displayed string.
But - how do you imagine a graph with non-numericals?
The only way to show a graph is to associate non-numericals with numericals:
ugly=0
unpleasant=1
good=2
very good=3
…
This may be done by some template sensor.
Most of the cases for state_map are like:
state_map:
- value: 'off' #### which is "0" - so this is a numerical
label: Bad ##(or Day, or Switched OFF)
- value: 'on' #### which is "1"
label: Good ##(or Night, or Switched ON)
Both theoretically and practically you can define graphs without numerical value. State_map from one side could be used for such situations, when the original textual value is not your preferred one. Of course the numerical usage is the most common and basic, but it works without any problem with strings.
All different states are really different ‘states’, call them ‘levels’ in the graph. The order of them is what you define in the config from top to bottom as less to more.
It is absolutely true and maybe this could be the differences between the situations. But #1 anyway the card itself seems parse its values as string and this is why we can get usable results from them. But #2 seems you light the reason of the problem as it is really true, if the sensor has textual values I really have to use state_map to extract its data. In this case this is really not different in state or attribute examination. Both works in the same way, there is no need to consolidate them.
Thanks for the direction!
But as the summarizaton we can simply use the card for textual values if we already know the sensor’s value-set (which type is in this case indifferent… we can use strings, number, anything). The result is perfect with textual values also, just as the ‘topic’ says we have to use state_maps to define the discrete levels.
Honestly, that was a really new thing for me.
I tested with state_map some time ago - then stopped using it since I needed state_map only for a secondary graph and it flooded the browser with errors like “value not found in state_map”.
Yes, the only problem is the constant color (what you mentioned, and I wrote it also before). From any other aspect the solution works fine. I already reported the color problem at Github. Of course not as a hard bug report just a question as a possibility…
Thanks. I’ve been looking for this, but unfortunately I seem to be unable to reproduce your results. All I did was change my entities but things still don’t seem to line up properly.
Hi everyone!
Can someone help me? I need to know if theres a way to change de offset position (top, bot) on css of the card. Mine looks bugged because other templates that i use. As you can see, the min and max values they get cut and dont show:
I thought about it at first. however, even putting the css there, and it appearing in the page code, has no effect on the styles.
I dont know, but the style should be first on the code, right? the card_mod is putting after the code of the card itself:
Anyone advise how I could move the humidity text just underneath the temperature? I have seven MGC in a row and there is not enough space to have the temp and humidity side by side because of the screen ratio of my main tablet.
is there a way to filter out entities? i have some probes that are used now and then and want to filter them out when they are unavailable or unplugged so i dont have to update the config
Is there a way to add binary switches with analogue values? I want to show when the switch to my air purifier turns on, and then have the air gas reading on the same graph. Is it possible?