Using Victron CerboGX (Modbus) with Home Assistant Energy

I’m using a Victron CerboGX for energy management, and sending data into Home Assistant via modbus, which is stable and works great. However, I can’t seem find a way to get sensor values into the new HA energy management dashboard.

Found two other topics about this

Here’s the config I’m using - I’ve tried every variant of device_class and state_class - could anyone point me to where I might be going wrong?

  - name: cerbo
    type: tcp
    port: 502
      - name: "Solar Power"
        data_type: uint
        unit_of_measurement: "W"
        slave: 100
        address: 789
        scale: 0.1
        device_class: energy
        state_class: total_increasing

Running HA 2021.10.6 via Docker on an Intel NUC

The answer was to create an additional integration sensor which reads data from the modbus sensor and converts it into an energy unit which is compatible with the home assistant energy dashboard

  - platform: integration
    source: sensor.solar_power
    name: solar_energy
    unit_prefix: k
    unit_time: h
    method: left
    round: 2