Lovelace History Graph Units

I’m currently having an issue getting one of my entities to show up correctly in a Lovelace history graph correctly. My sources are:
-OpenWeatherMap
-A Z-Wave motion sensor with a temperature sensor built in
-An esp8266 via esphome

The graph comes up just fine below the existing readings, and even shows the correct values (in fahrenheit), but displays °C in the top left corner of the graph, even though the units have been converted. I don’t have the option to configure the sensor in homeassistant, but I’ve made changes to the unit_of_measure to the esp8266 (with regards to the ° character) and I then lose the conversion to fahrenheit. It seems like things are configured correctly everywhere else, but lovelace doesn’t see it as the same unit?

I get this once in a while too. Maybe someone with more experience will chime in, but I think it has something to do with the way things are stored in the “recorder” (history) database. It’s as if the first record is stored with one unit, and even if subsequent values specify a different unit, it only looks at the first one. Lovelace makes two different graphs when it sees two different units.

First, try clearing the browser cache and re-load. It could be that simple, you never know.

Otherwise, you may have to wait until the old value rolls off the databse, or delete it from the database, or delete the whole database. Or if your purge_keep_days is long, you might want to do a manual purge for 1 or 2 days, to speed things up.

Looks like you were right there, as soon as the older data fell off it pulled everything together. For reference, I was using a temperature sensor and incorrectly configured the units initially, but the sign that I was on the right track was the fact that I could look at the sensor value and see that it was successfully converting from Celsius to Fahrenheit on the entity itself.

1 Like