From 3970e198470ebc036fe418b60dca83a8d09b22c9 Mon Sep 17 00:00:00 2001 From: FrankvdAa Date: Mon, 3 Aug 2026 08:54:08 +0200 Subject: [PATCH] Atmoce: fix curtailed for battery (#32453) --- templates/definition/meter/atmoce.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/templates/definition/meter/atmoce.yaml b/templates/definition/meter/atmoce.yaml index 49dd6662a..c242fbb7c 100644 --- a/templates/definition/meter/atmoce.yaml +++ b/templates/definition/meter/atmoce.yaml @@ -425,7 +425,7 @@ render: | address: 60324 # Grid Maximum Export Power (kW * 1000) type: writemultiple encoding: uint32 - curtailed: + curtailed: # the power limit is expressed as percent of nominal discharge power source: go in: - name: limit @@ -437,7 +437,18 @@ render: | address: 60324 # Grid Maximum Export Power (kW * 1000) type: holding decode: uint32 - script: limit != 0xFFFFFFFF + - name: maxdischargepower + type: int + config: + source: const + value: {{ .maxdischargepower }} + script: | + percent := 100 + if limit != 0xFFFFFFFF && maxdischargepower > 0 { + // round, the watt conversion does not reproduce the written percent exactly + percent = (limit*100 + maxdischargepower/2) / maxdischargepower + } + percent dim: source: ifelse if: