Skip to content

Commit

Permalink
Minor change on API return data
Browse files Browse the repository at this point in the history
  • Loading branch information
ollo69 committed Jan 7, 2024
1 parent e9a6afb commit 582023f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions custom_components/smartthinq_sensors/wideq/core_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ async def thinq2_get(
if "resultCode" not in out:
raise exc.APIError("-1", out)

res = self._manage_lge_result(out, True)
return res["result"]
return self._manage_lge_result(out, True)

async def lgedm2_post(
self,
Expand Down Expand Up @@ -398,7 +397,7 @@ def _manage_lge_result(result: dict, is_api_v2=False) -> dict:
raise API2_ERRORS[code](message)
raise exc.APIError(message, code)

return result
return result.get("result")

msg = result.get(DATA_ROOT)
if not msg:
Expand Down
3 changes: 1 addition & 2 deletions custom_components/smartthinq_sensors/wideq/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ async def _get_config_v2(
if self._should_poll or self.client.emulation:
return None

payload = await self._client.session.device_v2_controls(
result = await self._client.session.device_v2_controls(
self._device_info.device_id,
ctrl_key,
command,
Expand All @@ -588,7 +588,6 @@ async def _get_config_v2(
ctrl_path=ctrl_path,
)

result = payload.get("result")
if not result or "data" not in result:
return None
return result["data"]
Expand Down

0 comments on commit 582023f

Please sign in to comment.