History graph shows as bar graph instead of line graph

I have two Tasmotized Sonoff TH10 switches with DS18B20 temperature probes that I am using to monitor the temperature of two aquariums in my house.

I am trying to configure history graphs for both of them. One I configured a few months ago, and the other I configured this morning.

This is what I put in my configuration.yaml:

history_graph:
  gr1:
    name: Basement Aquarium Temperature
    entities:
      - sensor.basement_aquarium_temperature
    hours_to_show: 24
    refresh: 60
  gr2:
    name: Family Room Aquarium Temperature
    entities:
      - sensor.family_room_aquarium_temperature
    hours_to_show: 24
    refresh: 60

I configured the sensors as follows:

  - platform: mqtt
    name: "Basement Aquarium Temperature"
    state_topic: "tele/sonoff_temp_1/SENSOR"
    value_template: '{{ value_json["DS18B20"]["Temperature"] }}'
    unit_of_measurement: "°F"
  - platform: mqtt
    name: "Family Room Aquarium Temperature"
    state_topic: "tele/frah1/SENSOR"
    value_template: '{{ value_json["DS18B20"]["Temperature"] }}'
    unit of measurement: "°F"

This is what my graphs look like:

temperature_graph

How do I get them both to be line graphs?

1 Like

Put underscores between unit of measurement for “Family Room Aquarium Temperature” like you did it for the other one :slight_smile:

2 Likes

That worked! Thank you!

Hi! What do you do when you are talking % state of charge of a battery so no units? I have two from electric cars, both the same one displays as a graph and one as a bar chart!

This one is a Bar:

  - type: history-graph
    title: Charging History
    hours_to_show: 48
    refresh_interval: 600
    entities:
      - entity: sensor.i3__rex_charging_level_hv
        name: Battery %
        icon: mdi:battery-50

This one is a Graph:
- type: history-graph
title: Charging History
hours_to_show: 48
refresh_interval: 600
entities:
- entity: sensor.tesla_model_s_xxxxxxxxxxxx_battery_sensor
name: Battery %
icon: mdi:battery-50

the unit_of_measurement is % then :slight_smile:

Florian, It did not like that! Not for the i3 or the Tesla.

"while scanning for the next token found character ‘%’ that cannot start any token in “/config/ui-lovelace.yaml”, line 527, column 34:

  - type: history-graph
    title: Charging History
    hours_to_show: 48
    refresh_interval: 600
    entities:
      - entity: sensor.tesla_model_s_xxxxxxxxx_battery_sensor
        unit_of_measurement: %
        name: Battery %
        icon: mdi:battery-50

we’ve talked about mqtt sensors above. i did not notice you did not :smile:

you have to add an entry to your customize.yaml as follows:

sensor.tesla_model_s_xxxxxxxxx_battery_sensor:
  unit_of_measurement: '%'
1 Like

After a couple of false starts… Yay! 1st is the i3…

Thanks so much Florian :slight_smile:

and The Tesla too!

1 Like

Hi Florian, so all was well until I upgraded to .84.2 and nw back to the line graph for the i3, the Tesla is fine though with identical config:

  - type: history-graph
    title: Charging History
    hours_to_show: 48
    refresh_interval: 600
    entities:
      - entity: sensor.i3__rex_charging_level_hv
        unit_of_measurement: '%'
        name: Battery %
        icon: 'mdi:battery-50'

did you try to add the unit_of_measurement to your customize.yaml like below?

sensor.i3__rex_charging_level_hv:
  unit_of_measurement: '%'

That’s done it! I forgot to copy across that config file to the new server, when I was running .81 the old page would not load the .84 has a parser to check errors and I have three minor errors. Thanks once again Florian! :slight_smile:

Interestingly 0.86.4 breaks this fix…

I have two zooz-4 sensor things. One of the things they capture is relative humidity. I have one in my garage that basically captures the outdoors relative humidity and one in our master bath. When the master bath RH is greater than the outdoors RH I turn on the exhaust fan in the bathroom. I show both of them on a history graph so I can see when the exhaust fan “should” have turned on and off. Yesterday both were showing as line charts on the same graph. This morning, one shows as a line chart and the other shows as a bar chart. Both sensors are from the same vendor, both report RH as a %. I was not working in the HA configs last night. I was working on a scene_controller in Appdaemon. I remember looking at the graphs shortly before I went to bed and everything was fine. This morning, I get the strange appearance. I have refreshed the page, but no difference.
Any thoughts?