stevebuk1 / pv_opt

Home Assistant PV Optimisation for Solis Inverters
MIT License
0 stars 0 forks source link

Dev: Negative values in power consumption #1

Open stevebuk1 opened 1 week ago

stevebuk1 commented 1 week ago

The odd negative power consumption value appears after subtracting EV consumption from total consumption. Whilst this should have no effect, negative values are best suppressed to zero.

stevebuk1 commented 4 days ago

Debug Logging shows the effect persists for a few hours but is short lived. Both Solis and Zappi sensors report a large power consumption for the most recent half hour. The Solis sensor reverts to a lower value a few optimiser iterations later, but the Zappi large value persists for a few hours and then reverts.

Rather than suppressing, a targeted logging has been added to Beta-4 that is triggered by any negative power values to get to root cause.

It is suspected that because this is occurring at the end of a charging session, the Zappi kWh sensor (1dec pl) is no longer incrementing meaning an absence of further entries. The existing consumption code probably performing an interpolation rather than assuming a zero increase. Once sufficient time has passed for the Zappi sensor to generate an entry, the problem resolves itself.

pv_opt.log pv_opt1.log

stevebuk1 commented 2 days ago

Targetted logging suggests pandas .interpolate will not perform an extrapolate function and as such the root cause is that the EV from total subtraction is done on a power (W)) basis as opposed to an energy (kwh) basis. The subtraction really needs to be performed before conversion from kWh into W, which is an extensive fix. For a workaround any negative values will be zeroed and as the issue is always constrained to a single 1/2 hour slot the error introduced is unlikely to have any significant effect.