From 7047a11db0563ca3874b1a2b440a8f5bce5929b1 Mon Sep 17 00:00:00 2001 From: andig Date: Wed, 10 Aug 2022 19:28:56 +0200 Subject: [PATCH] Improve SunSpec config (#4093) --- templates/definition/meter/fronius-gen24.yaml | 12 ++++++------ templates/definition/meter/kostal-ksem.yaml | 2 +- templates/definition/meter/kostal-plenticore.yaml | 4 ++-- templates/definition/meter/solaredge-hybrid.yaml | 10 +++++----- templates/definition/meter/solaredge-inverter.yaml | 7 +++++-- templates/definition/meter/sunspec-hybrid.yaml | 9 +++++---- templates/definition/meter/sunspec-inverter.yaml | 4 ++++ 7 files changed, 28 insertions(+), 20 deletions(-) diff --git a/templates/definition/meter/fronius-gen24.yaml b/templates/definition/meter/fronius-gen24.yaml index f4296847d..853a12290 100644 --- a/templates/definition/meter/fronius-gen24.yaml +++ b/templates/definition/meter/fronius-gen24.yaml @@ -24,9 +24,9 @@ render: | # reference: https://github.com/volkszaehler/mbmd/blob/master/meters/sunspec/models.go {{- if eq .usage "grid" }} type: modbus - model: sunspec uri: {{ .host }}:{{ .port }} id: 200 + model: sunspec {{- if eq .integer "true" }} # sunspec model 203 (int+sf) meter power: 203:W @@ -49,14 +49,14 @@ render: | source: calc add: - source: modbus - model: sunspec uri: {{ .host }}:{{ .port }} id: 1 + model: sunspec value: 160:1:DCW # mppt 1 - source: modbus - model: sunspec uri: {{ .host }}:{{ .port }} id: 1 + model: sunspec value: 160:2:DCW # mppt 2 {{- end }} {{- if eq .usage "battery" }} @@ -65,20 +65,20 @@ render: | source: calc add: - source: modbus - model: sunspec uri: {{ .host }}:{{ .port }} id: 1 + model: sunspec value: 160:3:DCW # mppt 3 charge scale: -1 - source: modbus - model: sunspec uri: {{ .host }}:{{ .port }} id: 1 + model: sunspec value: 160:4:DCW # mppt 4 discharge soc: source: modbus - model: sunspec uri: {{ .host }}:{{ .port }} id: 1 + model: sunspec value: ChargeState {{- end }} diff --git a/templates/definition/meter/kostal-ksem.yaml b/templates/definition/meter/kostal-ksem.yaml index c031d6d17..650c9611d 100644 --- a/templates/definition/meter/kostal-ksem.yaml +++ b/templates/definition/meter/kostal-ksem.yaml @@ -11,5 +11,5 @@ params: id: 71 render: | type: modbus - model: sunspec {{- include "modbus" . }} + model: sunspec diff --git a/templates/definition/meter/kostal-plenticore.yaml b/templates/definition/meter/kostal-plenticore.yaml index 4dbfe07ad..fa14024b8 100644 --- a/templates/definition/meter/kostal-plenticore.yaml +++ b/templates/definition/meter/kostal-plenticore.yaml @@ -25,12 +25,12 @@ render: | source: calc add: # The add plugin sums up both string values - source: modbus + {{- include "modbus" . | indent 4 }} model: sunspec - {{- include "modbus" . | indent 4 }} value: 160:1:DCW # string 1 - source: modbus + {{- include "modbus" . | indent 4 }} model: sunspec - {{- include "modbus" . | indent 4 }} value: 160:2:DCW # string 2 {{- end }} {{- if eq .usage "battery" }} diff --git a/templates/definition/meter/solaredge-hybrid.yaml b/templates/definition/meter/solaredge-hybrid.yaml index 4eb8c83ed..5160128c2 100644 --- a/templates/definition/meter/solaredge-hybrid.yaml +++ b/templates/definition/meter/solaredge-hybrid.yaml @@ -24,11 +24,11 @@ render: | power: {{- if eq .usage "grid" }} source: modbus - model: sunspec - timeout: {{ .timeout }} uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) id: 1 subdevice: 1 # Metering device + timeout: {{ .timeout }} + model: sunspec value: 203:W scale: -1 {{- end }} @@ -36,15 +36,15 @@ render: | source: calc add: - source: modbus - model: sunspec - timeout: {{ .timeout }} uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) id: 1 + timeout: {{ .timeout }} + model: sunspec value: 103:DCW - source: modbus - timeout: {{ .timeout }} uri: {{ .host }}:{{ .port }} # Port 502 (SetApp) or 1502 (LCD) id: 1 + timeout: {{ .timeout }} register: address: 62836 # Battery 1 Instantaneous Power type: holding diff --git a/templates/definition/meter/solaredge-inverter.yaml b/templates/definition/meter/solaredge-inverter.yaml index f1233d5f0..964c4826d 100644 --- a/templates/definition/meter/solaredge-inverter.yaml +++ b/templates/definition/meter/solaredge-inverter.yaml @@ -18,11 +18,14 @@ render: | type: custom power: source: modbus - model: sunspec {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} {{- if eq .usage "grid" }} subdevice: 1 + model: sunspec value: 203:W # sunspec 3-phase meter power reading scale: -1 - {{- end -}} + {{- else }} + model: sunspec + value: Power + {{- end }} diff --git a/templates/definition/meter/sunspec-hybrid.yaml b/templates/definition/meter/sunspec-hybrid.yaml index c9f51ce96..a10a1231e 100644 --- a/templates/definition/meter/sunspec-hybrid.yaml +++ b/templates/definition/meter/sunspec-hybrid.yaml @@ -45,12 +45,12 @@ render: | source: calc add: - source: modbus - model: sunspec {{- include "modbus" . | indent 4 }} + model: sunspec value: 160:1:DCW # mppt 1 - source: modbus - model: sunspec {{- include "modbus" . | indent 4 }} + model: sunspec value: 160:2:DCW # mppt 2 {{- end }} {{- if eq .usage "battery" }} @@ -59,16 +59,17 @@ render: | source: calc add: - source: modbus - model: sunspec {{- include "modbus" . | indent 4 }} + model: sunspec value: 160:3:DCW # mppt 3 charge scale: -1 - source: modbus - model: sunspec {{- include "modbus" . | indent 4 }} + model: sunspec value: 160:4:DCW # mppt 4 discharge soc: source: modbus {{- include "modbus" . | indent 2 }} + model: sunspec value: ChargeState {{- end }} diff --git a/templates/definition/meter/sunspec-inverter.yaml b/templates/definition/meter/sunspec-inverter.yaml index ac5babcbb..ae682ff8d 100644 --- a/templates/definition/meter/sunspec-inverter.yaml +++ b/templates/definition/meter/sunspec-inverter.yaml @@ -22,6 +22,7 @@ render: | type: modbus {{- include "modbus" . }} {{- if eq .usage "grid" }} + model: sunspec {{- if eq .integer "true" }} # sunspec model 203 (int+sf) meter power: 203:W @@ -37,4 +38,7 @@ render: | - 213:AphB - 213:AphC {{- end }} + {{- else }} + model: sunspec + power: Power {{- end }}