Skip to content

Commit

Permalink
Update cloud timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 19, 2024
1 parent 719d458 commit 0aeaea9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/sonoff/core/ewelink/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,15 @@ async def login(
"X-CK-Appid": appid,
}
r = await self.session.post(
self.host + "/v2/user/login", data=data, headers=headers, timeout=10
self.host + "/v2/user/login", data=data, headers=headers, timeout=5
)
resp = await r.json()

# wrong default region
if resp["error"] == 10004:
self.region = resp["data"]["region"]
r = await self.session.post(
self.host + "/v2/user/login", data=data, headers=headers, timeout=10
self.host + "/v2/user/login", data=data, headers=headers, timeout=5
)
resp = await r.json()

Expand All @@ -400,7 +400,7 @@ async def login_token(self, token: str, app: int = 0) -> bool:
appid = APP[app][0]
headers = {"Authorization": "Bearer " + token, "X-CK-Appid": appid}
r = await self.session.get(
self.host + "/v2/user/profile", headers=headers, timeout=30
self.host + "/v2/user/profile", headers=headers, timeout=5
)
resp = await r.json()
if resp["error"] != 0:
Expand All @@ -414,7 +414,7 @@ async def login_token(self, token: str, app: int = 0) -> bool:

async def get_homes(self) -> dict:
r = await self.session.get(
self.host + "/v2/family", headers=self.headers, timeout=30
self.host + "/v2/family", headers=self.headers, timeout=10
)
resp = await r.json()
return {i["id"]: i["name"] for i in resp["data"]["familyList"]}
Expand All @@ -425,7 +425,7 @@ async def get_devices(self, homes: list = None) -> list[dict]:
r = await self.session.get(
self.host + "/v2/device/thing",
headers=self.headers,
timeout=30,
timeout=10,
params={"num": 0, "familyid": home} if home else {"num": 0},
)
resp = await r.json()
Expand Down

0 comments on commit 0aeaea9

Please sign in to comment.