Skip to content

Commit

Permalink
SMA Modbus: split templates (#11909)
Browse files Browse the repository at this point in the history
  • Loading branch information
premultiply authored Jan 28, 2024
1 parent 9517277 commit 2d16052
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 65 deletions.
2 changes: 1 addition & 1 deletion templates/definition/meter/sma-hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ render: |
decode: uint32nan
batterymode:
source: watchdog
timeout: {{ .watchdog }} # re-write at timeout/2
timeout: {{ .watchdog }}
reset: 1 # reset watchdog on normal
set:
source: switch
Expand Down
66 changes: 2 additions & 64 deletions templates/definition/meter/sma-inverter-modbus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@ template: sma-inverter-modbus
products:
- brand: SMA
description:
generic: Sunny Island (Modbus)
- brand: SMA
description:
generic: Sunny Boy Storage (Modbus)
capabilities: ["battery-control"]
generic: Wechselrichter (Modbus)
params:
- name: usage
choice: ["battery"]
choice: ["pv"]
- name: modbus
choice: ["tcpip"]
port: 502
id: 3
help:
en: The Modbus TCP-Server needs to be enabled on this inverter
de: Der Modbus TCP-Server muss an diesem Wechselrichter aktiviert sein
- name: capacity
advanced: true
- name: watchdog
type: duration
default: 60s
advanced: true
render: |
type: custom
power:
Expand All @@ -40,55 +30,3 @@ render: |
type: holding
decode: uint64nan
scale: 0.001
{{- if eq .usage "battery" }}
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30845 # SMA Modbus Profile: Bat.ChaStt
type: holding
decode: uint32nan
batterymode:
source: watchdog
timeout: {{ .watchdog }} # re-write at timeout/2
reset: 1 # reset watchdog on normal
set:
source: switch
switch:
- case: 1 # normal
set:
source: const
value: 10000 # Maximale Wirkleistung
set:
source: modbus
{{- include "modbus" . | indent 10 }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
- case: 2 # hold
set:
source: const
value: 0 # Maximale Wirkleistung
set:
source: modbus
{{- include "modbus" . | indent 10 }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
- case: 3 # charge
set:
source: const
value: -10000 # Maximale Wirkleistung
set:
source: modbus
{{- include "modbus" . | indent 10 }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
89 changes: 89 additions & 0 deletions templates/definition/meter/sma-sbs-modbus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
template: sma-sbs-modbus
products:
- brand: SMA
description:
generic: Sunny Boy Storage (Modbus)
capabilities: ["battery-control"]
params:
- name: usage
choice: ["battery"]
- name: modbus
choice: ["tcpip"]
port: 502
id: 3
help:
en: The Modbus TCP-Server needs to be enabled on this inverter
de: Der Modbus TCP-Server muss an diesem Wechselrichter aktiviert sein
- name: capacity
advanced: true
- name: watchdog
type: duration
default: 60s
advanced: true
render: |
type: custom
power:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30775 # SMA Modbus Profile: GridMs.TotW
type: input
decode: int32nan
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30513 # SMA Modbus Profile: Metering.TotWhOut
type: holding
decode: uint64nan
scale: 0.001
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30845 # SMA Modbus Profile: Bat.ChaStt
type: holding
decode: uint32nan
batterymode:
source: watchdog
timeout: {{ .watchdog }}
reset: 1 # reset watchdog on normal
set:
source: switch
switch:
- case: 1 # normal
set:
source: const
value: 10000 # Maximale Wirkleistung 100.00%
set:
source: modbus
{{- include "modbus" . | indent 10 }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
- case: 2 # hold
set:
source: const
value: 0 # Maximale Wirkleistung 0.00%
set:
source: modbus
{{- include "modbus" . | indent 10 }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
- case: 3 # charge
set:
source: const
value: -10000 # Maximale Wirkleistung -100.00%
set:
source: modbus
{{- include "modbus" . | indent 10 }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
111 changes: 111 additions & 0 deletions templates/definition/meter/sma-si-modbus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
template: sma-si-modbus
products:
- brand: SMA
description:
generic: Sunny Island (Modbus)
capabilities: ["battery-control"]
params:
- name: usage
choice: ["battery"]
- name: modbus
choice: ["tcpip"]
port: 502
id: 3
help:
en: The Modbus TCP-Server needs to be enabled on this inverter
de: Der Modbus TCP-Server muss an diesem Wechselrichter aktiviert sein
- name: capacity
advanced: true
- name: watchdog
type: duration
default: 60s
advanced: true
render: |
type: custom
power:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30775 # SMA Modbus Profile: GridMs.TotW
type: input
decode: int32nan
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30513 # SMA Modbus Profile: Metering.TotWhOut
type: holding
decode: uint64nan
scale: 0.001
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30845 # SMA Modbus Profile: Bat.ChaStt
type: holding
decode: uint32nan
batterymode:
source: watchdog
timeout: {{ .watchdog }}
reset: 1 # reset watchdog on normal
set:
source: switch
switch:
- case: 1 # normal
set:
source: const
value: 803 # inaktiv (Ina)
set:
source: modbus
{{- include "modbus" . | indent 10 }}
register:
address: 40151 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WCtlComAct
type: writemultiple
decode: uint32
- case: 2 # hold
set:
source: sequence
set:
- source: const
value: 0 # Wirkleistungsvorgabe
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 40149 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSpt
type: writemultiple
decode: int32
- source: const
value: 802 # aktiv (Act)
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 40151 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WCtlComAct
type: writemultiple
decode: uint32
- case: 3 # charge
set:
source: sequence
set:
- source: const
value: -2147483648 # Wirkleistungsvorgabe
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 40149 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSpt
type: writemultiple
decode: int32
- source: const
value: 802 # aktiv (Act)
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 40151 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WCtlComAct
type: writemultiple
decode: uint32
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}

0 comments on commit 2d16052

Please sign in to comment.