Template sensor without unit shows up as bar rather than graph in history

Here is my predicament:

I have a template sensor that is a unitless measure as it stores pH of a pool. I did set it up to be device_class: "pH" however since the template sensor will report “Unknown” as the value at the startup process it will always be rendered as a bar chart rather than a graph. This is not acceptable for me as I’d like to see a graph.

How can I force it to be a graph yet still remain unitless? The problem is if I defined a unit of “pH” I get a warning that I’m assigning a unit to a measurement that is meant to be unitless.

2 Likes

Solution is to explicitly write unit_of_measurement: "" in the template sensor.

        - name: "ioPool pH"
          state: "{{state_attr('sensor.iopool', 'latestMeasure')['ph']}}"
          device_class: ph
          unit_of_measurement: ""
1 Like

Now that template sensors can be configured from the GUI, this problems resurfaces. I guess we could put a space, but that looks sub-optimal… Any suggestions?