How to configure Octopus Energy gas consumption data in Energy Dashboard

Hi, I’m a HA newbie so hoping for some help. I have the Octopus Energy integration configured which gives me a gas current consumption sensor which I’m trying to use for gas in the Energy Dashboard.

The data from Octopus is in kWh and the gas entry for the Energy Dashboard needs a sensor with units of m3. Therefore I’ve created a new sensor called gas_vol using the following template sensor and the equation to convert back from kWh to m3 (from my Octopus bill):

  - sensor:
      - name: "gas_vol"
        unit_of_measurement: "m³"
        state: >
          {% set gas = states('sensor.octopus_energy_gas_e6e01791072110_1822314807_current_consumption') | float %}

          {{ ((gas * 3.6) / (38 * 1.02264)) | round(3, default=0) }}

I’ve then created a new parameter with device_class = gas using the following code:

  - sensor:
      - name: "gasconsumptiontotal"
        unique_id: gastotal
        unit_of_measurement: "m³"
        device_class: gas
        state_class: total_increasing
        state: "{{ states('sensor.gas_vol') }}"

Both individual entities show the correct data in the history graph, and I can add gasconsumptiontotal to the gas section fo the Energy Dashboard without any errors, but no data is shown in the gas chart on the dashboard.

Does anyone know how I can fix this?

Many thanks,