From e85bbfafcf4549a557572e84ecf0c8bbdc939dff Mon Sep 17 00:00:00 2001 From: premultiply <4681172+premultiply@users.noreply.github.com> Date: Mon, 31 Oct 2022 11:37:40 +0100 Subject: [PATCH] SolarEdge: fix modbus config and add rs485 (#4990) --- .../definition/meter/solaredge-hybrid.yaml | 29 +++----- .../definition/meter/solaredge-inverter.yaml | 8 ++- templates/docs/meter/solaredge-hybrid_0.yaml | 71 ++++++++++++++++--- .../docs/meter/solaredge-inverter_0.yaml | 28 ++++++++ 4 files changed, 106 insertions(+), 30 deletions(-) diff --git a/templates/definition/meter/solaredge-hybrid.yaml b/templates/definition/meter/solaredge-hybrid.yaml index 1da029919..de21f2642 100644 --- a/templates/definition/meter/solaredge-hybrid.yaml +++ b/templates/definition/meter/solaredge-hybrid.yaml @@ -5,29 +5,26 @@ products: generic: Hybrid Inverter requirements: description: - de: Nur ein System kann auf den Wechselrichter zugreifen! + de: Nur ein System kann und darf auf den Wechselrichter zugreifen! en: Only one system may access the inverter! params: - name: usage choice: ["grid", "pv", "battery"] allinone: true - - name: host - - name: port - default: 502 - help: - en: Port 502 (SetApp) or 1502 (LCD) - de: Port 502 (SetApp) oder 1502 (LCD) + - name: modbus + choice: ["tcpip", "rs485"] + id: 1 + port: 1502 - name: timeout render: | type: custom power: {{- if eq .usage "grid" }} source: modbus - uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) - id: 1 - subdevice: 1 # Metering device + {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} model: sunspec + subdevice: 1 # Metering device value: 203:W scale: -1 {{- end }} @@ -35,14 +32,12 @@ render: | source: calc add: - source: modbus - uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) - id: 1 + {{- include "modbus" . | indent 4 }} timeout: {{ .timeout }} model: sunspec value: DCPower - source: modbus - uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) - id: 1 + {{- include "modbus" . | indent 4 }} timeout: {{ .timeout }} register: address: 62836 # Battery 1 Instantaneous Power @@ -51,9 +46,8 @@ render: | {{- end }} {{- if eq .usage "battery" }} source: modbus + {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} - uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) - id: 1 register: address: 62836 # Battery 1 Instantaneous Power type: holding @@ -61,9 +55,8 @@ render: | scale: -1 soc: source: modbus + {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} - uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) - id: 1 register: address: 62852 # Battery 1 State of Energy (SOE) type: holding diff --git a/templates/definition/meter/solaredge-inverter.yaml b/templates/definition/meter/solaredge-inverter.yaml index fe3d2e029..95589c587 100644 --- a/templates/definition/meter/solaredge-inverter.yaml +++ b/templates/definition/meter/solaredge-inverter.yaml @@ -4,12 +4,16 @@ products: description: de: Wechselrichter en: Inverter +requirements: + description: + de: Nur ein System kann und darf auf den Wechselrichter zugreifen! + en: Only one system may access the inverter! params: - name: usage choice: ["grid", "pv"] allinone: true - name: modbus - choice: ["tcpip"] + choice: ["tcpip", "rs485"] id: 1 port: 1502 - name: timeout @@ -20,8 +24,8 @@ render: | {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} {{- if eq .usage "grid" }} - subdevice: 1 model: sunspec + subdevice: 1 value: 203:W # sunspec 3-phase meter power reading scale: -1 {{- else }} diff --git a/templates/docs/meter/solaredge-hybrid_0.yaml b/templates/docs/meter/solaredge-hybrid_0.yaml index d2575d76e..6ab37fc44 100644 --- a/templates/docs/meter/solaredge-hybrid_0.yaml +++ b/templates/docs/meter/solaredge-hybrid_0.yaml @@ -2,29 +2,80 @@ product: brand: SolarEdge description: Hybrid Inverter description: | - Nur ein System kann auf den Wechselrichter zugreifen! + Nur ein System kann und darf auf den Wechselrichter zugreifen! render: - usage: grid default: | type: template template: solaredge-hybrid - usage: grid - host: 192.0.2.2 # IP-Adresse oder Hostname - port: 502 # Port 502 (SetApp) oder 1502 (LCD) # Optional + usage: grid + + # RS485 via adapter (Modbus RTU) + modbus: rs485serial + id: 1 + device: /dev/ttyUSB0 # USB-RS485 Adapter Adresse + baudrate: 9600 # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200 + comset: "8N1" # Kommunikationsparameter für den Adapter + + # RS485 via TCP/IP (Modbus RTU) + modbus: rs485tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port + + # Modbus TCP + modbus: tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port timeout: 10s # Optional - usage: pv default: | type: template template: solaredge-hybrid - usage: pv - host: 192.0.2.2 # IP-Adresse oder Hostname - port: 502 # Port 502 (SetApp) oder 1502 (LCD) # Optional + usage: pv + + # RS485 via adapter (Modbus RTU) + modbus: rs485serial + id: 1 + device: /dev/ttyUSB0 # USB-RS485 Adapter Adresse + baudrate: 9600 # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200 + comset: "8N1" # Kommunikationsparameter für den Adapter + + # RS485 via TCP/IP (Modbus RTU) + modbus: rs485tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port + + # Modbus TCP + modbus: tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port timeout: 10s # Optional - usage: battery default: | type: template template: solaredge-hybrid - usage: battery - host: 192.0.2.2 # IP-Adresse oder Hostname - port: 502 # Port 502 (SetApp) oder 1502 (LCD) # Optional + usage: battery + + # RS485 via adapter (Modbus RTU) + modbus: rs485serial + id: 1 + device: /dev/ttyUSB0 # USB-RS485 Adapter Adresse + baudrate: 9600 # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200 + comset: "8N1" # Kommunikationsparameter für den Adapter + + # RS485 via TCP/IP (Modbus RTU) + modbus: rs485tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port + + # Modbus TCP + modbus: tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port timeout: 10s # Optional diff --git a/templates/docs/meter/solaredge-inverter_0.yaml b/templates/docs/meter/solaredge-inverter_0.yaml index a4dbc137c..027fa4180 100644 --- a/templates/docs/meter/solaredge-inverter_0.yaml +++ b/templates/docs/meter/solaredge-inverter_0.yaml @@ -1,6 +1,8 @@ product: brand: SolarEdge description: Wechselrichter +description: | + Nur ein System kann und darf auf den Wechselrichter zugreifen! render: - usage: grid default: | @@ -8,6 +10,19 @@ render: template: solaredge-inverter usage: grid + # RS485 via adapter (Modbus RTU) + modbus: rs485serial + id: 1 + device: /dev/ttyUSB0 # USB-RS485 Adapter Adresse + baudrate: 9600 # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200 + comset: "8N1" # Kommunikationsparameter für den Adapter + + # RS485 via TCP/IP (Modbus RTU) + modbus: rs485tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port + # Modbus TCP modbus: tcpip id: 1 @@ -20,6 +35,19 @@ render: template: solaredge-inverter usage: pv + # RS485 via adapter (Modbus RTU) + modbus: rs485serial + id: 1 + device: /dev/ttyUSB0 # USB-RS485 Adapter Adresse + baudrate: 9600 # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200 + comset: "8N1" # Kommunikationsparameter für den Adapter + + # RS485 via TCP/IP (Modbus RTU) + modbus: rs485tcpip + id: 1 + host: 192.0.2.2 # Hostname + port: 1502 # Port + # Modbus TCP modbus: tcpip id: 1