EEBus OHPCF: add disablepowerlimiter option (#33071)

This commit is contained in:
andig 2026-08-22 13:25:36 +02:00 • committed by GitHub
parent 8edf92a103
commit 469ccb83ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 52 additions and 11 deletions

View file

@ -378,6 +378,21 @@ func (i *iPhaseVoltages) Voltages() (float64, float64, float64, error) {
return i.phaseVoltages0()
}
func PowerLimiter(powerLimiter0 func() (float64, float64, error)) api.PowerLimiter {
if powerLimiter0 == nil {
return nil
}
return &iPowerLimiter{powerLimiter0}
}
type iPowerLimiter struct {
powerLimiter0 func() (float64, float64, error)
}
func (i *iPowerLimiter) GetMinMaxPower() (float64, float64, error) {
return i.powerLimiter0()
}
func Resurrector(resurrector0 func() error) api.Resurrector {
if resurrector0 == nil {
return nil

View file

@ -15,6 +15,7 @@ import (
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/api/implement"
"github.com/evcc-io/evcc/server/eebus"
"github.com/evcc-io/evcc/util"
)
@ -27,6 +28,7 @@ import (
// enabling the charger schedules or resumes the optional consumption, disabling
// it pauses or aborts the running process.
type EEBusOHPCF struct {
implement.Caps
*embed
cem *eebus.CustomerEnergyManagement
ma *eebus.MonitoringAppliance
@ -62,6 +64,7 @@ func NewEEBusOHPCFFromConfig(ctx context.Context, other map[string]any) (api.Cha
Ski string
Ip string
Reboost time.Duration
DisablePowerLimiter bool
}{
embed: embed{
Icon_: "heatpump",
@ -74,18 +77,19 @@ func NewEEBusOHPCFFromConfig(ctx context.Context, other map[string]any) (api.Cha
return nil, err
}
return NewEEBusOHPCF(ctx, &cc.embed, cc.Ski, cc.Ip, cc.Reboost)
return NewEEBusOHPCF(ctx, &cc.embed, cc.Ski, cc.Ip, cc.Reboost, cc.DisablePowerLimiter)
}
// NewEEBusOHPCF creates an EEBus OHPCF charger, registers it with the EEBus
// instance and waits for the connection.
func NewEEBusOHPCF(ctx context.Context, embed *embed, ski, ip string, reboost time.Duration) (api.Charger, error) {
func NewEEBusOHPCF(ctx context.Context, embed *embed, ski, ip string, reboost time.Duration, disablePowerLimiter bool) (api.Charger, error) {
inst, err := eebus.Instance()
if err != nil {
return nil, err
}
c := &EEBusOHPCF{
Caps: implement.New(),
embed: embed,
log: util.NewLogger("eebus-ohpcf"),
cem: inst.CustomerEnergyManagement(),
@ -96,6 +100,10 @@ func NewEEBusOHPCF(ctx context.Context, embed *embed, ski, ip string, reboost ti
reboost: reboost,
}
if !disablePowerLimiter {
implement.Has(c, implement.PowerLimiter(c.getMinMaxPower))
}
if err := inst.RegisterDevice(ski, ip, c); err != nil {
return nil, err
}
@ -460,11 +468,8 @@ func (c *EEBusOHPCF) apply(enable bool) error {
return nil
}
var _ api.PowerLimiter = (*EEBusOHPCF)(nil)
// GetMinMaxPower implements the api.PowerLimiter interface, reporting the
// optional consumption as expected min/max or ErrNotAvailable if none.
func (c *EEBusOHPCF) GetMinMaxPower() (float64, float64, error) {
// getMinMaxPower is the callback used to provide the optional power limits.
func (c *EEBusOHPCF) getMinMaxPower() (float64, float64, error) {
entity, ok := c.connectedCompressor()
if !ok {
return 0, 0, errNotConnected

View file

@ -86,6 +86,7 @@ func generate(out io.Writer) error {
reflect.TypeFor[api.PhasePowers](),
reflect.TypeFor[api.PhaseSwitcher](),
reflect.TypeFor[api.PhaseVoltages](),
reflect.TypeFor[api.PowerLimiter](),
reflect.TypeFor[api.Resurrector](),
reflect.TypeFor[api.SocLimiter](),
reflect.TypeFor[api.StatusReasoner](),

View file

@ -29,7 +29,17 @@ params:
help:
de: Wartezeit, nach der eine neu angekündigte optionale Leistungsaufnahme erneut eingeplant wird.
en: Wait time after which a newly announced optional power consumption is scheduled again.
- name: disablepowerlimiter
type: bool
advanced: true
description:
de: Leistungsgrenzen ignorieren
en: Ignore power limits
help:
de: Die vom Gerät gemeldete optionale Leistungsaufnahme nicht als Min-/Max-Leistung verwenden.
en: Do not use the device's announced optional power consumption as min/max power.
render: |
type: eebus-ohpcf
{{ include "eebus" . }}
reboost: {{ .reboost }}
disablepowerlimiter: {{ .disablepowerlimiter }}

View file

@ -17,7 +17,17 @@ params:
help:
de: Wartezeit, nach der eine neu angekündigte optionale Leistungsaufnahme erneut eingeplant wird.
en: Wait time after which a newly announced optional power consumption is scheduled again.
- name: disablepowerlimiter
type: bool
advanced: true
description:
de: Leistungsgrenzen ignorieren
en: Ignore power limits
help:
de: Die vom Gerät gemeldete optionale Leistungsaufnahme nicht als Min-/Max-Leistung verwenden.
en: Do not use the device's announced optional power consumption as min/max power.
render: |
type: eebus-ohpcf
{{ include "eebus" . }}
reboost: {{ .reboost }}
disablepowerlimiter: {{ .disablepowerlimiter }}