hass-powerpal
hass-powerpal copied to clipboard
Live Consumption using the kW instead of kWh
Version of the custom_component: 0.3.0
Describe the bug
It looks like in the latest update, we've accidentally changed the PowerpalLiveConsumptionSensor to use UnitOfPower.KILO_WATT
instead of UnitOfEnergy.KILO_WATT_HOUR
https://github.com/mindmelting/hass-powerpal/blob/88d90a7ac41bd03b67e75ca81a6a64a8dff912ee/custom_components/powerpal/sensor.py#L114
This has caused the below error, and home assistant is now no longer calculating statistics.
As stated in a previous issue, live consumption should be WattHours, not Watts.
Does that seem correct? or am i missing something here.
Debug log
2023-04-11 14:10:10.366 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.powerpal_live_consumption (kW) cannot be converted to the unit of previously compiled statistics (kWh). Generation of long term statistics will be suppressed unless the unit changes back to kWh or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this
Hmm, let me look into this
any update on this? i'm sill getting the errors
I had an initial look - I think in hindsight that although this is the proper metric - it's actually a breaking change.
Going to look into a bit more soon
Ok - I have looked into this a bit more.
The last release as mentioned previously is a semi-breaking change (but might be recoverable)
The live consumption sensor, is using measurement
as a state class which is correct, and has been moved from ENERGY
to POWER
as a device class (which is a fix) and thus from kWh
to kW
If you go to: https://my.home-assistant.io/redirect/developer_statistics you can click "Fix issue" and remediate past values to be kW
instead of kWh
- although statistics are still not showing for me for the live sensor. (The broader total consumption sensor which is used for the Energy dashboard is not impacted)
Let me know how you go with this - and I can update the README.md for this.
Apologies for the impact!
I went to do this but got the following choice which worried me about the scaling between kWh to W. Shouldn't it be from kWh to "kW" if there is only a unit change?
"Update the unit of the historic statistic values from 'kWh' to 'W', without converting."
Yeah,
i did "Update the unit of the historic statistic values from 'kWh' to 'W', without converting."
and then used powerpal_total_consumption going forward
utility_meter:
daily_house_energy:
source: sensor.powerpal_total_consumption
name: Daily Energy
cycle: daily
tariffs:
- peak
- offpeak
- shoulder
Yep, I think thats right from memory.