Skip to content

Commit

Permalink
Tibber: recover from disconnect (#18504)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrimmiMeloni authored Feb 1, 2025
1 parent 31e476c commit 1bfcc19
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions meter/tibber-pulse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}()

Expand Down

0 comments on commit 1bfcc19

Please sign in to comment.