SMA: add battery control (#11368)
Some checks failed
Release / Demo (push) Has been cancelled
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Github & APT (push) Has been cancelled
Release / Hassio Addon (push) Has been cancelled

This commit is contained in:
andig 2024-01-07 10:10:33 +01:00 • committed by GitHub
parent b6bfb1a1dd
commit 3ba0c8d171
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 229 additions and 34 deletions

View file

@ -1,6 +1,5 @@
template: sma-data-manager
covers:
- sma-data-manager-m-lite
covers: ["sma-data-manager-m-lite"]
products:
- brand: SMA
description:

View file

@ -18,7 +18,10 @@ linked:
- template: sma-hybrid
usage: battery
multiple: true
- template: sma-inverter
- template: sma-inverter-speedwire
usage: battery
multiple: true
- template: sma-inverter-modbus
usage: battery
multiple: true
params:

View file

@ -4,6 +4,7 @@ products:
description:
de: Smart Energy Hybrid-Wechselrichter
en: Smart Energy Hybrid Inverter
capabilities: ["battery-control"]
params:
- name: usage
choice: ["pv", "battery"]
@ -17,50 +18,144 @@ params:
de: Der Modbus TCP-Server muss an diesem Smart Energy Wechselrichter aktiviert sein
- name: capacity
advanced: true
- name: watchdog
type: duration
default: 60s
advanced: true
render: |
type: custom
power:
{{- if eq .usage "pv" }}
power:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30773 # SMA Modbus Profile: DcMs.Watt
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
{{- end }}
{{- if eq .usage "battery" }}
power:
source: calc
add:
- source: modbus
{{- include "modbus" . | indent 6 }}
register: # manual non-sunspec register configuration
address: 30773 # SMA Modbus Profile: DC power input [1]
type: holding
decode: int32nan
- source: modbus
{{- include "modbus" . | indent 6 }}
register: # manual non-sunspec register configuration
address: 30961 # SMA Modbus Profile: DC power input [2]
type: holding
decode: int32nan
{{- end }}
{{- if eq .usage "battery" }}
source: calc
mul:
- source: modbus
{{- include "modbus" . | indent 6 }}
register: # manual non-sunspec register configuration
address: 30851 # SMA Modbus Profile: Battery voltage
type: holding
register:
address: 31395 # SMA Modbus Profile: BatDsch.CurBatDsch
type: input
decode: uint32nan
scale: 0.01
- source: modbus
{{- include "modbus" . | indent 6 }}
register: # manual non-sunspec register configuration
address: 30843 # SMA Modbus Profile: Battery current
type: holding
decode: int32nan
scale: 0.001
register:
address: 31393 # SMA Modbus Profile: BatChrg.CurBatCha
type: input
decode: uint32nan
scale: -1
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 31401 # SMA Modbus Profile: CmpBMS.GetBatDschWh
type: holding
decode: uint64nan
scale: 0.001
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
register: # manual non-sunspec register configuration
address: 30845 # SMA Modbus Profile: Battery state of charge
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 }}
timeout: {{ .timeout }}
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 }}
timeout: {{ .timeout }}
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 }}
timeout: {{ .timeout }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
{{- if eq .usage "grid" }}
power:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30865 # SMA Modbus Profile: Metering.GridMs.TotWIn
type: input
decode: int32nan
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 30581 # SMA Modbus Profile: Metering.GridMs.TotWhIn
type: holding
decode: int32nan
scale: 0.001
currents:
- source: modbus
{{- include "modbus" . | indent 4 }}
register:
address: 31435 # SMA Modbus Profile: Metering.GridMs.A.phsA
type: input
decode: int32nan
scale: 0.001
- source: modbus
{{- include "modbus" . | indent 4 }}
register:
address: 31437 # SMA Modbus Profile: Metering.GridMs.A.phsB
type: input
decode: int32nan
scale: 0.001
- source: modbus
{{- include "modbus" . | indent 4 }}
register:
address: 31439 # SMA Modbus Profile: Metering.GridMs.A.phsC
type: input
decode: int32nan
scale: 0.001
{{- end }}

View file

@ -0,0 +1,97 @@
template: sma-inverter-modbus
products:
- brand: SMA
description:
generic: Sunny Island (Modbus)
- 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
{{- 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 }}
timeout: {{ .timeout }}
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 }}
timeout: {{ .timeout }}
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 }}
timeout: {{ .timeout }}
register:
address: 44039 # SMA Modbus Profile: Inverter.WModCfg.WCtlComCfg.WSptMaxNom
type: writemultiple
decode: int32
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}

View file

@ -1,9 +1,10 @@
template: sma-inverter
template: sma-inverter-speedwire
covers: ["sma-inverter"]
products:
- brand: SMA
description:
de: Wechselrichter
en: Inverter
de: Wechselrichter (Speedwire)
en: Inverter (Speedwire)
params:
- name: usage
choice: ["pv", "battery"]