History-graph shows different styles

I have a history-graph card which I used to show the temperature from two Visonic sensors. Works great, there’s a two-line graph showing temperature for the past 24 hours.

I was playing with the scrape sensor, and was able to scrape the outdoor temperature from a web site my weather station is hooked up to. So I added that, exactly the same way, using the same format:

entities:
  - sensor.visonic_mct_340_e_0b3e1c93_1_1026
  - sensor.visonic_mct_340_e_0b124300_1_1026
  - sensor.home_temp
title: Thermometers
type: history-graph

That sensor.home_temp is the new one I added. But in Lovelace, instead of a third line on the graph, I get a color-coded bar at the top.

Thermometer_Card

What am I doing wrong?

The bar is usually an indicator the entity is reporting data as a string and not an int/float. You probably need to convert the data type.

1 Like

I think you’re right, somehow it’s taking the returned value as a string, even though I thought this would convert it to float:

  - platform: scrape
    resource: [my PWS web page]
    select: ".current-temp"
    value_template: '{{ value.rstrip("°") | float }}'
    name: WU_temp
1 Like

Might need to purge or fully delete your database after you make a change like this. The DB will still treat the new values as a string if it thinks it should be a string.

I actually changed the name. It was “home_temp”, now "WU_temp, as shown above. I figured that would be a new entity, so it wouldn’t carry over any old formatting from when it was a string.

Admittedly, I know nothing about the database. How would I purge this value?

you can’t purge a single value, its all or nothing. Easiest way is to just delete the home-assistant.db file inside your config folder.

EDIT: Also add a unit of measurement as %.

I deleted the HA database, then added
unit_of_measurement: "°F"
to the scrape platform definition.

Now I’m getting line graphs, instead of that bar. This is good, but there were still two different graphs in the card.

I noticed the other two thermometers were set to “degrees” instead of “°F.” I made them al lthe same.

Success! All three entities had to use the same unit of measurement. Since I deleted the database, I’ve only got a few minutes’ worth of data so far, but this is how I wanted it to look:
Thermometer_Card

Configuration.yaml:

Screenshot_20230923_102447_Chrome|610x500

homeassistant:
  customize:
    sensor.outside_analog_range:
      unit_of_measurement: °C

I have the same issue with a Tasmota driven energy meter. The MQTT data is not showing a string but ints:

14:54:32.476 MQT: tele/Stromzaehler/STATE = {"Time":"2023-09-27T14:54:32","Uptime":"13T00:34:51","UptimeSec":1125291,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":10,"POWER":"ON","Wifi":{"AP":1,"SSId":"WLS1924","BSSId":"9C:C7:A6:DE:4A:9A","Channel":6,"Mode":"11n","RSSI":88,"Signal":-56,"LinkCount":8,"Downtime":"0T00:01:13"}}
14:54:32.485 MQT: tele/Stromzaehler/SENSOR = {"Time":"2023-09-27T14:54:32","MT175":{"E_in":8922.5,"E_out":16104.2,"P":-90,"L1":1413,"L2":-701,"L3":-800,"Server_ID":"090149534b000485d342"}}

Not sure what to change…