From 9218cf0059dfa8724f070c0b4fe76442bc8d80b4 Mon Sep 17 00:00:00 2001 From: CiNcH83 Date: Tue, 2 Jun 2026 18:45:27 +0200 Subject: [PATCH] Huawei SUN2000: add returnEnergy for grid and battery (#29790) --- .../meter/huawei-sun2000-hybrid.yaml | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/templates/definition/meter/huawei-sun2000-hybrid.yaml b/templates/definition/meter/huawei-sun2000-hybrid.yaml index 9fd6d8c8e..5e53b1dfc 100644 --- a/templates/definition/meter/huawei-sun2000-hybrid.yaml +++ b/templates/definition/meter/huawei-sun2000-hybrid.yaml @@ -73,7 +73,7 @@ render: | timeout: {{ .timeout }} connectdelay: 1s register: - address: 37113 # Grid import export power + address: 37113 # Grid import/export power type: holding decode: int32nan scale: -1 @@ -82,7 +82,16 @@ render: | {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} register: - address: 37121 # Active energy import from the grid + address: 37121 # Active energy imported from the grid + type: holding + decode: uint32nan + scale: 0.01 + returnenergy: + source: modbus + {{- include "modbus" . | indent 2 }} + timeout: {{ .timeout }} + register: + address: 37119 # Active energy exported to the grid type: holding decode: uint32nan scale: 0.01 @@ -140,11 +149,10 @@ render: | timeout: {{ .timeout }} connectdelay: 1s register: - {{- if eq .storageunit "1" }} - address: 37001 - {{- end }} {{- if eq .storageunit "2" }} address: 37743 + {{- else }} + address: 37001 {{- end }} type: holding decode: int32nan @@ -154,11 +162,23 @@ render: | {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} register: - {{- if eq .storageunit "1" }} - address: 37068 # [Energy storage unit 1] Total discharge - {{- end }} {{- if eq .storageunit "2" }} address: 37755 # [Energy storage unit 2] Total discharge + {{- else }} + address: 37068 # [Energy storage unit 1] Total discharge + {{- end }} + type: holding + decode: uint32nan + scale: 0.01 + returnenergy: + source: modbus + {{- include "modbus" . | indent 2 }} + timeout: {{ .timeout }} + register: + {{- if eq .storageunit "2" }} + address: 37753 # [Energy storage unit 2] Total charge + {{- else }} + address: 37066 # [Energy storage unit 1] Total charge {{- end }} type: holding decode: uint32nan @@ -168,11 +188,10 @@ render: | {{- include "modbus" . | indent 2 }} timeout: {{ .timeout }} register: - {{- if eq .storageunit "1" }} - address: 37004 - {{- end }} {{- if eq .storageunit "2" }} address: 37738 + {{- else }} + address: 37004 {{- end }} type: holding decode: uint16nan