Skip to content

Commit

Permalink
Add battery control (Work in progres-
Browse files Browse the repository at this point in the history
  • Loading branch information
h3llrais3r committed Jan 16, 2025
1 parent 9362b61 commit 39a87fd
Showing 1 changed file with 116 additions and 0 deletions.
116 changes: 116 additions & 0 deletions templates/definition/meter/saj-h1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ params:
default: 5s
- name: capacity
advanced: true
# battery control
- name: defaultmode
default: 0 # (0=self-use,1=time-of-use,2=backup,3=passive)
advanced: true
- name: holdmode
default: 2 # (0=self-use,1=time-of-use,2=backup,3=passive)
advanced: true
- name: backupsoc
type: int
default: 20 # used when backup mode is used as defaultmode to control the default backup soc
advanced: true
render: |
type: custom
{{- if eq .usage "grid" }}
Expand Down Expand Up @@ -79,5 +90,110 @@ render: |
type: holding
decode: uint16
scale: 0.01
batterymode:
source: switch
switch:
- case: 1 # normal
set:
source: sequence
set:
- source: const
value: {{ .defaultmode }}
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3247 # AppMode
type: writeholding
decode: int16
- source: const
value: {{ .backupsoc }} # use backupsoc value when using backup mode as defaultmode
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3271 # BackModSOCRetain
type: writeholding
decode: int16
- case: 2 # hold
set:
source: sequence
set:
- source: const
value: {{ .holdmode }}
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3247 # AppMode
type: writeholding
decode: int16
- source: const
value: {{ .soc }} # hold on current soc value when using backup mode as holdmode
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3271 # BackModSOCRetain
type: writeholding
decode: int16
- case: 3 # charge
set:
source: sequence
set:
- source: const
value: 1 # Time-Of-Use
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3247 # AppMode
type: writeholding
decode: int16
- source: const
value: 1 # enable
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3604 # Charge time enable control
type: writeholding
decode: int16
- source: const
value: 0 # start time (00:00)
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3606 # Battery first charging time (start)
type: writeholding
decode: int16
- source: const
value: 0x173B # end time (23:59)
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3607 # Battery first charging time (end)
type: writeholding
decode: int16
- source: const
value: 0x7F64 # every day (0x7f) at 100% (0x64)
set:
source: modbus
{{- include "modbus" . | indent 10 }}
timeout: {{ .timeout }}
register:
address: 0x3608 # Battery first charging time (power)
type: writeholding
decode: int16
capacity: {{ .capacity }} # kWh
{{- end }}

0 comments on commit 39a87fd

Please sign in to comment.