Vaillant: add heating zone temperature (#18357)

This commit is contained in:
andig 2025-01-23 08:25:53 +01:00 • committed by GitHub
parent 3281ba8d90
commit 57d74ee43f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -135,8 +135,24 @@ 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 {
@ -144,6 +160,11 @@ func NewVaillantFromConfig(ctx context.Context, other map[string]interface{}) (a
}
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: