From caf366bd345c9ef2bcdd36671aa63262e83b72bd Mon Sep 17 00:00:00 2001 From: fanatix <43752712+djfanatix@users.noreply.github.com> Date: Mon, 27 Jul 2026 10:50:53 +0200 Subject: [PATCH] Solaredge: add curtailment (#31982) --- .../definition/meter/solaredge-hybrid.yaml | 107 ++++++++++++++++++ .../definition/meter/solaredge-inverter.yaml | 38 +++++++ 2 files changed, 145 insertions(+) diff --git a/templates/definition/meter/solaredge-hybrid.yaml b/templates/definition/meter/solaredge-hybrid.yaml index 650b58552..9dcfb0a2c 100644 --- a/templates/definition/meter/solaredge-hybrid.yaml +++ b/templates/definition/meter/solaredge-hybrid.yaml @@ -9,9 +9,11 @@ requirements: 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"] @@ -20,6 +22,7 @@ params: id: 1 port: 1502 - name: maxacpower + required: true - preset: battery-params - name: maxdischargepower default: 5000 @@ -107,6 +110,110 @@ render: | type: holding decode: float32nans maxacpower: {{ .maxacpower }} # W + 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: diff --git a/templates/definition/meter/solaredge-inverter.yaml b/templates/definition/meter/solaredge-inverter.yaml index a5c6a90fe..6dde3d676 100644 --- a/templates/definition/meter/solaredge-inverter.yaml +++ b/templates/definition/meter/solaredge-inverter.yaml @@ -4,6 +4,8 @@ products: description: de: Wechselrichter en: Inverter +capabilities: + - curtail requirements: description: de: Nur ein System kann und darf auf den Wechselrichter zugreifen! @@ -111,4 +113,40 @@ render: | value: - 101:AphC - 103:AphC + curtail: + source: sequence + set: + - source: modbus + {{- include "modbus" . | indent 6 }} + register: + address: 61441 # Active Power Limit (%) + type: writesingle + encoding: uint16 + - source: const + value: 1 + set: + source: modbus + {{- include "modbus" . | indent 8 }} + register: + address: 61696 # Commit Power Control Settings + type: writesingle + encoding: uint16 + curtailed: + source: go + in: + - name: limit + type: int + config: + source: modbus + {{- include "modbus" . | indent 8 }} + register: + address: 61441 # Active Power Limit (%) + type: holding + decode: uint16 + script: | + percent := int(limit) + if percent > 100 { + percent = 100 + } + percent {{- end }}