Skip to content

Commit

Permalink
Vaillant: add heating zone temperature (#18357)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Jan 23, 2025
1 parent 3281ba8 commit 57d74ee
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion charger/vaillant.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,36 @@ func NewVaillantFromConfig(ctx context.Context, other map[string]interface{}) (a
}, cc.Cache)
}

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 {
return nil, err
}
heatingTempSensor = heatingTemp(system.State.Zones) > 0
}

var temp func() (float64, error)
if !heating {
if !heating || heatingTempSensor {
temp = provider.Cached(func() (float64, error) {
system, err := conn.GetSystem(systemId)
if err != nil {
return 0, err
}

switch {
case heatingTempSensor:
if res := heatingTemp(system.State.Zones); res > 0 {
return res, nil
}
return 0, api.ErrNotAvailable
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 57d74ee

Please sign in to comment.