Modbus value into energy feature

So I’ve got a sensor sending energy information through modbus to my ha instance (2021.9.5) and then I use a sensor template to fix it into correct decimal form… But how would I go about exposing sensor.test as a energy device available for use with the new Energy feature? The below is what I have at the moment. The sensor displays the value but is not detected by the energy feature…

modbus:
  - name: MyDevice
    type: tcp
    host: 192.168.x.x
    port: 502
    sensors:
      - name: m_0
        address: 0

sensor:
  - platform: template
    sensors:
      test_sensor:
        unique_id: sensor.test
        value_template: "{{states('sensor.m_0') | float / 10}} "
        device_class: energy

It must be an energy sensor.
It must have a unit of kWh or Wh.
It must have an attribute state_class: total_increasing. You can use Customize to add this.

Could you please give an example?

sensor:
  - platform: template
    sensors:
      test_sensor:
        unique_id: sensor.test
        value_template: "{{states('sensor.m_0') | float / 10}} "
        device_class: energy
        state_class: total_increasing
        unit_of_measurment: kWh

Unfortunately this results in an error:

Invalid config for [sensor.template]: [state_class] is an invalid option for [sensor.template]. Check: sensor.template->sensors->test_sensor->state_class. (See ?, line ?).

Seems the state_class is incorrect…

You will have to add it using the ‘Customisation’ button in the Configuration menu