Sungrow Hybrid: fix charge sign (again) (#18473)
This commit is contained in:
parent
0516b5c807
commit
84b5037c64
1 changed files with 29 additions and 22 deletions
|
|
@ -110,34 +110,41 @@ render: |
|
|||
{{- end }}
|
||||
{{- if eq .usage "battery" }}
|
||||
power:
|
||||
source: calc
|
||||
mul:
|
||||
- source: calc
|
||||
abs:
|
||||
source: go # handling old and new firmware
|
||||
script: |
|
||||
res := float64(bp)
|
||||
if (brs&0x2 > 0 || bc < 0) && bp >= 0 {
|
||||
res = float64(-bp)
|
||||
}
|
||||
res
|
||||
in:
|
||||
- name: brs
|
||||
type: int
|
||||
config:
|
||||
source: modbus
|
||||
{{- include "modbus" . | indent 6 }}
|
||||
register:
|
||||
type: input
|
||||
address: 13000 # Battery running state
|
||||
decode: uint16
|
||||
- name: bc
|
||||
type: int
|
||||
config:
|
||||
source: modbus
|
||||
{{- include "modbus" . | indent 6 }}
|
||||
register:
|
||||
type: input
|
||||
address: 13020 # Battery current
|
||||
decode: int16
|
||||
- name: bp
|
||||
type: int
|
||||
config:
|
||||
source: modbus
|
||||
{{- include "modbus" . | indent 6 }}
|
||||
timeout: {{ .timeout }}
|
||||
register:
|
||||
type: input
|
||||
address: 13021 # Battery power
|
||||
decode: int16
|
||||
- source: calc
|
||||
add:
|
||||
- source: modbus
|
||||
{{- include "modbus" . | indent 6 }}
|
||||
register:
|
||||
type: input
|
||||
address: 13000 # Battery running state
|
||||
decode: bool16
|
||||
bitmask: 2 # Charging
|
||||
scale: -1
|
||||
- source: modbus
|
||||
{{- include "modbus" . | indent 6 }}
|
||||
register:
|
||||
type: input
|
||||
address: 13000 # Battery running state
|
||||
decode: bool16
|
||||
bitmask: 4 # Discharging
|
||||
energy:
|
||||
source: modbus
|
||||
{{- include "modbus" . | indent 2 }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue