diff --git a/api/batterymode.go b/api/batterymode.go index 4ca00b3f120..f155893e98e 100644 --- a/api/batterymode.go +++ b/api/batterymode.go @@ -9,4 +9,5 @@ const ( BatteryNormal BatteryHold BatteryCharge + BatteryNoCharge ) diff --git a/api/batterymode_enumer.go b/api/batterymode_enumer.go index 7fe4dbc6702..10cccb5ba58 100644 --- a/api/batterymode_enumer.go +++ b/api/batterymode_enumer.go @@ -7,11 +7,11 @@ import ( "strings" ) -const _BatteryModeName = "unknownnormalholdcharge" +const _BatteryModeName = "unknownnormalholdchargenocharge" -var _BatteryModeIndex = [...]uint8{0, 7, 13, 17, 23} +var _BatteryModeIndex = [...]uint8{0, 7, 13, 17, 23, 31} -const _BatteryModeLowerName = "unknownnormalholdcharge" +const _BatteryModeLowerName = "unknownnormalholdchargenocharge" func (i BatteryMode) String() string { if i < 0 || i >= BatteryMode(len(_BatteryModeIndex)-1) { @@ -28,9 +28,10 @@ func _BatteryModeNoOp() { _ = x[BatteryNormal-(1)] _ = x[BatteryHold-(2)] _ = x[BatteryCharge-(3)] + _ = x[BatteryNoCharge-(4)] } -var _BatteryModeValues = []BatteryMode{BatteryUnknown, BatteryNormal, BatteryHold, BatteryCharge} +var _BatteryModeValues = []BatteryMode{BatteryUnknown, BatteryNormal, BatteryHold, BatteryCharge, BatteryNoCharge} var _BatteryModeNameToValueMap = map[string]BatteryMode{ _BatteryModeName[0:7]: BatteryUnknown, @@ -41,6 +42,8 @@ var _BatteryModeNameToValueMap = map[string]BatteryMode{ _BatteryModeLowerName[13:17]: BatteryHold, _BatteryModeName[17:23]: BatteryCharge, _BatteryModeLowerName[17:23]: BatteryCharge, + _BatteryModeName[23:31]: BatteryNoCharge, + _BatteryModeLowerName[23:31]: BatteryNoCharge, } var _BatteryModeNames = []string{ @@ -48,6 +51,7 @@ var _BatteryModeNames = []string{ _BatteryModeName[7:13], _BatteryModeName[13:17], _BatteryModeName[17:23], + _BatteryModeName[23:31], } // BatteryModeString retrieves an enum value from the enum constants string name. diff --git a/meter/e3dc.go b/meter/e3dc.go index 925d9560f6c..6fd2b14abb5 100644 --- a/meter/e3dc.go +++ b/meter/e3dc.go @@ -227,6 +227,11 @@ func (m *E3dc) setBatteryMode(mode api.BatteryMode) error { e3dcDischargeBatteryLimit(false, 0), e3dcBatteryCharge(50000), // max. 50kWh } + case api.BatteryNoCharge: + messages = []rscp.Message{ + e3dcDischargeBatteryLimit(false, 0), + e3dcBatteryCharge(0), + } default: return api.ErrNotAvailable } diff --git a/meter/usage_battery.go b/meter/usage_battery.go index 9cf56337bc2..93ce1264164 100644 --- a/meter/usage_battery.go +++ b/meter/usage_battery.go @@ -68,6 +68,9 @@ func (m *batterySocLimits) LimitController(socG func() (float64, error), limitSo case api.BatteryCharge: return limitSocS(m.MaxSoc) + case api.BatteryNoCharge: + return limitSocS(m.MinSoc) + default: return api.ErrNotAvailable } diff --git a/templates/definition/meter/fronius-gen24.yaml b/templates/definition/meter/fronius-gen24.yaml index 6a97859c190..500ac4e8727 100644 --- a/templates/definition/meter/fronius-gen24.yaml +++ b/templates/definition/meter/fronius-gen24.yaml @@ -248,5 +248,23 @@ render: | uri: {{ .host }}:{{ .port }} id: 1 value: 124:0:OutWRte + - case: 4 # nocharge + set: + source: sequence + set: + - source: const + value: 1 + set: + source: sunspec + uri: {{ .host }}:{{ .port }} + id: 1 + value: 124:0:StorCtl_Mod + - source: const + value: 0 # % + set: + source: sunspec + uri: {{ .host }}:{{ .port }} + id: 1 + value: 124:0:InWRte {{- include "battery-params" . }} {{- end }} diff --git a/templates/definition/meter/fronius-solarapi-v1.yaml b/templates/definition/meter/fronius-solarapi-v1.yaml index d620889eb04..98a3eb569f8 100644 --- a/templates/definition/meter/fronius-solarapi-v1.yaml +++ b/templates/definition/meter/fronius-solarapi-v1.yaml @@ -110,6 +110,10 @@ render: | body: '{"timeofuse":[]}' - source: error error: ErrNotAvailable + - case: 4 # nocharge (not implemented) + set: + source: error + error: ErrNotAvailable {{- end }} {{- include "battery-params" . }} {{- end }} diff --git a/templates/definition/meter/fronius-vertoplus.yaml b/templates/definition/meter/fronius-vertoplus.yaml index 77cca6b3e5a..d3a3b1c8b66 100644 --- a/templates/definition/meter/fronius-vertoplus.yaml +++ b/templates/definition/meter/fronius-vertoplus.yaml @@ -244,5 +244,23 @@ render: | uri: {{ .host }}:{{ .port }} id: 1 value: 124:0:OutWRte + - case: 4 # nocharge + set: + source: sequence + set: + - source: const + value: 1 + set: + source: sunspec + uri: {{ .host }}:{{ .port }} + id: 1 + value: 124:0:StorCtl_Mod + - source: const + value: 0 # % + set: + source: sunspec + uri: {{ .host }}:{{ .port }} + id: 1 + value: 124:0:InWRte {{- include "battery-params" . }} {{- end }} diff --git a/templates/definition/meter/sunspec-inverter-control.yaml b/templates/definition/meter/sunspec-inverter-control.yaml index a7d4f871730..b30c1896308 100644 --- a/templates/definition/meter/sunspec-inverter-control.yaml +++ b/templates/definition/meter/sunspec-inverter-control.yaml @@ -104,5 +104,27 @@ render: | source: sunspec {{- include "modbus" . | indent 10 }} value: 124:0:InOutWRte_RvrtTms + - case: 4 # nocharge + set: + source: sequence + set: + - source: const + value: 1 + set: + source: sunspec + {{- include "modbus" . | indent 10 }} + value: 124:0:StorCtl_Mod + - source: const + value: 0 # % + set: + source: sunspec + {{- include "modbus" . | indent 10 }} + value: 124:0:InWRte + - source: const + value: 0 # s + set: + source: sunspec + {{- include "modbus" . | indent 10 }} + value: 124:0:InOutWRte_RvrtTms {{- include "battery-params" . }} {{- end }}