How to set device_class for Riemann sum integral sensor

I used the hp_ilo integration to get the current power reading of my server. Since I want to track its power usage, I created a helper using the “Integration - Riemann sum integral sensor”, as described here.

If I add the helper to my energy dashboard I get get following message:

If I go to Dev Tools → States → sensor.server_power_consumption - > add
device_class: energy to the yaml config, the error message disappears, but reappears after restarting home assistant.

Can I ignore the message and HA will still track the usage anyway or how can I make the helper stick with device_class: energy

I just solved this myself by adding this to configuration.yaml and restarted Home Assistant. After that I could import the sensor in to Individual devices in Energy configuration. Running version HA 2024.3.0

homeassistant:
  customize:
    sensor.hp_ilo_nas_power_readings:
      device_class: "power"
      state_class: measurement
      unit_of_measurement: "W"
    sensor.hp_ilo_purre_nas_power_readings:
      device_class: "power"
      state_class: measurement
      unit_of_measurement: "W"

sensor:
  - platform: hp_ilo
    host: 192.168.0.10
    username: USERNAME
    password: PASSWORD
    monitored_variables:
      - name: Nas Power Readings
        sensor_type: server_health
        unit_of_measurement: "W"
        value_template: "{{ (ilo_data.power_supply_summary['present_power_reading']).split(' ')[0] }}"
  - platform: hp_ilo
    host: 192.168.0.11
    username: USERNAME
    password: PASSWORD
    monitored_variables:
      - name: Purre NAS Power Readings
        sensor_type: server_health
        unit_of_measurement: "W"
        value_template: "{{ (ilo_data.power_supply_summary['present_power_reading']).split(' ')[0] }}"
  - platform: integration
    source: sensor.hp_ilo_nas_power_readings
    name: NAS kWh
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.hp_ilo_purre_nas_power_readings
    name: PurreNAS kWh
    unit_prefix: k
    round: 2