Tapo: retry login on error (#8733)

This commit is contained in:
stefanknotzer 2023-07-03 17:43:30 +02:00 • committed by GitHub
parent eaa83bff7a
commit b717a51436
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}