Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jan 23, 2025
1 parent ab5efe4 commit 8eea2e3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions charger/vaillant.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,14 @@ func NewVaillantFromConfig(ctx context.Context, other map[string]interface{}) (a
}, cc.Cache)
}

var heatingTempSensor bool

heatingTemp := func(zz []sensonet.StateZone) float64 {
z, _ := lo.Find(zz, func(z sensonet.StateZone) bool {
return z.Index == cc.HeatingZone
})
return z.CurrentRoomTemperature
}

var heatingTempSensor bool
if heating {
system, err := conn.GetSystem(systemId)
if err != nil {
Expand All @@ -160,14 +159,12 @@ func NewVaillantFromConfig(ctx context.Context, other map[string]interface{}) (a
return 0, err
}

if heating {
switch {
case heatingTempSensor:
if res := heatingTemp(system.State.Zones); res > 0 {
return res, nil
}
return 0, api.ErrNotAvailable
}

switch {
case len(system.State.Dhw) > 0:
return system.State.Dhw[0].CurrentDhwTemperature, nil
case len(system.State.DomesticHotWater) > 0:
Expand Down

0 comments on commit 8eea2e3

Please sign in to comment.