Atmoce: fix curtailed for battery (#32453)
This commit is contained in:
parent
555ec3df36
commit
3970e19847
1 changed files with 13 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue