Heatpump: allow fine control (#20040)

This commit is contained in:
andig 2025-03-23 12:13:20 +01:00 • committed by GitHub
parent db910804d9
commit 162d7c7ccd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View file

@ -95,10 +95,10 @@ func NewEVSEWifiFromConfig(other map[string]interface{}) (api.Charger, error) {
voltages = wb.voltages
}
// decorate Charger with MaxCurrentEx
var maxCurrentEx func(float64) error
// decorate Charger with MaxCurrentMillis
var maxCurrentMillis func(float64) error
if wb.hires {
maxCurrentEx = wb.maxCurrentEx
maxCurrentMillis = wb.maxCurrentMillis
wb.current = 100 * wb.current
}
@ -108,7 +108,7 @@ func NewEVSEWifiFromConfig(other map[string]interface{}) (api.Charger, error) {
identify = wb.identify
}
return decorateEVSE(wb, currentPower, totalEnergy, currents, voltages, maxCurrentEx, identify), nil
return decorateEVSE(wb, currentPower, totalEnergy, currents, voltages, maxCurrentMillis, identify), nil
}
// NewEVSEWifi creates EVSEWifi charger
@ -208,8 +208,8 @@ func (wb *EVSEWifi) MaxCurrent(current int64) error {
return err
}
// maxCurrentEx implements the api.ChargerEx interface
func (wb *EVSEWifi) maxCurrentEx(current float64) error {
// maxCurrentMillis implements the api.ChargerEx interface
func (wb *EVSEWifi) maxCurrentMillis(current float64) error {
wb.current = int64(100 * current)
uri := fmt.Sprintf("%s/setCurrent?current=%d", wb.uri, wb.current)
return wb.get(uri)

View file

@ -148,11 +148,13 @@ func (wb *Heatpump) Enable(enable bool) error {
// MaxCurrent implements the api.Charger interface
func (wb *Heatpump) MaxCurrent(current int64) error {
return wb.MaxCurrentEx(float64(current))
return wb.MaxCurrentMillis(float64(current))
}
var _ api.ChargerEx = (*Heatpump)(nil)
// MaxCurrent implements the api.Charger interface
func (wb *Heatpump) MaxCurrentEx(current float64) error {
func (wb *Heatpump) MaxCurrentMillis(current float64) error {
phases := 1
if wb.lp != nil {
phases = wb.lp.GetPhases()