Skip to content

Commit

Permalink
Fix send cloud command after logout
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Sep 18, 2024
1 parent 0a265d9 commit b4b2c1c
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions custom_components/sonoff/core/ewelink/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,21 +467,22 @@ async def send(
sequence = await self.sequence()
log += sequence

# https://coolkit-technologies.github.io/eWeLink-API/#/en/APICenterV2?id=websocket-update-device-status
payload = {
"action": "update" if params else "query",
# we need to use device apikey bacause device may be shared from
# another account
"apikey": device["apikey"],
"selfApikey": self.auth["user"]["apikey"],
"deviceid": device["deviceid"],
"params": params or [],
"userAgent": "app",
"sequence": sequence,
}

_LOGGER.debug(log)
try:
# https://coolkit-technologies.github.io/eWeLink-API/#/en/APICenterV2?id=websocket-update-device-status
payload = {
"action": "update" if params else "query",
# we need to use device apikey bacause device may be shared from
# another account
"apikey": device["apikey"],
# auth can be null (logged in from another place)
"selfApikey": self.auth["user"]["apikey"],
"deviceid": device["deviceid"],
"params": params or [],
"userAgent": "app",
"sequence": sequence,
}

await self.ws.send_json(payload)

if timeout:
Expand Down

0 comments on commit b4b2c1c

Please sign in to comment.