Closed CM000n closed 1 year ago
The group energy sensor is a sensor which needs to be always increasing in value. So the individual entities must also be total sensors, not daily total.
I think the issue might be that when you use power_sensor_id
option powercalc tries to find a matching kWh sensor on the same device. So for sensor.shelly_1pm_buero_tuer_power
it probably found the daily energy sensor provided by the ESPHome device.
There is no option yet to force powercalc to create an energy sensor.
To fix the issue I suggest to also use the energy_sensor_id
option to select the correct energy sensor. When there is no totaling sensor yet, you can create one using the riemann integral helper and than select that one using the energy_sensor_id
option. Hope this helps.
Btw I also found my suspicion in the logs:
2023-03-02 21:19:25.109 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Found existing energy sensor 'sensor.shelly_1pm_buero_tuer_daily_energy' for the power sensor 'sensor.shelly_1pm_buero_tuer_power'
Thank you for the feedback. That makes sense, unfortunately there really is no total increasing energy sensor for these entities at the moment. I will therefore try the Riemann integral for the time being.
However, it would be good to point out in the documentation that powercalc sensors based on existing power meters implicitly will use existing energy sensors of them, which can cause problems if they are not totally increasing (or did I just overread it?).
As a future feature, it would be cool to be able to ignore existing energy sensors in such a case and force creation by powercalc based on wattage.
It's in this section in the readme. https://homeassistant-powercalc.readthedocs.io/en/latest/group.html#adding-non-powercalc-sensors. See the note.
I will consider adding an option to force creation of a new riemann integral sensor.
System Health details
Sorry, but I can't find taht button on my HA Docker :-/
Checklist
Describe the issue
I have a very strange problem where the Home Assistant Energy Dashboard shows negative values for a group created by Powercalc that includes existing energy sensors.
This is what my energy dashboard looks like:
This is what the part of the config for the energy group looks like:
The two existing energy sensors contained in it are the enitiy_ids
switch.shelly_1pm_buero_ecke
andsensor.shelly_1pm_buero_tuer_power
.These are ESP Home devices that also provide an daily energy meter for via the
total_daily_energy
platform. When I look at them, it seems that the negative values are generated at the same time when the energy meter for the daily values resets (00:00 UTC, 01:00 CET):However, when I look at the energy meters generated by powercal for the yearly values, there are no anomalies to be seen either for the indivual lamps or for the two ESP energy meters in the group.
Reproduction steps
Debug logs
Diagnostics dump or YAML config