Meter (FoxESS H3-Pro/Smart): add battery control (#32301)

This commit is contained in:
GurliGebis 2026-08-03 10:39:02 +02:00 • committed by GitHub
parent 6fd2947509
commit edae1cc307
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,8 @@ params:
id: 247
- name: maxacpower
- preset: battery-params
- name: maxchargepower
required: true
render: |
type: custom
{{- if eq .usage "grid" }}
@ -115,5 +117,132 @@ render: |
address: 46611 # Minimum SoC OnGrid
type: writesingle
decode: uint16
batterymode:
source: watchdog
timeout: 30s
reset: 1 # reset to normal mode
set:
source: switch
switch:
- case: 1 # normal - disable remote control
set:
source: sequence
set:
- source: const
value: 0 # Disabled
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46001 # Remote Control
type: writesingle
encoding: uint16
- source: const
value: 1 # Self Use
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 49203 # Work Mode
type: writesingle
encoding: uint16
- source: const
value: {{ .minsoc }}
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46609 # Minimum SoC
type: writesingle
encoding: uint16
- source: const
value: {{ .maxsoc }}
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46610 # Maximum SoC
type: writesingle
encoding: uint16
- case: 2 # hold - stop battery discharge
set:
source: sequence
set:
- source: const
value: 2 # Feed-in First, fallback if the remote control watchdog expires
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 49203 # Work Mode
type: writesingle
encoding: uint16
- source: const
value: 60 # Remote timeout 60 seconds
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46002 # Remote Timeout Set
type: writesingle
encoding: uint16
- source: const
value: 1 # Enabled
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46001 # Remote Control
type: writesingle
encoding: uint16
- source: const
value: 0 # W
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46003 # Remote Active Power, int32 across 46003 (high word) and 46004 (low word)
type: writemultiple
encoding: int32
- case: 3 # charge - force battery charge
set:
source: sequence
set:
- source: const
value: 3 # Back-up, fallback if the remote control watchdog expires
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 49203 # Work Mode
type: writesingle
encoding: uint16
- source: const
value: 60 # Remote timeout 60 seconds
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46002 # Remote Timeout Set
type: writesingle
encoding: uint16
- source: const
value: 1 # Enabled
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46001 # Remote Control
type: writesingle
encoding: uint16
- source: const
value: {{ mul .maxchargepower -1 }} # negative power means charging
set:
source: modbus
{{- include "modbus" . | indent 12 }}
register:
address: 46003 # Remote Active Power, int32 across 46003 (high word) and 46004 (low word)
type: writemultiple
encoding: int32
{{- include "battery-params" . }}
{{- end }}