How do I force a history graph to be an actual graph, please? I’ve added a history-graph via Lovelace. It shows as a coloured bar chart. I have added unit_of_measurement, as suggested numerous times, but I’ve clearly misunderstood something.
You’re right. I added this as a last resort after the below didn’t work. In my defence, the absence of “you can” in the documentation never means “you can’t”!
Now that we have the red herring out of the way, these are manually added MQTT sensors and all have unit_of_measurement set as “°C” in the configuration.yaml. Futher, yes, over-riding them in the configuration DID fix the graphs.
Would appreciate any assistance with what’s wrong with my configuration.yaml, though…
what do you mean “whats wrong”? The configuration looks correct, what’s happening with the sensors? Or are you referring to the fact that you had to override them?
My interpretation of Tom’s note “If the sensor was auto-discovered use customize to set the unit_of_measurement” is that this is a feature for over-riding auto detected settings.
These were not auto-detected; they were manually added in configuration.yaml. This gives me two quandries:
Why did modifying the configuration of the sensor cause the graph to appear correctly?
Why was the unit_of_measurement not picked up from the configuration.yaml in the first place?
it most likely is picked up initially, but there could be a number of factors that made it a bar graph / line graph:
If the device is already in history as bar graph, it will show up as bar graph. You have to delete your history at this point or purge it and compress.
If the state cannot be converted to a number, it will show up as a bar graph. (Like if the sensor returns units with the value in the mqtt topic instead of just the value). I.E. you can’t confvert ‘67 ºC’ to a number because ºC is not a number.
After you made the change, you didn’t clear the cache in your browser which kept it a bar graph.
Basically what I’m saying is: If they are configured as ºC in the sensor section, then they should show up as a line graph.
It’s irksome, because they were always configured as “degC” in the configuration. I was clutching at straws when I added unit_of_measurement to the card.
How do I delete history / purge / compress?
I do understand string splitting (software engineer!). In fact, I’m about to tackle the problem of why my WiFi signal strength (as extracted from the Tasmota JSON string returned by /STATE) is being returned to Home Assistant as a string rather than an int. I can’t find a Lovelace card which displays a string.
purge is a service. Delete is just remove the .db file from configuration when HA is off. Compress might not be possible at the moment.
Also, one thing I did notice is that ‘unknown’ was coming through as a state. That could be the root cause of your issues. You may need to add a value_template to your MQTT topic to convert all numbers to a float. In the event that ‘words’ come through, it will be converted to the default float. The default float is zero.
This will split the letter N from the number 5 using space as the separator, then the [-1] chooses the last item in the list. The list at that point should be ['N', '5'], so using [-1] will get the last item in the list. - dictates going backwards through the list. When combined with 1, it’s saying get the first item going backwards.
Error loading C:\Users\Mediaserver-pc\AppData\Roaming.homeassistant\configuration.yaml: while parsing a block mapping in “C:\Users\Mediaserver-pc\AppData\Roaming.homeassistant\sensor/weather.yaml”, line 5, column 4 expected <block end>, but found ‘<scalar>’ in “C:\Users\Mediaserver-pc\AppData\Roaming.homeassistant\sensor/weather.yaml”, line 8, column 92
I am looking for exactly the opposite solution I have a line graph which shows nothing because it has words instead of number so a bar graph would be better suited for the more-info card
this is what I could find in the core.entity_registry as it is a autoloaded I tried to put null instead of the double quotes and it broke so would I just delete the unit_of Measurement line all together?
well I think I will jack with this tomorrow after work I will try deleting the unit of measurement from the core.entity_registry file since that seems to be the only place it is even showed the customize option does not offer anything to deal with unit of measurement