-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit of measurement as kkWh? #2184
Comments
Hmm it's strange. I am unable to reproduce yet. When did you create this sensor? Recently or long time ago? Could you also create an energy sensor using the HA helper Riemann Sum, and see if that gives the same problem. |
Same issue. Had to delete and re-add devices with proper unit of measurement |
Do you both have this issue since that exact version HA 2024.3.3 or unsure? |
I am unsure, I skipped a few versions since the beginning of the year. I had my sensors set up as "kW", I switched them to "W" and all was working again. Nevertheless, it's not a bug in powercalc. Thread can be closed. Thanks for your input and keep up the great work! |
I just had the same thing happen after the upgrade from 2024.4.0 to 2024.4.1 - after a restart the energy sensor created from a charge power meter of my car (read via car since my charger doesn’t allow reading data) was returning kkWh. I only noticed because the energy dashboard didn’t show any new data since the restart. I removed a group that included the meter which allowed data to be refreshed for another group that included it too (All Rooms -> Garage -> Vehicle Energy -> Meter from power reading). Re-added it and it broke again. Tried to add the Garage as its own „from net“ as energy source and it showed the „invalid unit“ error which lead me here. tried to delete it all to recreate the meter but now it won’t create the entities for energy readouts. Not sure if that’s related or just an issue because there is no data (not charging so 0 power). |
I have created a bug report in HA core issue tracker: home-assistant/core#115077 |
I'm not sure if it's a problem with the riemann sum core helper, as the author mentioned the is kkWh issue is not present when you omit the unit prefix when setting up. Powercalc also forces the unit prefix to be None, so I don't see why you guys have this issue all of a sudden. Might be that it were sensors set up a long time ago and were always kkWh, but did not cause any problems. I have added some more extensive debug logging in 1.11.6 which I just released. Would help if any of you still experiencing the issue install that version, enable debug logging for Powercalc and restart. |
I set up my whole system in january, that's not so long ago. And it definitely worked before with the correct units. The log shows this, so it has ben kWh before. Here is the log from before with extended debugging:
Does this help? |
I have seen this error before! Happened directly using the riemann integration sensors. Reason was a mismatch between the unit of the source sensor and defining the |
the current code should already do this. But for some reason it stopped working. Oddly enough after several restarts it now works again. I did not change anything in the setup of the affected sensors. I still think that the problem lies with the underlying integration of the riemann sum and I don't like the way the unit handling is done. Imho all calculations should be done in the respective SI base unit. Everything else just changes the scale of the output. |
Powercalc creates a Riemann sensor under the hood, just as you would by manually creating one from the HA helper page. I might have an idea what causes this, because the new HA versions are very fast in startup time, which makes me believe the state of the source sensor is not available at that moment. This is where Powercalc tries to get the unit of measurement from. So it will be a hit and miss during startup, where sometimes it is Worked on a fix already yesterday (#2191) which you guys might check to see if that solves the problem, even after multiple restarts. Also I am with you that I think this issue should really be solved in riemann sensor, where the conversion should happen. And prevent these kind of issues with wrong unit being constructed. |
@bramstroker i think you are right with your startup order. I’ve done quite a few lately (testing some things) and it hasn’t occurred but then suddenly units were back to kkWh. I’ve simply fixed them in the developer tools and measurements are coming in again. Good to know what’s causing them - for now I can check after restarts if units are detected properly. Thanks for you hard efforts on this integration for all of us 😃 |
I just noticed that the state of my meter changed without a restart. I manually updated it to kWh after a restart and it suddenly went back to kkwh without doing anything. Not sure if that’s relevant but something I observed just now. |
Just happened again not 44 minutes later. Reset manually to kWh again |
I have released v1.11.7, hope this solves anything for you all. |
I had the custom power sender meter removed and upgraded to the latest version. Re-created it but it showed the same error right away. Manually adjusted it to kWh and restarted but it showed it again. maybe worth mentioning that this is a car charger which does log consumptions beyond 150.000 W.
|
@TheSerapher Are you also able to create a kWh for the same power meter without using powercalc? And see if you have similar behaviour with that one? |
Hey @bramstroker, Finally got around to test this. It's behaving the same way without me ever charging the car at all - so it didn't sum any data but still said 0.0 kkWh. When creating the Riemann sum integral helper I selected (k) as the scale. Maybe that was causing this? |
@TheSerapher You'll need to create the rieman integral helper manually without selecting a scale. Because when you select it it will result in the wrong unit of measurements. Because the source is already in Please also enable debug logging for powercalc. This is logged after every startup where powercalc is creating the riemann sum sensor under the hood. unit prefix can either be |
Looks like it was created as you anticipated:
After a restart:
So hopefully this solved the issue - I will keep an eye on it once I charge the car again. |
System Health details
System Information
Home Assistant Community Store
Home Assistant Cloud
Dashboards
Recorder
Checklist
Describe the issue
Since updating to Homeassistant 2024.3.3 i get this unit error for type energy from a real power sensor:
Somehow it has unit "kkWh" thus rendering it useless. The input sensor provides its value as "kW"
Reproduction steps
Debug logs
Diagnostics dump or YAML config
config_entry-powercalc-5a92eb5c910b2ee586e5481576c1e60c.json
The text was updated successfully, but these errors were encountered: