MBMD: add returnEnergy support (#30514)
This commit is contained in:
parent
380416e3e1
commit
aaed8c24a3
24 changed files with 56 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ func NewMbmdFromConfig(ctx context.Context, other map[string]any) (api.Meter, er
|
|||
batterySocLimits `mapstructure:",squash"`
|
||||
modbus.Settings `mapstructure:",squash"`
|
||||
Power, Energy, Soc string
|
||||
ReturnEnergy string
|
||||
Currents []string
|
||||
Voltages []string
|
||||
Powers []string
|
||||
|
|
@ -103,6 +104,15 @@ func NewMbmdFromConfig(ctx context.Context, other map[string]any) (api.Meter, er
|
|||
implement.Has(m, implement.MeterEnergy(totalEnergy))
|
||||
}
|
||||
|
||||
// decorate return energy
|
||||
if cc.ReturnEnergy != "" {
|
||||
returnEnergy, err := mbmd.deviceOp(ops, cc.ReturnEnergy)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid measurement for returnenergy: %s", cc.ReturnEnergy)
|
||||
}
|
||||
implement.Has(m, implement.MeterReturnEnergy(returnEnergy))
|
||||
}
|
||||
|
||||
// decorate soc
|
||||
if cc.Soc != "" {
|
||||
soc, err := mbmd.deviceOp(ops, cc.Soc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue