I could not deal with 2 things in the last some days. A tried to read everything about them but sadly without success so maybe anyone here can light me the reasons of them.
I know that the official release not yet support attributes, but in theory dev version 3 of unreleased 0.11 can handle it:
water_quality:
- name: Szabad aktív klór
value: 0,20
unit: mg/l
limit: '1000'
state: ok
...
- name: pH
value: 7,7
unit: ' '
limit: '8.5'
state: ok
location: Budapest - XI. kerület
water_hardness: közepesen kemény
provider: Data provided by vizmuvek.hu
icon: mdi:water
friendly_name: Water Quality FVM
Now I’m on the hot fresh official stable 0.11.0 and figured out that for attributes I have to use state_map. With it - as the following config show - my problem solved. No think that this is the most intuitive and convenient but at least it works, so thanks for the developers.
The config:
type: custom:mini-graph-card
entities:
- entity: sensor.water_quality_fvm
name: Water hardness
attribute: water_hardness
font_size_header: 10
font_size: 66
hour24: true
height: 50
line_width: 1
hours_to_show: 168
show:
labels: false
state_map:
- value: nagyon lágy
label: Very soft
- value: lágy
label: Soft
- value: közepesen kemény
label: Moderately hard
- value: kemény
label: Hard
- value: nagyon kemény
label: Very hard
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