Combining modbus energy data for energy dashboard usage

dear,

I’m moving from a KNX energy meter towards a modbus TCP energy meter (countis e27)

I can succesful retrieve the values but I don’t succeed to reconfigure my energy dashboard.

to be able to get the correct kWh value I need to combine two modbus values (see picture below)

I combine the data with a template sensor to get the proper value

- platform: template
  sensors:
    countis_total_energy_kwh:
      friendly_name: "Countis Total Energy kWh"
      unit_of_measurement: 'kWh'
      value_template: "{{ (states('sensor.countis_net_active_energy_balance') | float) + (states('sensor.countis_net_residual_active_energy_balance') | float / 10000) }}"
      device_class: 'energy'

this looks like this

But I’m unable to select this newly created sensor inside the Energy dashboard configuration.

Help is welcome
Stijn

I was using the old templating option. It works with the new templating integration

template:
  - sensor:
      - name: "Countis Total Energy kWh"
        unit_of_measurement: "kWh"
        state: >
          {{ (states('sensor.countis_net_active_energy_balance') | float) + (states('sensor.countis_net_residual_active_energy_balance') | float / 10000) }}
        device_class: energy
        state_class: measurement
        last_reset: '1970-01-01T00:00:00+00:00'

this thread solved my problem

- sensor:
  - name: "Countis Total Energy Wh"
    unit_of_measurement: "Wh"
    state: >
      {{ (states('sensor.countis_net_active_energy_balance') | int / 0.001) + (states('sensor.countis_net_residual_active_energy_balance') |int / 10) | round(0) }}
    device_class: energy
    state_class: total_increasing

I ended up with the code above to get the measurements right in the dashboard

i converted this into a template into my config.yaml

template:
  - sensor:
      - name: "modbusenergiedb"
        unit_of_measurement: "kWh"
        state: >
         {{ (states('sensor.mb2_Phase_2_active_power') | int / 0.001) + (states('sensor.mb2_Phase_2_active_power') |int / 10) | round(0) }}
        device_class: energy
        state_class: measurement