Closed bramstroker closed 6 months ago
Hey there @dgomes, mind taking a look at this issue as it has been labeled with an integration (integration
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
integration documentation integration source (message by IssueLinks)
When creating the Riemann Sum Integration you should not choose ANY metric_prefix as you already have 'k'
How do I do this with the GUI? There is no option to ommit the prefix and I end up with sensors of kkWh.
please open a new issue on the frontend repository. There should be the possibility to remove the selection of the unit.
If you never click any of the units, everything is OK (tested)
Hi. I am having a similar issue. I made a sensor with the k prefix, causing the unit to be kkWh, but whenever i delete and recreate the sensor, it always ends up on kkWh even with no prefix selected. A new sensor created gets the correct unit.
Do I have to wait until the old sensor data is purged from the history? Tried calling the recorder:purge service, but old data still shows up when recreating the sensor.
same answer as above, it needs fixing on the frontend. If you move the sensor to YAML all should be fixed
@dgomes I think there are still issues with the unit of measurement.
I also get complaints from powercalc users about the unit of measurements being wrongly set to kkWh, and I have double checked powercalc is also creating the Riemann sensor with setting the unit prefix to None
, similarly as you would with omiting it in the GUI.
kkWh is just a wrong uom and imo we should prevent that from happening in any case.
When a user wants a kWh
most of them will also set the unit of prefix to k
, which is logical. And currently this will fully break the sensor, even when the user later corrects it. As @sangvikh mentioned.
I think this can easily be fixed in the integration helper code by setting unit of measurement to a valid UnitOfEnergy
.
When source entity is in kW
and unit prefix is k
it can just set unit prefix to None
to prevent any issues by users misconfiguring. And this will result in a valid unit of measurement kWh
.
The problem
I have got multiple complaints of users of my custom component Powercalc last days which are unable to setup energy sensors anymore. Errors appear in the log regarding invalid unit of measurement
kkWh
Essentially Powercalc reuses the integration sensor code provided by HA core, so I have asked users to setup the energy sensor using Riemann sum helper directly to rule out Powercalc bridge code to be the problem.We can confirm the problem is actually in the core helper code, which also seems to be refactored a lot lately so probably a regression.
Reproduction steps
Observe the following error in log:
And the energy sensor being unavailable.
What version of Home Assistant Core has the issue?
core-2024.4.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
integration
Link to integration documentation on our website
https://www.home-assistant.io/integrations/integration/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response