State classes is not correct since 2024.6.2

Is needs some help understanding what to do where as I remember this was a pita before and may break up my current (correct) readings and/or sensors.

I have a group:

With 2 sensors:

And now since 2024.6.2 this error:
image

I tried to set the state_class for the one with “total” now like this in esphome:

 energy_production_day:
      name: "${esp_name} - Today Gen"
      state_class: total_increasing
      # state_class new since 11-6-2024
      id: todaygen
      filters:
        lambda: |-
          auto sunrise = id(sun_sun).sunrise(-0.833);
          auto time = id(homeassistant_time).now(); 
          if(sunrise.has_value() && time.is_valid()){
            if((sunrise.value().hour * 60 + sunrise.value().minute + ${shift_sunrise}) < (time.hour*60+time.minute) && (time.hour*60+time.minute) < 1439) {  
              if(String(id(todaygen).state) == "nan") return 0;
              else return x;
            }
            else return 0;
          }  
          else return 0;

But is keeps being state_class: total, also after reloading esphome…

What is best to change where so everything is in order?

I think the group is suddenly the issue after update to 2024.6.2…

I think my question is now how and where to set the state class on a group? - Without going back to yaml.

After making that change and restarting, try going to to Developer Tools → statistics and fix any issues listed there.

Otherwise you may have to delete the ESPHome device and re-add it.

Done this and also restarting HA, but it wont show me the correct state…

Its so weird:

    energy_production_day:
      name: "${esp_name} - Today Gen"
      state_class: total_increasing

    total_energy_production:
      name: "${esp_name} - Total Gen"
      #state_class: "measurement"
      #device_class: energy
      accuracy_decimals: 1