Using Bticino Living Now DIN power in energy dashboard

I have a Bticino Living Now DIN power meter configured with Home Assistant via Zigbee2MQTT. It works fine but I can’t set use it in energy dashboard because it has a wrong states according to this documentation:

state_class: measurement
unit_of_measurement: W
device_class: power
friendly_name: Bticino Misuratore DIN Power
linkquality: 255
power: 761
power_alarm_active: true
power_alarm_active_value: 2
power_alarm_enabled: 1
power_alarm_wh_threshold: 1
power_apparent: 844
update:
  installed_version: 5456895
  latest_version: 5456895
  state: idle
update_available: false

I tried to change it from Developer Tools but when I click on refresh icon they come back to old values. Is there any way to force state_class and device_class to the value I need?

Thank you!

I managed to set the the proper states with this code in configuration.yaml:

  customize:
    sensor.bticino_misuratore_din_power:
      state_class: total
      unit_of_measurement: kWh
      device_class: energy
      friendly_name: Bticino Misuratore DIN

But when I go to add consumption in energy configuration I still cannot select it. To fix it I had to go in “Developer Tools → Statistics”, looking for the device and click on Fix It because previous data was in W and it cannot be converted to kWh.