No longer has a state class

Hi,

After installing the new version, I got these repairs :

image

I have these in my templates :

`- sensor:
    - name: Energy Solar Panel 1
      state: "{{ ((states('sensor.solar_panel_energy_counter_1') | float(0)) + (states('input_number.number_solar_panel_1') | float(0))) | round(1) }}"
      unit_of_measurement: "kWh"
    - name: Energy Solar Panel 2
      state: "{{ ((states('sensor.solar_panel_energy_counter_2') | float(0)) + (states('input_number.number_solar_panel_2') | float(0))) | round(1) }}"
      unit_of_measurement: "kWh"
    - name: Energy Solar Panel 3
      state: "{{ ((states('sensor.solar_panel_energy_counter_3') | float(0)) + (states('input_number.number_solar_panel_3') | float(0))) | round(1) }}"
      unit_of_measurement: "kWh"
    - name: Energy Solar Panels
      state: "{{ (states('sensor.energy_solar_panel_1') | float(0) + states('sensor.energy_solar_panel_2') | float(0) + states('sensor.energy_solar_panel_3') | float(0)) | round(1) }}"
      unit_of_measurement: "kWh"
`

image

Even after clicking “delete” the error still appears…what should I do, because that’s not clear for me…

Thank you !

State_class: measurement

Have you tried adding in the state class like above? It’ll be measurement or total_increasing .

There’s a typo in the example spiro gave, it state_class should start with a lowercase s and it should most likely be total_increasing in your examples.

If you click delete (which would be a shame, as you might lose history) the message stays because you still have no state class. It is saying it isn’t recording long term data now for you because of it. It likely hasn’t been since you created the templates.

What are the input helpers for in your templates?

1 Like

Reminds me of the time a priest a minister and a rabbit show up to give blood. The rabbit thought he was Type O.

It took me way to long to get it :slight_smile:

If a template sensor was previously declared with some state_class, then LTS is generated and stored in DB.
When this template becomes without a state_class, a corresponding statistics issue appeared in Dev tools - Statistics. This issue proposes to delete the previously generated LTS from DB.
Starting from 2924.10, the Repairs contain these statistical issues as well. But these repairs may keep shown even after “fixing the issue” - see my post above.

So, if LTS is needed for these entities - a proper state-class should be added.
If no LTS is needed - then see above…

But what if I don’t want LTS from these templates ?

In fact, I created this for this purpose :

- trigger:
    - platform: time_pattern
      minutes: "/5"
  sensor:
    - name: Energy Solar Panels To Recorder
      state: "{{ states('sensor.energy_solar_panels') }}"
      unit_of_measurement: "kWh"
      state_class: total_increasing
      device_class: energy