Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SofarSolar: add battery control #10847

Merged
merged 6 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion provider/transformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func configureInputs(inConfig []transformationConfig) ([]inputTransformation, er
f = func() (any, error) { return ff() }

default:
return nil, fmt.Errorf("%s: Could not find converter for %s", cc.Name, cc.Type)
return nil, fmt.Errorf("%s: invalid type %s", cc.Name, cc.Type)
}

in = append(in, inputTransformation{
Expand Down
23 changes: 14 additions & 9 deletions templates/definition/meter/sofarsolar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,20 @@ render: |
type: holding
decode: uint16
limitsoc:
source: float2int
set:
source: modbus
{{- include "modbus" . | indent 4 }}
register:
address: 0x104C # BatConfig_Current_Discharge_Limit
type: writesingle
decode: uint16
scale: 100
source: go
script:
return int(100-limitSoc)
out:
- name: dod
type: int
config:
source: modbus
{{- include "modbus" . | indent 6 }}
register:
address: 0x104C # BatConfig_Current_Discharge_Limit
type: writesingle
decode: uint16
scale: 100
capacity: {{ .capacity }} # kWh
minsoc: {{ .minsoc }} # %
maxsoc: {{ .maxsoc }} # %
Expand Down