Tapo: retry login on error (#8733)
This commit is contained in:
parent
eaa83bff7a
commit
b717a51436
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue