Open michalk-k opened 1 month ago
Powercalc groups does not support negative figures for an energy sensor. It expects it to only ever increase in value. So that would probably be the reason for this issue. Not sure how a wall switch in your bedroom is generating power?
I might have a look into supporting negative energy for powercalc groups in the future. For now I will make sure to put a note in the docs.
If you want to clean up history data of the power entity I think you'll need to alter data in statistics
and statistics_short_term
tables in the DB.
Good catch with this negative values sensor
I have a template sensor representing the negative power of lights because those lights share the same source with other non-lights devices. So to measure the power of the latter, I have to reduce the consumption of the whole string by light power.
It worked this way for a really long time. Interestingly, you are saying it might be the culprit of the issue. If it's sensitive to that, I had to workaround it a different way.
Thank you
@bramstroker I have real troubles to fix those data. Every time I update bad data to proper values, the subsequently created record into statistics and short term ones includes the unwanted value. Ie I reduced selected historical records by about 200kWh, but then the next created record gets again 200kWh over expected value.
I was supposing the recorder, so turned it off for the time needed for this operation, then restarted HA, but it didn't help. Tried to stop whole HA, but then I had no access to sqllite editor (yes, I can copy the db to PC, update data and upload fixed db back)
Do you know the easier method? Maybe disabling sensors created by PowerCalc and then enabling them afterward? ... Something less invasive than moving db file out of HA.
@michalk-k I suspect restore data data, which powercalc and other HA entities uses to restore the sensor to latest known value after startup. These are stored in config/.storage/core.restore_state
. Also powercalc stores last know state of individual energy entities in config/.storage/powercalc_group
.
You could have a look into both files and correct the data there. Next restart. Hope this solves the issue.
Btw, today I worked on a subtracting group sensor. Just finished that development, will be in next release. Might also be useful for your use case:
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1390 Downloaded Repositories | 35Home Assistant Cloud
logged_in | true -- | -- subscription_expiration | August 14, 2024 at 02:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | false remote_server | eu-central-1-4.ui.nabu.casa certificate_status | ready instance_id | 3cb0d3fbab1e44f98797c10448afb4d1 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okHome Assistant Supervisor
host_os | Home Assistant OS 6.6 -- | -- update_channel | stable supervisor_version | supervisor-2024.06.2 agent_version | 1.2.1 docker_version | 20.10.8 disk_total | 109.3 GB disk_used | 19.9 GB healthy | true supported | failed to load: Unsupported host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | Advanced SSH & Web Terminal (18.0.0), Studio Code Server (5.15.0), Mosquitto broker (6.4.1), File editor (5.8.0), Glances (0.21.1), Node-RED (18.0.2), Home Assistant Google Drive Backup (0.112.1), Log Viewer (0.17.0), UniFi Network Application (3.1.0), Zigbee2MQTT (1.39.0-1)Dashboards
dashboards | 10 -- | -- resources | 26 views | 63 mode | storageRecorder
oldest_recorder_run | August 4, 2024 at 13:27 -- | -- current_recorder_run | August 4, 2024 at 23:01 estimated_db_size | 2003.11 MiB database_engine | sqlite database_version | 3.44.2Checklist
Describe the issue
Recently one of PowerCalc started to generate impossible values.
Here are involved entities:
It seems that it's caused by the interruption of power measurement of Bedroom Walllights Negative Power entity Having both images one below another, the correlation seems obvious.
Have no exact times, but this day I did multiple restarts of HA. Those holes in measurement may be related to that. Potentially, bad data might have been triggered by HA restart.
Since this started to happening, Bedroom socket energy PowerCalc sensor reports
skipping state ... probably erroneous value or sensor was reset
flooding HA logs, so I lost the moment the situation started to happening.I'm not expecting any instant fix or so. I can imagine it might be near impossible. Just wanted to notify it happens the. Currently I disabled this entity, have to clean statistics data of 2 recent days for entities handling light energy. (several). But don't know what to do with this power PowerCalc entity. HOw to reset it, or have I drop it and create again
Reproduction steps
1. 2. 3. ...
Debug logs
Diagnostics dump or YAML config
No response