Optimizer: standardize definition of battery parameters (#26302)

This commit is contained in:
andig 2026-01-02 13:20:09 +01:00 • committed by GitHub
parent 30b1e135e4
commit 4a7498ac9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
80 changed files with 1184 additions and 565 deletions

View file

@ -29,20 +29,22 @@ func init() {
registry.Add("e3dc-rscp", NewE3dcFromConfig)
}
//go:generate go tool decorate -f decorateE3dc -b *E3dc -r api.Meter -t "api.Battery,Soc,func() (float64, error)" -t "api.BatteryCapacity,Capacity,func() float64" -t "api.BatteryController,SetBatteryMode,func(api.BatteryMode) error" -t "api.MaxACPowerGetter,MaxACPower,func() float64"
//go:generate go tool decorate -f decorateE3dc -b *E3dc -r api.Meter -t "api.Battery,Soc,func() (float64, error)" -t "api.BatteryCapacity,Capacity,func() float64" -t "api.BatteryController,SetBatteryMode,func(api.BatteryMode) error" -t "api.BatterySocLimiter,GetSocLimits,func() (float64, float64)" -t "api.BatteryPowerLimiter,GetPowerLimits,func() (float64, float64)" -t "api.MaxACPowerGetter,MaxACPower,func() float64"
func NewE3dcFromConfig(other map[string]any) (api.Meter, error) {
cc := struct {
batteryCapacity `mapstructure:",squash"`
pvMaxACPower `mapstructure:",squash"`
Usage templates.Usage
Uri string
User string
Password string
Key string
ExternalPower bool
DischargeLimit uint32
Timeout time.Duration
batteryCapacity `mapstructure:",squash"`
batteryPowerLimits `mapstructure:",squash"`
batterySocLimits `mapstructure:",squash"`
pvMaxACPower `mapstructure:",squash"`
Usage templates.Usage
Uri string
User string
Password string
Key string
ExternalPower bool
DischargeLimit uint32
Timeout time.Duration
}{
Timeout: request.Timeout,
}
@ -69,12 +71,12 @@ func NewE3dcFromConfig(other map[string]any) (api.Meter, error) {
ReceiveTimeout: cc.Timeout,
}
return NewE3dc(cfg, cc.Usage, cc.DischargeLimit, cc.ExternalPower, cc.batteryCapacity.Decorator(), cc.pvMaxACPower.Decorator())
return NewE3dc(cfg, cc.Usage, cc.DischargeLimit, cc.ExternalPower, cc.batteryCapacity.Decorator(), cc.pvMaxACPower.Decorator(), cc.batterySocLimits.Decorator(), cc.batteryPowerLimits.Decorator())
}
var e3dcOnce sync.Once
func NewE3dc(cfg rscp.ClientConfig, usage templates.Usage, dischargeLimit uint32, externalPower bool, capacity, maxacpower func() float64) (api.Meter, error) {
func NewE3dc(cfg rscp.ClientConfig, usage templates.Usage, dischargeLimit uint32, externalPower bool, capacity, maxacpower func() float64, batterySocLimits, batteryPowerLimits func() (float64, float64)) (api.Meter, error) {
e3dcOnce.Do(func() {
log := util.NewLogger("e3dc")
rscp.Log.SetLevel(logrus.DebugLevel)
@ -112,7 +114,7 @@ func NewE3dc(cfg rscp.ClientConfig, usage templates.Usage, dischargeLimit uint32
batteryMode = m.setBatteryMode
}
return decorateE3dc(m, batterySoc, batteryCapacity, batteryMode, maxacpower), nil
return decorateE3dc(m, batterySoc, batteryCapacity, batteryMode, batterySocLimits, batteryPowerLimits, maxacpower), nil
}
// retryMessage executes a single message request with retry

View file

@ -6,12 +6,12 @@ import (
"github.com/evcc-io/evcc/api"
)
func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity func() float64, batteryController func(api.BatteryMode) error, maxACPowerGetter func() float64) api.Meter {
func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity func() float64, batteryController func(api.BatteryMode) error, batterySocLimiter func() (float64, float64), batteryPowerLimiter func() (float64, float64), maxACPowerGetter func() float64) api.Meter {
switch {
case battery == nil && maxACPowerGetter == nil:
return base
case battery != nil && batteryCapacity == nil && batteryController == nil && maxACPowerGetter == nil:
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
@ -22,7 +22,7 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && maxACPowerGetter == nil:
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
@ -37,7 +37,7 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && maxACPowerGetter == nil:
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
@ -52,7 +52,7 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && maxACPowerGetter == nil:
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
@ -71,6 +71,250 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryController
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryPowerLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryController
api.BatteryPowerLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter == nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
@ -82,7 +326,7 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && maxACPowerGetter != nil:
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
@ -97,7 +341,7 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && maxACPowerGetter != nil:
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
@ -116,7 +360,7 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && maxACPowerGetter != nil:
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
@ -135,7 +379,7 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && maxACPowerGetter != nil:
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
@ -157,6 +401,298 @@ func decorateE3dc(base *E3dc, battery func() (float64, error), batteryCapacity f
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryController
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryPowerLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryController
api.BatteryPowerLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && maxACPowerGetter != nil:
return &struct {
*E3dc
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MaxACPowerGetter
}{
E3dc: base,
Battery: &decorateE3dcBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateE3dcBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateE3dcBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateE3dcBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateE3dcBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MaxACPowerGetter: &decorateE3dcMaxACPowerGetterImpl{
maxACPowerGetter: maxACPowerGetter,
},
}
}
return nil
@ -186,6 +722,22 @@ func (impl *decorateE3dcBatteryControllerImpl) SetBatteryMode(p0 api.BatteryMode
return impl.batteryController(p0)
}
type decorateE3dcBatteryPowerLimiterImpl struct {
batteryPowerLimiter func() (float64, float64)
}
func (impl *decorateE3dcBatteryPowerLimiterImpl) GetPowerLimits() (float64, float64) {
return impl.batteryPowerLimiter()
}
type decorateE3dcBatterySocLimiterImpl struct {
batterySocLimiter func() (float64, float64)
}
func (impl *decorateE3dcBatterySocLimiterImpl) GetSocLimits() (float64, float64) {
return impl.batterySocLimiter()
}
type decorateE3dcMaxACPowerGetterImpl struct {
maxACPowerGetter func() float64
}

View file

@ -22,7 +22,7 @@ func init() {
registry.Add("lgess15", NewLgEss15FromConfig)
}
//go:generate go tool decorate -f decorateLgEss -b *LgEss -r api.Meter -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.BatteryCapacity,Capacity,func() float64" -t "api.Battery,Soc,func() (float64, error)" -t "api.BatterySocLimiter,GetSocLimits,func() (float64, float64)" -t "api.BatteryController,SetBatteryMode,func(api.BatteryMode) error"
//go:generate go tool decorate -f decorateLgEss -b *LgEss -r api.Meter -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.BatteryCapacity,Capacity,func() float64" -t "api.Battery,Soc,func() (float64, error)" -t "api.BatterySocLimiter,GetSocLimits,func() (float64, float64)" -t "api.BatteryPowerLimiter,GetPowerLimits,func() (float64, float64)" -t "api.BatteryController,SetBatteryMode,func(api.BatteryMode) error"
func NewLgEss8FromConfig(other map[string]any) (api.Meter, error) {
return NewLgEssFromConfig(other, lgpcs.LgEss8)
@ -37,6 +37,7 @@ func NewLgEssFromConfig(other map[string]any, essType lgpcs.Model) (api.Meter, e
cc := struct {
batteryCapacity `mapstructure:",squash"`
batterySocLimits `mapstructure:",squash"`
batteryPowerLimits `mapstructure:",squash"`
URI, Usage string
Registration, Password string
Cache time.Duration
@ -56,11 +57,11 @@ func NewLgEssFromConfig(other map[string]any, essType lgpcs.Model) (api.Meter, e
return nil, errors.New("missing usage")
}
return NewLgEss(cc.URI, cc.Usage, cc.Registration, cc.Password, cc.Cache, cc.batteryCapacity.Decorator(), cc.batterySocLimits, essType)
return NewLgEss(cc.URI, cc.Usage, cc.Registration, cc.Password, cc.Cache, cc.batteryCapacity.Decorator(), cc.batterySocLimits, cc.batteryPowerLimits, essType)
}
// NewLgEss creates an LgEss Meter
func NewLgEss(uri, usage, registration, password string, cache time.Duration, capacity func() float64, batterySocLimits batterySocLimits, essType lgpcs.Model) (api.Meter, error) {
func NewLgEss(uri, usage, registration, password string, cache time.Duration, capacity func() float64, batterySocLimits batterySocLimits, batteryPowerLimits batteryPowerLimits, essType lgpcs.Model) (api.Meter, error) {
conn, err := lgpcs.GetInstance(uri, registration, password, cache, essType)
if err != nil {
return nil, err
@ -90,7 +91,7 @@ func NewLgEss(uri, usage, registration, password string, cache time.Duration, ca
}
}
return decorateLgEss(m, totalEnergy, capacity, batterySoc, batterySocLimiter, setBatteryMode), nil
return decorateLgEss(m, totalEnergy, capacity, batterySoc, batterySocLimiter, batteryPowerLimits.Decorator(), setBatteryMode), nil
}
// CurrentPower implements the api.Meter interface

View file

@ -6,7 +6,7 @@ import (
"github.com/evcc-io/evcc/api"
)
func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapacity func() float64, battery func() (float64, error), batterySocLimiter func() (float64, float64), batteryController func(api.BatteryMode) error) api.Meter {
func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapacity func() float64, battery func() (float64, error), batterySocLimiter func() (float64, float64), batteryPowerLimiter func() (float64, float64), batteryController func(api.BatteryMode) error) api.Meter {
switch {
case battery == nil && meterEnergy == nil:
return base
@ -22,7 +22,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batterySocLimiter == nil && meterEnergy == nil:
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -33,7 +33,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batterySocLimiter == nil && meterEnergy != nil:
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -48,7 +48,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batterySocLimiter == nil && meterEnergy == nil:
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -63,7 +63,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batterySocLimiter == nil && meterEnergy != nil:
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -82,7 +82,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batterySocLimiter != nil && meterEnergy == nil:
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -97,7 +97,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batterySocLimiter != nil && meterEnergy != nil:
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -116,7 +116,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batterySocLimiter != nil && meterEnergy == nil:
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -135,7 +135,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batterySocLimiter != nil && meterEnergy != nil:
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -158,7 +158,175 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batterySocLimiter == nil && meterEnergy == nil:
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryPowerLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryPowerLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController == nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -173,7 +341,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batterySocLimiter == nil && meterEnergy != nil:
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -192,7 +360,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batterySocLimiter == nil && meterEnergy == nil:
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -211,7 +379,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batterySocLimiter == nil && meterEnergy != nil:
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -234,7 +402,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batterySocLimiter != nil && meterEnergy == nil:
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -253,7 +421,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batterySocLimiter != nil && meterEnergy != nil:
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -276,7 +444,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batterySocLimiter != nil && meterEnergy == nil:
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
@ -299,7 +467,7 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batterySocLimiter != nil && meterEnergy != nil:
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter == nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
@ -325,6 +493,206 @@ func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapa
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryController
api.BatteryPowerLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryController
api.BatteryPowerLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter == nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity == nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy == nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
}
case battery != nil && batteryCapacity != nil && batteryController != nil && batteryPowerLimiter != nil && batterySocLimiter != nil && meterEnergy != nil:
return &struct {
*LgEss
api.Battery
api.BatteryCapacity
api.BatteryController
api.BatteryPowerLimiter
api.BatterySocLimiter
api.MeterEnergy
}{
LgEss: base,
Battery: &decorateLgEssBatteryImpl{
battery: battery,
},
BatteryCapacity: &decorateLgEssBatteryCapacityImpl{
batteryCapacity: batteryCapacity,
},
BatteryController: &decorateLgEssBatteryControllerImpl{
batteryController: batteryController,
},
BatteryPowerLimiter: &decorateLgEssBatteryPowerLimiterImpl{
batteryPowerLimiter: batteryPowerLimiter,
},
BatterySocLimiter: &decorateLgEssBatterySocLimiterImpl{
batterySocLimiter: batterySocLimiter,
},
MeterEnergy: &decorateLgEssMeterEnergyImpl{
meterEnergy: meterEnergy,
},
}
}
return nil
@ -354,6 +722,14 @@ func (impl *decorateLgEssBatteryControllerImpl) SetBatteryMode(p0 api.BatteryMod
return impl.batteryController(p0)
}
type decorateLgEssBatteryPowerLimiterImpl struct {
batteryPowerLimiter func() (float64, float64)
}
func (impl *decorateLgEssBatteryPowerLimiterImpl) GetPowerLimits() (float64, float64) {
return impl.batteryPowerLimiter()
}
type decorateLgEssBatterySocLimiterImpl struct {
batterySocLimiter func() (float64, float64)
}

View file

@ -33,6 +33,8 @@ func NewModbusMbmdFromConfig(ctx context.Context, other map[string]any) (api.Met
cc := struct {
Model string
batteryCapacity `mapstructure:",squash"`
batteryPowerLimits `mapstructure:",squash"`
batterySocLimits `mapstructure:",squash"`
modbus.Settings `mapstructure:",squash"`
Power, Energy, Soc string
Currents []string

View file

@ -18,13 +18,8 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 9600
id: 85
- name: capacity
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -204,5 +199,5 @@ render: |
address: 2133 # 0x855 Charge Cut Soc
type: writemultiple
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -11,9 +11,8 @@ params:
- name: host
- name: port
default: 80
- name: capacity
advanced: true
- name: externalpv
type: bool
description:
de: |
Benötigt bei ein weiterer Solarwechselrichter.
@ -28,7 +27,7 @@ params:
This parameter is needed when the BatterX station is connected to another solar inverter.
The total produced solar power can so be reported through one system.
Further auxilary solar inverters do not need to be connected to evcc.
default: "false"
- preset: battery-params
render: |
type: custom
power:
@ -81,6 +80,6 @@ render: |
uri: http://{{ .host }}:{{ .port }}/api.php?set=command&type=20738&text1=3&text2=1 # Battery Charge AC - ON
- source: http
uri: http://{{ .host }}:{{ .port }}/api.php?set=command&type=20738&text1=4&text2=0 # Battery Discharging - OFF
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}
{{- end }}

View file

@ -12,8 +12,7 @@ params:
choice: ["grid", "pv", "battery"]
allinone: true
- name: uri
- name: capacity
advanced: true
- preset: battery-params
render: |
type: bosch-bpt
usage: {{ .usage }}

View file

@ -16,13 +16,8 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: maxacpower
- preset: battery-params
- name: maxdischargecurrent
required: true
default: 100
@ -384,7 +379,5 @@ render: |
address: 109 # Battery Max Discharging Current
type: writemultiple
decode: uint16
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -19,13 +19,8 @@ params:
type: int
default: 1
advanced: true
- name: capacity
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: maxacpower
- preset: battery-params
- name: includegenport
type: bool
advanced: true
@ -306,7 +301,5 @@ render: |
address: 172
type: writemultiple
decode: int32s
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -13,8 +13,7 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -103,5 +102,5 @@ render: |
address: 184 # "battery capacity"
type: holding
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -9,8 +9,7 @@ params:
- name: host
- name: port
default: 502
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -56,5 +55,5 @@ render: |
address: 40082 # Batterie-SOC in %
type: holding
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -38,6 +38,18 @@ params:
de: Muss auf dem Bildschirm des Hauskraftwerks unter 'Personalisieren' > 'Benutzerprofil' angelegt werden.
mask: true
required: true
- name: maxacpower
- name: externalpower
type: bool
description:
de: Externe Quelle einschließen
en: Include external power
help:
de: Bezieht alle angeschlossenen externen Quellen in die PV-Berechnung ein (Standard).
en: Includes all connected external sources into the PV calculation (default).
advanced: true
usages: ["pv"]
default: true
- name: battery
description:
generic: Battery
@ -52,20 +64,7 @@ params:
type: int
advanced: true
usages: ["battery"]
- name: maxacpower
- name: capacity
advanced: true
- name: externalpower
type: bool
description:
de: Externe Quelle einschließen
en: Include external power
help:
de: Bezieht alle angeschlossenen externen Quellen in die PV-Berechnung ein (Standard).
en: Includes all connected external sources into the PV calculation (default).
advanced: true
usages: ["pv"]
default: "true"
- preset: battery-params
render: |
type: e3dc-rscp
usage: {{ .usage }}
@ -73,11 +72,11 @@ render: |
user: {{ .user }}
password: {{ .password }}
key: {{ .key }}
{{- if eq .usage "battery" }}
dischargelimit: {{ .dischargelimit }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- if eq .usage "pv" }}
maxacpower: {{ .maxacpower }} # W
externalpower: {{ .externalpower }}
{{- end }}
{{- if eq .usage "battery" }}
dischargelimit: {{ .dischargelimit }}
{{- include "battery-params" . }}
{{- end }}

View file

@ -15,11 +15,6 @@ params:
help:
en: "Required if Envoy Firmware D7.x.xxx. Token is valid for one year. Instructions for obtaining a token via web UI: https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication"
de: "Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication"
- name: capacity
advanced: true
- name: cache
advanced: true
default: 1s
- name: battery_type
description:
en: "Enphase Battery Type (AC or IQ)"
@ -30,6 +25,10 @@ params:
default: ac
choice: ["ac", "iq"]
advanced: true
- preset: battery-params
- name: cache
advanced: true
default: 1s
render: |
type: custom
{{- if eq .usage "grid" }}
@ -163,5 +162,5 @@ render: |
{{- end }}
cache: {{ .cache }}
jq: '[.[].devices[] | select(.percentFull != null) | .percentFull] | add / length'
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -14,14 +14,15 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 9600
id: 1
- name: maxacpower
default: 800
- preset: battery-params
- name: capacity
default: 2.11 # kWh
- name: minsoc
default: 10
- name: maxsoc
default: 100
- name: maxacpower
default: 800
- name: maxchargepower
default: 1200
render: |
@ -188,9 +189,5 @@ render: |
address: 46003 # Remote Active Power
type: writemultiple
encoding: int32
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxacpower }} # W
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -10,6 +10,7 @@ params:
- name: modbus
choice: ["rs485", "tcpip"]
id: 247
- preset: battery-params
render: |
type: custom
{{- if eq .usage "pv" }}
@ -64,4 +65,5 @@ render: |
type: input
{{- end }}
decode: int16
{{- include "battery-params" . }}
{{- end }}

View file

@ -10,17 +10,8 @@ params:
- name: modbus
choice: ["rs485", "tcpip"]
id: 247
- name: capacity
type: float
advanced: true
# battery control
- name: minsoc
type: int
advanced: true
- name: maxsoc
type: int
advanced: true
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -124,7 +115,5 @@ render: |
address: 46611 # Minimum SoC OnGrid
type: writesingle
decode: uint16
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -10,6 +10,7 @@ params:
- name: modbus
choice: ["rs485", "tcpip"]
id: 247
- preset: battery-params
- name: capacity
advanced: true
# battery control
@ -99,7 +100,5 @@ render: |
address: 41009 # limit soc
type: writesingle
decode: uint16
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -32,14 +32,9 @@ params:
generic: Integer
deprecated: true
- name: maxacpower
- preset: battery-params
- name: maxchargerate
advanced: true
- name: capacity
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
render: |
type: custom
# sunspec model 20x (int+sf)/ 21x (float) meter
@ -248,13 +243,11 @@ render: |
id: 1
value: 124:0:StorCtl_Mod
- source: const
value: -{{ .maxchargerate }} # %
value: {{ if .maxchargerate }}-{{ .maxchargerate }}{{ end }} # %
set:
source: sunspec
uri: {{ .host }}:{{ .port }}
id: 1
value: 124:0:OutWRte
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -23,8 +23,6 @@ params:
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: capacity
advanced: true
- name: user
default: customer
description:
@ -44,6 +42,7 @@ params:
help:
de: Firmware Versionen ab 1.36.5-1 erfordern /api/config.
en: Firmware starting with 1.36.5-1 requires /api/config.
- preset: battery-params
render: |
type: custom
power:
@ -113,5 +112,5 @@ render: |
- source: error
error: ErrNotAvailable
{{- end }}
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -21,8 +21,7 @@ params:
- name: maxacpower
- name: maxchargerate
advanced: true
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
# sunspec model 20x (int+sf)/ 21x (float) meter
@ -246,5 +245,5 @@ render: |
uri: {{ .host }}:{{ .port }}
id: 1
value: 124:0:OutWRte
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -11,6 +11,7 @@ params:
choice: ["rs485", "tcpip", "udp"]
baudrate: 9600
id: 247
- name: maxacpower
- name: battery
default: 1
type: choice
@ -19,9 +20,7 @@ params:
de: Batteriespeichernummer
choice: [1, 2]
usages: ["battery"]
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
- name: maxchargepower
default: 10000
- name: maxdischargepower
@ -230,9 +229,5 @@ render: |
address: 47512 # EMSPowerSet [0-10000]
type: writemultiple
encoding: uint16
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -11,9 +11,8 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -214,5 +213,5 @@ render: |
address: 3049
type: writemultiple
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -23,9 +23,8 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -176,5 +175,5 @@ render: |
address: 1092
type: writemultiple
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -23,8 +23,7 @@ params:
- name: host
- name: port
default: 502
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}

View file

@ -9,8 +9,7 @@ params:
allinone: true
- name: modbus
choice: ["tcpip"]
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -104,5 +103,5 @@ render: |
type: holding
decode: uint16nan
scale: 0.01
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -14,18 +14,16 @@ params:
advanced: true
- name: modbus
choice: ["tcpip"]
- name: timeout
default: 15s
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
- name: timeout
deprecated: true
render: |
type: custom
{{- if eq .usage "grid" }}
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
connectdelay: 1s
register:
address: 32278 # Active power
@ -35,7 +33,6 @@ render: |
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 32349 # Negative active electricity
type: holding
@ -44,7 +41,6 @@ render: |
currents:
- source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 32272 # Huawei phase A grid current
type: holding
@ -52,7 +48,6 @@ render: |
scale: 0.1
- source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 32274 # Huawei phase B grid current
type: holding
@ -60,7 +55,6 @@ render: |
scale: 0.1
- source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 32276 # Huawei phase C grid current
type: holding
@ -91,7 +85,6 @@ render: |
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
connectdelay: 1s
register:
{{- if eq .storageunit "1" }}
@ -106,7 +99,6 @@ render: |
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
{{- if eq .storageunit "1" }}
address: 37068 # [Energy storage unit 1] Total discharge
@ -120,7 +112,6 @@ render: |
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
{{- if eq .storageunit "1" }}
address: 37004
@ -238,5 +229,5 @@ render: |
address: 47087 # Charge from grid
type: writesingle
encoding: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -27,15 +27,6 @@ params:
type: int
default: 1
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: maxchargepower
default: 10000
- name: maxdischargepower
- name: capacity
advanced: true
- name: maxacpower
- name: forceaccharging
default: false
@ -48,6 +39,9 @@ params:
help:
en: Keep AC charging active to charge the storage from other inverters via AC. Prevents stand-by.
de: AC-Laden bleibt aktiv zum Laden des Speichers aus anderen AC Quellen für Wechselrichterkaskaden. Verhindert Stand-by.
- preset: battery-params
- name: maxchargepower
default: 10000
render: |
type: custom
{{- if eq .usage "grid" }}
@ -281,9 +275,5 @@ render: |
address: 47087 # Charge from grid
type: writesingle
encoding: uint16
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
{{- include "battery-params" . }}
{{- end }}

View file

@ -9,8 +9,7 @@ params:
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: capacity
advanced: true
- preset: battery-params
render: |
{{- if eq .usage "grid" }}
type: custom
@ -48,5 +47,5 @@ render: |
uri: http://{{ .host }}/api/dxs.json?dxsEntries=33556229 # Battery SOC
# | ----------------------------- Bat SOC% --------- |
jq: (.dxsEntries[] | select(.dxsId==33556229) | .value )
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -38,19 +38,10 @@ params:
choice: ["little", "big"]
default: little
advanced: true
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
- name: maxchargerate
deprecated: true
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: maxchargepower
required: true
- name: maxdischargepower
- name: watchdog
type: duration
default: 60s
@ -87,8 +78,6 @@ render: |
source: sunspec
{{- include "modbus" . | indent 2 }}
value: 802:SoC # 802 battery control
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
batterymode:
source: watchdog
timeout: {{ .watchdog }} # re-write at timeout/2
@ -129,7 +118,5 @@ render: |
address: 1034 # Battery charge power (DC) setpoint, absolute [W]
type: writemultiple
encoding: {{ if (eq .endianness "big") }}float32{{ else }}float32s{{ end }}
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
{{- include "battery-params" . }}
{{- end }}

View file

@ -34,16 +34,8 @@ params:
choice: ["little", "big"]
default: little
advanced: true
- name: capacity
advanced: true
- name: maxacpower
# battery control
- name: minsoc
type: int
advanced: true
- name: maxsoc
type: int
advanced: true
- preset: battery-params
- name: watchdog
type: duration
default: 60s
@ -90,7 +82,5 @@ render: |
address: 1042 # limit soc
type: writemultiple
encoding: {{ if (eq .endianness "big") }}float32{{ else }}float32s{{ end }}
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -26,15 +26,7 @@ params:
help:
en: ID of the LG ESS HOME inverter.
de: Nummer des LG ESS HOME Wechselrichters.
- name: capacity
advanced: true
# battery control
- name: minsoc
type: int
advanced: true
- name: maxsoc
type: int
advanced: true
- preset: battery-params
render: |
type: lgess15
usage: {{ .usage }}
@ -47,7 +39,5 @@ render: |
registration: {{ .registration }}
{{- end }}
{{- if eq .usage "battery" }}
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }}
maxsoc: {{ .maxsoc }}
{{- include "battery-params" . }}
{{- end }}

View file

@ -32,15 +32,7 @@ params:
help:
en: ID of the LG ESS HOME inverter.
de: Nummer des LG ESS HOME Wechselrichters.
- name: capacity
advanced: true
# battery control
- name: minsoc
type: int
advanced: true
- name: maxsoc
type: int
advanced: true
- preset: battery-params
render: |
type: lgess8
usage: {{ .usage }}
@ -53,7 +45,5 @@ render: |
registration: {{ .registration }}
{{- end }}
{{- if eq .usage "battery" }}
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }}
maxsoc: {{ .maxsoc }}
{{- include "battery-params" . }}
{{- end }}

View file

@ -10,13 +10,14 @@ params:
choice: ["rs485"]
baudrate: 115200
comset: 8N1
- name: maxacpower
default: 800 # W
- preset: battery-params
- name: capacity
default: 2.56
help:
de: Basisgerät 2.56 kWh, jede Erweiterung zzgl. 2.56 kWh
en: Base unit 2.56 kWh, each extension plus 2.56 kWh
- name: maxacpower
default: 800 # W
render: |
type: custom
{{- if eq .usage "pv" }}
@ -94,5 +95,5 @@ render: |
type: holding
decode: uint16
scale: -1 # Substract PV power to calc battery charge
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -11,23 +11,17 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 115200
comset: 8N1
- preset: battery-params
- name: capacity
default: 5.12
help:
de: Venus-E 5.12 kWh, Venus-C 2.56 kWh
en: Venus-E 5.12 kWh, Venus-C 2.56 kWh
- name: minsoc
default: 11
advanced: true
- name: maxsoc
default: 100
advanced: true
- name: maxchargepower
default: 2500
advanced: true
help:
en: 2500W is the maximum for Venus.
de: 2500W ist das Maximum für Venus.
- name: work_mode_normal
default: 1
advanced: true
@ -152,6 +146,4 @@ render: |
type: writesingle
decode: uint16
# Do not disable RS485 Control Mode because it will reset the device and let it charge/discharge again
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}

View file

@ -10,8 +10,7 @@ params:
- name: modbus
choice: ["rs485", "tcpip"]
id: 255
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -85,5 +84,5 @@ render: |
address: 50000
type: writesingle
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -72,6 +72,7 @@ params:
generic: ProductionActiveEnergy (Wh)
usages: ["pv"]
advanced: true
- name: maxacpower
- name: battery_power_register
type: int
default: 415
@ -120,15 +121,7 @@ params:
en: battery control API timeout
usages: ["battery"]
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: capacity
advanced: true
- name: maxchargepower
- name: maxdischargepower
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -226,11 +219,7 @@ render: |
{{- else }}
source: error
error: ErrNotAvailable
{{- end }}
{{- end }}
{{- end }}
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -34,6 +34,7 @@ params:
mask: true
default: user
advanced: true
- name: maxacpower
- name: battery
example: ess0
description:
@ -55,13 +56,7 @@ params:
en: FEMS/OpenEMS standard 60s
usages: ["battery"]
advanced: true
- name: minsoc
- name: maxsoc
- name: capacity
advanced: true
- name: maxchargepower
- name: maxdischargepower
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -168,9 +163,5 @@ render: |
error: ErrNotAvailable
{{- end }}
{{- end }}
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -16,8 +16,7 @@ params:
choice: ["tcpip"]
id: 1
port: 503
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -75,5 +74,5 @@ render: |
type: input
decode: uint16
timeout: 30s
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -40,8 +40,7 @@ params:
help:
de: Registriernummer von https://qhome-ess-g3.q-cells.eu/blue/#/inverter oder https://qhome-ess-g3.q-cells.us/blue/#/inverter hier eintragen.
en: Go to https://qhome-ess-g3.q-cells.eu/blue/#/inverter or https://qhome-ess-g3.q-cells.us/blue/#/inverter and take the value of registration number.
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
power:
@ -77,5 +76,5 @@ render: |
uri: https://qhome-ess-g3.q-cells.{{ lower .region }}/proxyApp/proxy/api/getRealtimeInfo.do?tokenId={{ urlEncode .tokenid }}&sn={{ urlEncode .serial }}
jq: .result.soc # Solax API inverter.DC.battery.energy.SOC
cache: 2m30s
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -11,28 +11,6 @@ params:
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: capacity
- name: capacity2
unit: kWh
description:
de: Akkukapazität der zweiten Batterie
en: Battery capacity of the second battery
example: 50
type: float
usages: ["battery"]
# battery control
- name: minsoc
type: int
default: 7
advanced: true
- name: maxsoc
type: int
default: 97
advanced: true
- name: cache
advanced: true
default: 30s
- name: maxchargepower
- name: externalpower
type: bool
description:
@ -43,14 +21,27 @@ params:
en: Query external power of all devices connected to S0
advanced: true
usages: ["pv"]
- preset: battery-params
- name: minsoc
default: 7
- name: maxsoc
default: 97
- name: capacity2
unit: kWh
description:
de: Akkukapazität der zweiten Batterie
en: Battery capacity of the second battery
example: 50
type: float
usages: ["battery"]
- name: cache
advanced: true
default: 30s
render: |
type: rct
uri: {{ .host }}
usage: {{ .usage }}
cache: {{ .cache }}
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
capacity2: {{ .capacity2 }} # kWh
minsoc: {{ .minsoc }}
maxsoc: {{ .maxsoc }}
maxchargepower: {{ .maxchargepower }}
externalpower: {{ .externalpower }}

View file

@ -8,17 +8,13 @@ params:
choice: ["grid", "pv", "battery"]
- name: modbus
choice: ["tcpip"]
- name: timeout
default: 5s
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0x40A1 # SmartMeterTotalGridPowerWatt (undocumented)
type: holding
@ -26,7 +22,6 @@ render: |
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0x40FD # Total_FeedInEnergy
type: holding
@ -37,7 +32,6 @@ render: |
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0x40A5 # TotalPVPower
type: holding
@ -45,7 +39,6 @@ render: |
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0x40C5 # Total PVEnergy
type: holding
@ -56,7 +49,6 @@ render: |
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0x40A6 # TotalBatteryPower
type: holding
@ -64,7 +56,6 @@ render: |
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0x40D5 # Total BatDisEnergy
type: holding
@ -73,7 +64,6 @@ render: |
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0x406F # BatEnergyPercent
type: holding
@ -91,7 +81,6 @@ render: |
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3247 # AppMode
type: writeholding
@ -105,7 +94,6 @@ render: |
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3247 # AppMode
type: writeholding
@ -119,7 +107,6 @@ render: |
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3247 # AppMode
type: writeholding
@ -129,7 +116,6 @@ render: |
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3604 # Charge time enable control
type: writeholding
@ -139,7 +125,6 @@ render: |
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3606 # Battery first charging time (start)
type: writeholding
@ -149,7 +134,6 @@ render: |
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3607 # Battery first charging time (end)
type: writeholding
@ -159,10 +143,9 @@ render: |
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3608 # Battery first charging time (power)
type: writeholding
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -13,16 +13,11 @@ params:
choice: ["rs485", "tcpip"]
baudrate: 115200
comset: 8N1
- name: capacity
advanced: true
# battery control
- name: defaultmode
default: 2
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -201,5 +196,5 @@ render: |
address: 13832 # First_charge_power_time
type: writeholding
decode: int16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -17,8 +17,7 @@ params:
choice: ["tcpip"]
port: 502
id: 64
- name: capacity
advanced: true
- preset: battery-params
- name: watchdog
type: duration
default: 240s
@ -89,5 +88,5 @@ render: |
address: 43 # 2Bh battery discharging power [W]
type: writemultiple
encoding: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -14,8 +14,7 @@ params:
allinone: true
- name: host
- name: schema
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
power:
@ -77,5 +76,5 @@ render: |
headers:
- content-type: application/json
body: '{"ENERGY":{"SAFE_CHARGE_FORCE":"u8_01"}}' # force to charge
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -13,8 +13,8 @@ params:
choice: ["rs485"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
- name: maxchargepower
default: 10000
- name: maxdischargepower
@ -23,7 +23,6 @@ params:
default: 10
- name: maxsoc
default: 100
- name: maxacpower
render: |
type: custom
{{- if eq .usage "grid" }}
@ -220,9 +219,5 @@ render: |
address: 0x214C # Time-based control Enable
type: writesingle
encoding: uint16
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -13,9 +13,8 @@ params:
choice: ["rs485"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -71,5 +70,5 @@ render: |
address: 0x3003 # Battery SOC
type: holding
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -13,10 +13,9 @@ params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: capacity
advanced: true
- name: modbus
choice: ["tcpip"]
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -54,5 +53,5 @@ render: |
address: 8 # "battery soc"
type: holding
decode: int32
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -17,14 +17,7 @@ params:
default: 502
- name: id
default: 1
- name: capacity
advanced: true
- name: minsoc
type: int
advanced: true
- name: maxsoc
type: int
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -121,7 +114,5 @@ render: |
type: writeholding
decode: uint16
scale: 10
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -15,8 +15,7 @@ params:
- name: modbus
choice: ["tcpip"]
id: 2
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "pv" }}
@ -100,5 +99,5 @@ render: |
address: 30845 # Battery Soc, %
type: holding
decode: uint32nan
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -20,9 +20,8 @@ params:
help:
en: ModbusTCP server needs to be enabled.
de: Der ModbusTCP Server muss aktiviert sein.
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
- name: maxchargepower
default: 4200
- name: watchdog
@ -376,5 +375,5 @@ render: |
address: 40801 # CmpBMS.GridWSpt - Sollwert der Netzaustauschleistung
type: writemultiple
decode: uint32
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -16,8 +16,7 @@ params:
help:
en: Password for user group Standard
de: Passwort für Benutzergruppe Benutzer
- name: capacity
advanced: true
- preset: battery-params
render: |
type: sma
uri: {{ .host }} # IP address or hostname

View file

@ -33,8 +33,6 @@ params:
type: int
default: 1
advanced: true
- name: capacity
advanced: true
- name: maxacpower
- name: defaultmode
help:
@ -43,14 +41,6 @@ params:
default: 0 # self use
advanced: true
# battery control
- name: minsoc
type: int
advanced: true
deprecated: true
- name: maxsoc
type: int
advanced: true
deprecated: true
- name: externalpower
type: bool
description:
@ -61,6 +51,7 @@ params:
en: Includes all connected external sources, like the power generation of cascaded inverters, into the PV power calculation.
advanced: true
usages: ["pv"]
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -303,5 +294,5 @@ render: |
address: 0x1187
type: writemultiple
decode: bytes
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -21,8 +21,7 @@ params:
comset: 8N1
port: 502
id: 1
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -97,5 +96,5 @@ render: |
address: 0x0210 # The residual capacity of battery
type: holding
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -20,17 +20,10 @@ params:
choice: ["tcpip", "rs485"]
id: 1
port: 1502
- name: timeout
- name: capacity
advanced: true
- name: maxacpower
- name: maxchargepower
- preset: battery-params
- name: maxdischargepower
default: 5000
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: watchdog
type: duration
default: 60s
@ -41,65 +34,54 @@ render: |
power:
source: sunspec
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:W
scale: -1
energy:
source: sunspec
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:TotWhImp
scale: 0.001
currents:
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:AphA
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:AphB
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:AphC
voltages:
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:PhVphA
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:PhVphB
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:PhVphC
powers:
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:WphA
scale: -1
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:WphB
scale: -1
- source: sunspec
{{- include "modbus" . | indent 4 }}
timeout: {{ .timeout }}
subdevice: 1 # Metering device
value: 203:WphC
scale: -1
@ -110,13 +92,11 @@ render: |
add:
- source: sunspec
{{- include "modbus" . | indent 6 }}
timeout: {{ .timeout }}
value:
- 101:DCW
- 103:DCW
- source: modbus
{{- include "modbus" . | indent 6 }}
timeout: {{ .timeout }}
register:
address: 62836 # Battery 1 Instantaneous Power
type: holding
@ -124,7 +104,6 @@ render: |
energy:
source: sunspec
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
value:
- 101:WH
- 103:WH
@ -135,7 +114,6 @@ render: |
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0xE174 # Battery 1 Instantaneous Power
type: holding
@ -144,13 +122,10 @@ render: |
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 0xE184 # Battery 1 State of Energy (SOE)
type: holding
decode: float32nans
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
batterymode:
source: watchdog
timeout: {{ .watchdog }}
@ -224,7 +199,5 @@ render: |
address: 0xE010 # StorageRemoteCtrl_DischargeLimit
type: writemultiple
encoding: float32s
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
{{- include "battery-params" . }}
{{- end }}

View file

@ -15,9 +15,8 @@ params:
- name: modbus
choice: ["tcpip"]
id: 1
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
# battery control
- name: watchdog
type: duration
@ -140,5 +139,5 @@ render: |
set:
source: error
error: ErrNotAvailable
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -15,8 +15,7 @@ params:
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -76,5 +75,5 @@ render: |
jq: >
def parseSecondNumber: sub("[^|]*\\|(?<number>[.\\d]*).*"; "\(.number)") | tonumber;
(.[] | select(.name | test("^kiwigrid_location_standard_.*_harmonized_work_released_total$")).state | parseSecondNumber / 1000) // 0
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -10,8 +10,7 @@ params:
- name: host
- name: port
default: 8080
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
power:
@ -29,5 +28,5 @@ render: |
source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .SData.SoC
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -15,8 +15,7 @@ params:
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -52,5 +51,5 @@ render: |
source: http
uri: http://{{ .host }}/rest/kiwigrid/wizard/devices # EnergyManager
jq: .result.items[] | select(.deviceModel[].deviceClass == "com.kiwigrid.devices.location.Location" ) | (.tagValues.WorkReleased.value // 0) / 1000
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -33,8 +33,7 @@ params:
help:
de: https://www.solaxcloud.com/ -> Gerät -> Wechselrichter (neue Website) oder Support (alte Website), Wert von Registrierungsnummer hier eintragen
en: https://www.solaxcloud.com/ -> Device -> Inverter (new site) or Support (old site), use the registration number
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
power:
@ -70,5 +69,5 @@ render: |
uri: https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId={{ unquote .tokenid }}&sn={{ unquote .serial }}
jq: .result.soc # Solax API inverter.DC.battery.energy.SOC
cache: 2m30s
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -28,18 +28,11 @@ params:
type: int
default: 1
advanced: true
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
- name: defaultmode
default: 0 # "SelfUse"
advanced: true
- name: maxchargepower
- name: maxdischargepower
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
render: |
type: custom
{{- if eq .usage "grid" }}
@ -125,8 +118,6 @@ render: |
# type: input
# decode: uint32s
# scale: 0.1
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
batterymode:
source: switch
switch:
@ -185,7 +176,5 @@ render: |
address: 0x001F # SolarChargeUseMode
type: writesingle
decode: uint16
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
{{- include "battery-params" . }}
{{- end }}

View file

@ -28,13 +28,8 @@ params:
choice: ["rs485"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- name: maxacpower
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -158,7 +153,5 @@ render: |
address: 43024 # Battery Reserve Mode SOC
type: writeholding
encoding: uint16
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -11,9 +11,8 @@ params:
choice: ["rs485"]
baudrate: 9600
id: 1
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -118,5 +117,5 @@ render: |
address: 33139 # Battery capacity SOC
type: input
decode: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -22,15 +22,9 @@ params:
- name: host
- name: port
default: 8080
- name: capacity
advanced: true
- preset: battery-params
- name: maxchargepower
default: 3300
- name: maxdischargepower
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: token
help:
de: API Token (benötigt für aktive Batteriesteuerung)
@ -63,8 +57,6 @@ render: |
source: http
uri: http://{{ .host }}:{{ .port }}/api/v1/status
jq: .USOC
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- if .token }}
batterymode:
source: switch
@ -136,7 +128,5 @@ render: |
- content-type: application/json
- Auth-Token: {{ .token }}
{{- end }}
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
{{- include "battery-params" . }}
{{- end }}

View file

@ -18,10 +18,7 @@ params:
- name: host
- name: port
default: 7979
- name: capacity
advanced: true
- name: maxchargepower
advanced: true
- preset: battery-params
- name: cache
advanced: true
default: 5s
@ -119,5 +116,5 @@ render: |
method: PUT
uri: http://{{ .host }}:{{ .port }}/rest/devices/battery/C24
body: {{ if .maxchargepower }}{{ .maxchargepower }}{{ else }}99000{{ end }}
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -9,8 +9,7 @@ params:
- name: modbus
choice: ["tcpip"]
id: 2
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
power:
@ -79,4 +78,4 @@ render: |
address: 126 # SXSSOC
type: input
decode: int16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}

View file

@ -16,27 +16,19 @@ params:
- name: modbus
choice: ["rs485", "tcpip"]
baudrate: 9600
- name: timeout
- name: capacity
- name: maxacpower
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- preset: battery-params
- name: maxchargepower
default: 5000
advanced: true
required: true
- name: maxdischargepower
default: 5000
advanced: true
render: |
type: custom
{{- if eq .usage "grid" }}
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
type: input
address: 13009 # Export power
@ -101,7 +93,6 @@ render: |
power:
source: modbus
{{- include "modbus" . | indent 2 }}
timeout: {{ .timeout }}
register:
address: 5016 # Total DC power
type: input
@ -280,9 +271,5 @@ render: |
address: 13051 # Battery max forced (dis)charge power
type: writesingle
decode: uint16
capacity: {{ .capacity }} # kWh
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -12,8 +12,7 @@ params:
comset: "8N1"
id: 247
port: 502
- name: capacity
advanced: true
- preset: battery-params
render: |
{{- if eq .usage "grid" }}
type: custom
@ -107,5 +106,5 @@ render: |
type: input
decode: uint16
scale: 0.1
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -10,15 +10,7 @@ params:
choice: ["battery"]
- name: modbus
choice: ["tcpip", "rs485"]
- name: capacity
advanced: true
# battery control (model 802)
- name: minsoc
type: int
advanced: true
- name: maxsoc
type: int
advanced: true
- preset: battery-params
render: |
{{- if eq .usage "battery" }}
type: custom
@ -34,7 +26,5 @@ render: |
source: sunspec
{{- include "modbus" . | indent 2 }}
value: 802:SoCRsvMin
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -11,9 +11,8 @@ params:
allinone: true
- name: modbus
choice: ["tcpip", "rs485"]
- name: capacity
advanced: true
- name: maxacpower
- preset: battery-params
render: |
type: custom
# sunspec model 203 (int+sf)/ 213 (float) meter
@ -125,5 +124,5 @@ render: |
value:
- 124:ChaState
- 802:SoC
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -12,8 +12,7 @@ params:
choice: ["tcpip", "rs485"]
- name: maxchargerate
advanced: true
- name: capacity
advanced: true
- preset: battery-params
render: |
{{- if eq .usage "battery" }}
type: custom
@ -105,5 +104,5 @@ render: |
source: sunspec
{{- include "modbus" . | indent 10 }}
value: 124:0:InOutWRte_RvrtTms
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -9,8 +9,7 @@ params:
choice: ["grid", "pv", "battery"]
- name: modbus
choice: ["tcpip", "rs485"]
- name: capacity
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -161,5 +160,5 @@ render: |
value:
- 124:ChaState
- 802:SoC
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -24,15 +24,14 @@ params:
- name: host
- name: port
default: 502
- preset: battery-params
- name: maxdischargepower
default: 4000
- name: watchdog
type: duration
default: 120s
usages: ["battery"]
advanced: true
- name: maxdischargepower
default: 4000
- name: capacity
advanced: true
render: |
type: custom
power:
@ -107,5 +106,5 @@ render: |
set:
source: error
error: ErrNotAvailable
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -15,8 +15,6 @@ params:
- name: host
- name: port
default: 502
- name: capacity
advanced: true
- name: maxacpower
- name: meterid # grid meter VRM instance
description:
@ -27,13 +25,7 @@ params:
help:
de: "Kann im VRM Portal oder im RemoteUI ausgelesen werden."
en: "Can be read out in VRM portal or via remoteUI."
# battery control
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- name: maxchargepower
- name: maxdischargepower
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -174,9 +166,5 @@ render: |
type: writesingle
decode: uint16
scale: 10
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
{{- include "battery-params" . }}
{{- end }}

View file

@ -12,12 +12,7 @@ params:
choice: ["rs485"]
port: 502
id: 255
- name: capacity
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- preset: battery-params
render: |
type: custom
{{- if eq .usage "grid" }}
@ -107,7 +102,5 @@ render: |
type: writeholding
encoding: uint16
scale: 10
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
{{- include "battery-params" . }}
{{- end }}

View file

@ -14,12 +14,7 @@ params:
choice: ["rs485"]
port: 502
id: 247
- name: capacity
advanced: true
- name: minsoc
advanced: true
- name: maxsoc
advanced: true
- preset: battery-params
- name: delay
default: 100ms
advanced: true
@ -121,5 +116,5 @@ render: |
address: 52503 # min soc
type: writeholding
encoding: uint16
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -9,8 +9,7 @@ params:
choice: ["battery"]
- name: host
required: true
- name: capacity
required: true
- preset: battery-params
- name: cache
advanced: true
default: 1s
@ -26,4 +25,4 @@ render: |
uri: http://{{ .host }}/properties/report
jq: .properties.electricLevel
cache: {{ .cache }}
capacity: {{ .capacity }}
{{- include "battery-params" . }}

View file

@ -11,6 +11,7 @@ params:
default: 1.92 # kWh
- name: maxacpower
default: 800 # W
- preset: battery-params
- name: cache
advanced: true
default: 1s
@ -42,5 +43,5 @@ render: |
uri: http://{{ .host }}/properties/report
jq: .properties.electricLevel
cache: {{ .cache }}
capacity: {{ .capacity }} # kWh
{{- include "battery-params" . }}
{{- end }}

View file

@ -701,6 +701,13 @@ presets:
de: Akzeptiere keine Daten die älter sind als dieser Wert
en: Don't accept values older than this value
battery-params:
- name: capacity
- name: minsoc
- name: maxsoc
- name: maxchargepower
- name: maxdischargepower
modbus:
interfaces:
rs485: ["rs485serial", "rs485tcpip"]

View file

@ -0,0 +1,7 @@
{{ define "battery-params" }}
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
maxchargepower: {{ .maxchargepower }} # W
maxdischargepower: {{ .maxdischargepower }} # W
{{- end }}