Change unit_of_measurement

Hello
I have a sensor “sensor.p1ib_active_power_plus_q1_q4” that shows unit in kw and I would like to change it to Kwh so I can see it in my energy dashboard. Can I do the following in my configuration.yaml file?

‘’ homeassistant:
customize:
sensor.p1ib_active_power_plus_q1_q4:
unit_of_measurement: “kWh”
device_class: energy
state_class: total_increasing ‘’

No you can not change a power sensor into an energy sensor just by changing the unit. They are two different things. Like speed and acceleration.

Use the Riemann Sum helper to convert power to energy. Be sure to use method: left.

Tanks for your ansver.
/Tommy