SetBatteryBoost sets the battery boost
(enable bool)
| 623 | |
| 624 | // SetBatteryBoost sets the battery boost |
| 625 | func (lp *Loadpoint) SetBatteryBoost(enable bool) error { |
| 626 | lp.Lock() |
| 627 | defer lp.Unlock() |
| 628 | |
| 629 | if enable && lp.mode != api.ModePV && lp.mode != api.ModeMinPV { |
| 630 | return errors.New("battery boost is only available in PV modes") |
| 631 | } |
| 632 | |
| 633 | lp.log.DEBUG.Println("set battery boost:", enable) |
| 634 | |
| 635 | if enable != (lp.batteryBoost != boostDisabled) { |
| 636 | lp.publish(keys.BatteryBoost, enable) |
| 637 | |
| 638 | lp.batteryBoost = boostDisabled |
| 639 | if enable { |
| 640 | lp.batteryBoost = boostStart |
| 641 | lp.requestUpdate() |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | return nil |
| 646 | } |
| 647 | |
| 648 | // GetBatteryBoostLimit returns the battery boost soc limit |
| 649 | func (lp *Loadpoint) GetBatteryBoostLimit() int { |