Heatpump: allow fine control (#20040)
This commit is contained in:
parent
db910804d9
commit
162d7c7ccd
2 changed files with 10 additions and 8 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue