Entity created by math operation doesn't graph normally

Hello!

I have sensors on most of my consumer unit (circuit breaker box) circuits that I monitor in Home Assistant, but I needed to do a subtraction to categorise some power use to ‘other’ basically.

Here’s what I have in Templates.yaml for it:

# subtract mirror heater from emontx4_p4 (GF Sockets)
  - sensor:
    - name: gfsockets_minus
      state: >
        {{ states('sensor.emontx4_p4') | float(0) - states('sensor.shlyclkrm_heater_power') | float(0) | round(0) }}

If I use that entity as a Gauge (for example) it works fine. But if I click on the gauge I would normally expect to see a graph, but instead I see a multi-colored bar that is not useful at all.

Is my state line not correct or is there an inherent issue with this method, being treated differently from a normal entity?

Thanks.

You need to give it a unit of measurement to get a graph plotted.

Hi Troon! I did not receive a notification from the forum of your reply, but I checked in just now and saw it. THANK YOU! Of couse that fixed the problem!