SGReady: use standardised modes (BC) (#20747)

This commit is contained in:
andig 2025-05-03 09:11:34 +02:00 • committed by GitHub
parent 3629c20a08
commit 54162f06aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 29 additions and 29 deletions

View file

@ -40,10 +40,10 @@ func init() {
}
const (
_ int64 = iota
Normal
Boost
Stop
_ int64 = iota
Dimm // 1
Normal // 2
Boost // 3
)
//go:generate go tool decorate -f decorateSgReady -b *SgReady -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,Soc,func() (float64, error)" -t "api.SocLimiter,GetLimitSoc,func() (int64, error)"
@ -123,8 +123,8 @@ func (wb *SgReady) Status() (api.ChargeStatus, error) {
return api.StatusNone, err
}
if mode == Stop {
return api.StatusNone, errors.New("stop mode")
if mode == Dimm {
return api.StatusNone, errors.New("dimm mode")
}
status := map[int64]api.ChargeStatus{Boost: api.StatusC, Normal: api.StatusB}

View file

@ -43,10 +43,10 @@ render: |
getmode:
source: go
script: |
res := 1 // 0/0 Normal
res := 2 // 0/0 Normal
switch {
case SG1 == "1" && SG4 == "0": res = 3 // 1/0 Frostschutz
case SG4 == "1": res = 2 // x/1 Forcierter Betrieb/Sofortige Ansteuerung
case SG1 == "1" && SG4 == "0": res = 1 // 1/0 Frostschutz
case SG4 == "1": res = 3 // x/1 Forcierter Betrieb/Sofortige Ansteuerung
}
res
in:
@ -65,7 +65,7 @@ render: |
setmode:
source: switch
switch:
- case: 1 # normal
- case: 2 # normal
set:
source: sequence
set:
@ -85,7 +85,7 @@ render: |
- authorization: Bearer {{ .token}}
body: >
{ "value" : "0xxxxxxxxxxxxxx" }
- case: 2 # boost
- case: 3 # boost
set:
source: http
uri: http://{{ .host }}/api/boiler/hpin4opt
@ -95,7 +95,7 @@ render: |
- authorization: Bearer {{ .token}}
body: >
{ "value" : "1xxxxxxxxxxx" }
- case: 3 # dimm
- case: 1 # dimm
set:
source: sequence
set:

View file

@ -23,10 +23,10 @@ render: |
getmode:
source: map
values:
1: 3 # Frostschutz
2: 1 # Normal
3: 2 # Forcierter Betrieb
4: 2 # Sofortige Ansteuerung
1: 1 # Frostschutz
2: 2 # Normal
3: 3 # Forcierter Betrieb
4: 3 # Sofortige Ansteuerung
get:
source: modbus
{{- include "modbus" . | indent 4 }}
@ -37,7 +37,7 @@ render: |
setmode:
source: switch
switch:
- case: 1 # normal
- case: 2 # normal
set:
source: sequence
set:
@ -59,7 +59,7 @@ render: |
address: 4002
type: writesingle
encoding: uint16
- case: 2 # boost
- case: 3 # boost
set:
source: sequence
set:
@ -81,7 +81,7 @@ render: |
address: 4002
type: writesingle
encoding: uint16
- case: 3 # dimm
- case: 1 # dimm
set:
source: sequence
set:

View file

@ -20,10 +20,10 @@ render: |
getmode:
source: map
values:
1: 3 # Frostschutz
2: 1 # Normal
3: 2 # Forcierter Betrieb
4: 2 # Sofortige Ansteuerung
1: 1 # Frostschutz
2: 2 # Normal
3: 3 # Forcierter Betrieb
4: 3 # Sofortige Ansteuerung
get:
source: modbus
{{- include "modbus" . | indent 4 }}
@ -34,7 +34,7 @@ render: |
setmode:
source: switch
switch:
- case: 1 # normal
- case: 2 # normal
set:
source: sequence
set:
@ -56,7 +56,7 @@ render: |
address: 4002
type: writesingle
encoding: uint16
- case: 2 # boost
- case: 3 # boost
set:
source: sequence
set:
@ -78,7 +78,7 @@ render: |
address: 4002
type: writesingle
encoding: uint16
- case: 3 # dimm
- case: 1 # dimm
set:
source: sequence
set:

View file

@ -21,10 +21,10 @@ render: |
getmode:
source: go
script: |
res := 1
res := 2 // 0/0 Normal
switch {
case SG1 == 1 && SG2 == 0: res = 3
case SG2 == 1: res = 2
case SG1 == 1 && SG2 == 0: res = 1 // 1/0 Frostschutz
case SG2 == 1: res = 3 // x/1 Forcierter Betrieb/Sofortige Ansteuerung
}
res
in: