power: fix Hue implementation

Signed-off-by: Oliver Tetz olli.codes.some.lines@gmail.com
This commit is contained in:
olli-t 2022-07-18 14:17:16 +02:00 committed by GitHub
parent bcb7a55996
commit 9fea1634b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1301,7 +1301,7 @@ class HueDevice(HTTPDevice):
)
url = self.client.escape_url(url)
ret = await self.client.request("PUT", url, body={"on": new_state})
resp = cast(List[Dict[str, Dict[str, Any]]], ret)
resp = cast(List[Dict[str, Dict[str, Any]]], ret.json())
return (
"on" if resp[0]["success"][f"/lights/{self.device_id}/state/on"]
else "off"
@ -1313,7 +1313,7 @@ class HueDevice(HTTPDevice):
)
url = self.client.escape_url(url)
ret = await self.client.request("GET", url)
resp = cast(Dict[str, Dict[str, Any]], ret)
resp = cast(Dict[str, Dict[str, Any]], ret.json())
return "on" if resp["state"]["on"] else "off"