Add energy measurement - device class and last reset issue

I have created a number of template sensors to measure energy consumption. When combined, they give me a sensor called “total measurable energy”. One part of this is all of my air con units, which give another sensor called “total air con energy”
When I try to add one of these to the energy dashboard, I have two problems.
Firstly, the total measurable energy" entity does not come up on the list of options. The total air con energy one does.
Secondly, the air con energy then gives two problems: “The following entity does not have the expected device class” and "The following entity has a state class “measurement” but “last reset” is missing.
All of the constituent parts appear to be recording data correctly - or at least I can see value in the developer tools for each one.

I have shown the config for the entities below - can anyone advise on the fixes please ?

Or am I fundamentally doing this wrong ? I have other air con sensors that have been created which give the air con energy every 15 minutes, daily, weekly and monthly. These have a device class of energy, state class of total_increasing, and a last reset, currently showing
2024-01-26T08:00:00.002807+00:00
The total air con energy sensor has none of these, only a unit of measure and a friendly name (as does the total measurable energy sensor).

Unfortunately I do not have access to the total power coming from the grid, so this is the closest I can get to my energy consumption at the moment

template:
  - sensor: 
      name: "Total Air Con Energy Consumption"
      unit_of_measurement: "kWh"
      state: >
        {% set kitchen = states('sensor.kitchen_air_conditioner_energy') | float %}
        {% set dirtykitchen = states('sensor.dirty_kitchen_air_conditioner_energy') | float %}
        {% set masterbedroom = states('sensor.master_bedroom_air_conditioner_energy') | float %}
        {% set aldriansroom = states('sensor.aldrians_room_air_conditioner_energy') | float %}
        {% set alexsroom = states('sensor.alexs_room_air_conditioner_energy') | float %}
        {% set jacksroom = states('sensor.jacks_room_air_conditioner_energy') | float %}
        {% set sabrinasroom = states('sensor.sabrinas_room_air_conditioner_energy') | float %}
        {% set helpersroom = states('sensor.helpers_room_air_conditioner_energy') | float %}
        {% set diningroom = states('sensor.dining_room_air_conditioner_energy') | float %}
        {% set gym = states('sensor.gym_and_spa_air_conditioner_energy') | float %}
        {% set cinema = states('sensor.home_theatre_air_conditioner_energy') | float %}
        {% set mastercloset = states('sensor.master_closet_air_conditioner_energy') | float %}

        {{ (kitchen + dirtykitchen + masterbedroom + aldriansroom + alexsroom + jacksroom + sabrinasroom + helpersroom + diningroom + gym + cinema + mastercloset) | round(1, default=0) }}

      availability: >
        {{ has_value('sensor.kitchen_air_conditioner_energy') and
           has_value('sensor.dirty_kitchen_air_conditioner_energy') and
           has_value('sensor.master_bedroom_air_conditioner_energy') and
           has_value('sensor.aldrians_room_air_conditioner_energy') and
           has_value('sensor.alexs_room_air_conditioner_energy') and
           has_value('sensor.jacks_room_air_conditioner_energy') and
           has_value('sensor.sabrinas_room_air_conditioner_energy') and
           has_value('sensor.helpers_room_air_conditioner_energy') and
           has_value('sensor.dining_room_air_conditioner_energy') and
           has_value('sensor.gym_and_spa_air_conditioner_energy') and
           has_value('sensor.home_theatre_air_conditioner_energy') and
           has_value('sensor.master_closet_air_conditioner_energy') }}    

  - sensor:
      name: "Total Measurable Energy"
      unit_of_measurement: "kWh"
      state: >
        {% set aircon = states('sensor.total_air_con_energy_consumption') | float %}
        {% set kitchenfridge = states('sensor.kitchen_fridge_energy') | float %}
        {% set dirtykitchenfridge = states('sensor.dirty_kitchen_fridge_energy') | float %}
        {% set tumbledryer = states('sensor.tumble_dryer_energy') | float %}        
        {% set breadmaker = states('sensor.kitchen_breadmaker_energy') | float %}
        {% set washingmachine = states('sensor.washing_machine_energy') | float %}

        {{ (aircon + kitchenfridge + dirtykitchenfridge + tumbledryer + washingmachine + breadmaker) | round(1, default=0) }}
     
      availability: >
        {{ has_value('sensor.total_air_con_energy_consumption') and
           has_value('sensor.kitchen_fridge_energy') and
           has_value('sensor.dirty_kitchen_fridge_energy') and
           has_value('sensor.kitchen_breadmaker_energy') and
           has_value('sensor.washing_machine_energy') and
           has_value('sensor.tumble_dryer_energy') }}

Because you have empty lines in your state templates - you should use:

state: >-

instead of

state: >

That will remove the empty lines when it is rendered.

Next - it feels like you need

state_class: measurement

It’s unclear whether the devices you are summing, are outputting instant power use, or lifetime energy use?

If they are lifetime energy, then you probably want

state_class: total

You will also want a

device_class: energy

Andrew
Thank you so much. That appears to have done the trick. I will need to see the data over a couple of days to see if I am measuring the right things - as far as I can tell, the sensors are all measuring lifetime energy, but time will tell now.
I have managed to add the Solarman integration today, so if I am comparing apples with apples, this gives me at least some idea of why our energy bills are so crazy, despite using the aircon units pretty sparingly (and the washing machine seems to be the answer !)