evChargeCurrentWrappedMeterHandler updates the dummy charge meter's charge power. This simplifies the main flow where the charge meter can always be treated as present. It assumes that the charge meter cannot consume more than total household consumption. If physical charge meter is present this han
(current float64)
| 650 | // If physical charge meter is present this handler is not used. |
| 651 | // The actual value is published by the evChargeCurrentHandler |
| 652 | func (lp *Loadpoint) evChargeCurrentWrappedMeterHandler(current float64) { |
| 653 | power := current * float64(lp.ActivePhases()) * Voltage |
| 654 | |
| 655 | // if disabled we cannot be charging |
| 656 | if !lp.enabled || !lp.charging() { |
| 657 | power = 0 |
| 658 | } |
| 659 | |
| 660 | // handler only called if charge meter was replaced by dummy |
| 661 | lp.chargeMeter.(*wrapper.ChargeMeter).SetPower(power) |
| 662 | } |
| 663 | |
| 664 | // defaultMode executes the action |
| 665 | func (lp *Loadpoint) defaultMode() { |
nothing calls this directly
no test coverage detected