Energy cost estimate using utility meter - numbers don't add up

Hi all,

I’m trying to create a utility meter for daily & monthly energy usage and costs, for that I added configuration for the following entities:

input_number:
  kwh_cost_gross:
    name: kWh Cost Gross
    initial: 0.64
    min: 0.5
    max: 1
    step: 0.01
    unit_of_measurement: "ILS/kWh"

template:
  - sensor:
      - name: "Clinic energy consumption"
        unit_of_measurement: "kWh"
        state: >
          {{ states('sensor.shellypmminig3_dcda0cb4cd38_energy') | float(0) +
             states('sensor.shellypmminig3_dcda0cb5af10_energy') | float(0) +
             states('sensor.shellyplus2pm_c4d8d557f404_switch_0_energy') | float(0) +
             states('sensor.shellyplus2pm_c4d8d557f404_switch_1_energy') | float(0)
          }}

      - name: "Clinic Monthly Energy Cost"
        unit_of_measurement: "ILS"
        state: >
          {{ (states('sensor.clinic_monthly_energy') | float(0) * states('input_number.kwh_cost_gross') | float) | round(2) }}

utility_meter:
  clinic_daily_energy:
    source: sensor.clinic_energy_consumption
    cycle: daily
  clinic_monthly_energy:
    source: sensor.clinic_energy_consumption
    cycle: monthly

The thing with this configuration is that the monthly energy sensor keeps going up and reaches numbers that don’t make sense. Would appreciate any lead on this.

Found one of the issues to be the device class for the template sensor and updated as below:

template:
  - sensor:
      - name: "Clinic energy consumption"
        device_class: energy
        state_class: total_increasing
        unit_of_measurement: "kWh"
        state: >
          {{ states('sensor.shellypmminig3_dcda0cb4cd38_energy') | float(0) +
             states('sensor.shellypmminig3_dcda0cb5af10_energy') | float(0) +
             states('sensor.shellyplus2pm_c4d8d557f404_switch_0_energy') | float(0) +
             states('sensor.shellyplus2pm_c4d8d557f404_switch_1_energy') | float(0)
          }}

      - name: "Clinic Monthly Energy Cost"
        unit_of_measurement: "ILS"
        state: >
          {{ (states('sensor.clinic_monthly_energy') | float(0) * states('input_number.kwh_cost_gross') | float) | round(2) }}

This in fact didn’t help, would appreciate the community’s help on this