Atmoce: fix curtailed for battery (#32453)

This commit is contained in:
FrankvdAa 2026-08-03 08:54:08 +02:00 • committed by GitHub
parent 555ec3df36
commit 3970e19847
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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: