evcc-io/templates/definition/meter/solaredge-hybrid.yaml

327 lines
9.6 KiB
YAML

template: solaredge-hybrid
products:
- brand: SolarEdge
description:
generic: Hybrid Inverter
capabilities: ["battery-control"]
requirements:
description:
de: |
Nur ein System kann und darf zeitgleich eine Modbus TCP-Verbindung zum Wechselrichter haben!
Für die optionale Batteriesteuerung muss StorageConf_CtrlMode (0xE004) auf 4 "Remote" stehen.
Curtailment begrenzt die Einspeiseleistung auf den gewünschten Prozentsatz der maximalen AC-Leistung. Der Wechselrichter begrenzt automatisch die PV-Leistung, um dies zu erreichen.
en: |
Only one system can and may have a Modbus TCP connection to the inverter at the same time!
For optional battery control, StorageConf_CtrlMode (0xE004) must be set to 4 "Remote".
Curtailment will limit the export power to the desired percentage of the maximum AC power. The inverter will automatically limit the PV power to achieve this.
params:
- name: usage
choice: ["grid", "pv", "battery"]
- name: modbus
choice: ["tcpip", "rs485"]
id: 1
port: 1502
- name: maxacpower
required: true
- preset: battery-params
- name: maxdischargepower
default: 5000
- name: watchdog
default: 60s
- name: timeout
deprecated: true
render: |
type: custom
{{- if eq .usage "grid" }}
power:
source: sunspec
{{- include "modbus" . | indent 2 }}
subdevice: 1 # Metering device
value: 203:W
scale: -1
energy:
source: sunspec
{{- include "modbus" . | indent 2 }}
subdevice: 1 # Metering device
value: 203:TotWhImp
scale: 0.001
returnenergy:
source: sunspec
{{- include "modbus" . | indent 2 }}
subdevice: 1 # Metering device
value: 203:TotWhExp
scale: 0.001
currents:
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:AphA
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:AphB
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:AphC
voltages:
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:PhVphA
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:PhVphB
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:PhVphC
powers:
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:WphA
scale: -1
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:WphB
scale: -1
- source: sunspec
{{- include "modbus" . | indent 4 }}
subdevice: 1 # Metering device
value: 203:WphC
scale: -1
{{- end }}
{{- if eq .usage "pv" }}
power:
source: calc
add:
- source: sunspec
{{- include "modbus" . | indent 6 }}
value:
- 101:DCW
- 103:DCW
- source: modbus
{{- include "modbus" . | indent 6 }}
register:
address: 0xE174 # Battery 1 Instantaneous Power
type: holding
decode: float32nans
{{- include "sunspec-maxacpower" . }}
curtail:
source: sequence
set:
- source: switch
switch:
- case: 100
set:
source: go
in:
- name: mode
type: int
config:
source: modbus
{{- include "modbus" . | indent 18 }}
register:
address: 57344 # Export Control Mode
type: holding
decode: uint16
out:
- name: out
type: int
config:
source: modbus
{{- include "modbus" . | indent 18 }}
register:
address: 57344 # Export Control Mode
type: writesingle
encoding: uint16
script: |
mode &^ 1 // clear bit 0 (export limitation), preserve other bits (e.g. indirect production limitation)
default:
source: go
in:
- name: mode
type: int
config:
source: modbus
{{- include "modbus" . | indent 14 }}
register:
address: 57344 # Export Control Mode
type: holding
decode: uint16
out:
- name: out
type: int
config:
source: modbus
{{- include "modbus" . | indent 14 }}
register:
address: 57344 # Export Control Mode
type: writesingle
encoding: uint16
script: |
mode | 1 // set bit 0 (export limitation via meter), preserve other bits
- source: const
value: 0 # Total
set:
source: modbus
{{- include "modbus" . | indent 8 }}
register:
address: 57345 # Export Control Limit Mode
type: writesingle
encoding: uint16
- source: modbus
{{- include "modbus" . | indent 6 }}
register:
address: 57346 # Export Control Site Limit
type: writemultiple
encoding: float32s
scale: {{ divf (maxf .maxacpower 1) 100 }} # % to W
curtailed:
source: go
in:
- name: mode
type: int
config:
source: modbus
{{- include "modbus" . | indent 8 }}
register:
address: 57344 # Export Control Mode
type: holding
decode: uint16
- name: limit
type: float
config:
source: modbus
{{- include "modbus" . | indent 8 }}
register:
address: 57346 # Export Control Site Limit
type: holding
decode: float32s
script: |
percent := 100.0
if mode&1 != 0 {
percent = limit * 100 / {{ maxf .maxacpower 1 }}
}
p := int(percent + 0.5)
if p < 0 {
p = 0
}
if p > 100 {
p = 100
}
p
{{- end }}
{{- if eq .usage "battery" }}
power:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 0xE174 # Battery 1 Instantaneous Power
type: holding
decode: float32nans
scale: -1
soc:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 0xE184 # Battery 1 State of Energy (SOE)
type: holding
decode: float32nans
energy:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 0xE176 # Battery 1 Lifetime Export Energy Counter (discharged)
type: holding
decode: uint64snan
scale: 0.001
returnenergy:
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 0xE17A # Battery 1 Lifetime Import Energy Counter (charged)
type: holding
decode: uint64snan
scale: 0.001
batterymode:
source: watchdog
timeout: {{ .watchdog }}
reset: 1 # reset watchdog on normal
set:
source: switch
switch:
- case: 1 # normal
set:
source: sequence
set:
- source: const
value: 7 # Maximize self-consumption
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 0xE00D # StorageRemoteCtrl_CommandMode
type: writesingle
encoding: uint16
- source: const
value: {{ .maxdischargepower }} # W
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 0xE010 # StorageRemoteCtrl_DischargeLimit
type: writemultiple
encoding: float32s
- case: 2 # hold
set:
source: sequence
set:
- source: const
value: 7 # Maximize self-consumption
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 0xE00D # StorageRemoteCtrl_CommandMode
type: writesingle
encoding: uint16
- source: const
value: 0 # W
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 0xE010 # StorageRemoteCtrl_DischargeLimit
type: writemultiple
encoding: float32s
- case: 3 # charge
set:
source: sequence
set:
- source: const
value: 3 # Charge from PV+AC according to the max battery power
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 0xE00D # StorageRemoteCtrl_CommandMode
type: writesingle
encoding: uint16
- source: const
value: 0 # W
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 0xE010 # StorageRemoteCtrl_DischargeLimit
type: writemultiple
encoding: float32s
default:
source: error
error: ErrNotAvailable
{{- include "battery-params" . }}
{{- end }}