Arduino MQTT Energy Configuration Not Displaying

Hi,

I’m using an Arduino to get the energy use from my Owl energy monitor. This in itself works fine and I have configured MQTT to pass this to HA.

MQTT code:

energy_electricity.setUnitOfMeasurement("kWh");
energy_electricity.setDeviceClass("energy");
energy_electricity.setStateClass("measurement");
energy_electricity.setIcon("mdi:home");
energy_electricity.setName("home_electricity");

That gets the kWh to HA. I can then view this as an entity, which reads as 0.500Wh or 500 watts, which is correct according to the Owl monitor.

The issue that I have is that HA Energy doesn’t graph anything for it. It lets me select it as a energy source.

The code from the entity diags:

{
          "device_class": "energy",
          "disabled_by": null,
          "disabled": false,
          "entity_category": null,
          "entity_id": "sensor.home_electricity",
          "icon": "mdi:home-lightning-bolt",
          "original_device_class": "energy",
          "original_icon": "mdi:home",
          "state": {
            "entity_id": "sensor.home_electricity",
            "state": "0.424",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "kWh",
              "device_class": "energy",
              "icon": "mdi:home-lightning-bolt",
              "friendly_name": "home_electricity",
              "last_reset": "1970-01-01T00:00:00+00:00"
            },
            "last_changed": "2022-04-12T11:08:33.206940+00:00",
            "last_updated": "2022-04-12T11:08:33.206940+00:00"
          },

Can someone tell me what I’m doing wrong? Thanks!