Device_class cant be set in YAML - resets to default after applying changes and reloading the page

Hi there,
I just tried to integrate my Qcells solar system into my energy dashboard. When I tried to add all the sensor values I was not able to see all the sensor values in the selector for the dashboard. The issue seems to be that some sensors dont have the device class set to “energy”

e.g:
I cant see this one:

state_class: measurement
unit_of_measurement: W
device_class: power
friendly_name: Solax  PV1 Power

But I can see this one

state_class: total_increasing
unit_of_measurement: kWh
device_class: energy
friendly_name: Solax  Yield total

So I thought the solution would be to just change the device class from power to energy but the issue is that when I access the YAML (over dev tools → states) and I change the class to energy and hit “set state” Home Assistant shows in the log that I made a change but when I reload the page the device class is still power and not energy anymore and therefore I still cant select it for the dashboard.

Am I just doing something wrong or is there a another way to change the device class?

Power and energy are different things, you can’t just force override power to energy or you’ll get totally bogus results.

The correct way to get energy from a power sensor is to feed the power sensor to a Riemann Sum (Integration) helper.