Skip to content

Commit

Permalink
Tapo: retry login on error (evcc-io#8733)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanknotzer authored Jul 3, 2023
1 parent eaa83bf commit b717a51
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions meter/tapo/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,17 @@ func (d *Connection) DoSecureRequest(uri string, taporequest map[string]interfac
return nil, err
}

// Login atempt in case of tapo switch connection hicups
if res.ErrorCode == 9999 {
if err := d.Login(); err != nil {
return nil, err
}

if err := d.DoJSON(req, &res); err != nil {
return nil, err
}
}

if err := d.CheckErrorCode(res.ErrorCode); err != nil {
return nil, err
}
Expand Down

0 comments on commit b717a51

Please sign in to comment.