Tibber: recover from disconnect (#18504)

This commit is contained in:
Michael Heß 2025-02-01 14:21:46 +01:00 • committed by GitHub
parent 31e476cdaa
commit 1bfcc19f0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,8 +120,19 @@ func NewTibberFromConfig(ctx context.Context, other map[string]interface{}) (api
}()
go func() {
if err := client.Run(); err != nil {
log.ERROR.Println(err)
// The pulse sometimes declines valid(!) subscription requests, and asks the client to disconnect.
// Therefore we need to restart the client when exiting gracefully upon server request
// https://github.com/evcc-io/evcc/issues/17925#issuecomment-2621458890
for tick := time.Tick(10 * time.Second); ; {
if err := client.Run(); err != nil {
log.ERROR.Println(err)
}
select {
case <-tick:
case <-ctx.Done():
return
}
}
}()