diff --git a/pyintesishome/intesishomelocal.py b/pyintesishome/intesishomelocal.py index ed515a8..d424f2a 100644 --- a/pyintesishome/intesishomelocal.py +++ b/pyintesishome/intesishomelocal.py @@ -71,7 +71,11 @@ async def _request_values(self) -> dict: response = await self._request(LOCAL_CMD_GET_DP_VALUE, uid="all") if response and "dpval" in response: - self._values = {dpval["uid"]: dpval["value"] for dpval in response["dpval"]} + self._values = { + dpval["uid"]: dpval["value"] + for dpval in response["dpval"] + if dpval.get("status", 0) == 0 + } return self._values return {} @@ -306,9 +310,12 @@ async def _request_value(self, name: str) -> dict: response = await self._request( LOCAL_CMD_GET_DP_VALUE, uid=COMMAND_MAP[name]["uid"] ) - if response is None: + if response is None or not response.get("dpval"): + return None + dpval = response["dpval"] + if dpval.get("status", 0) != 0: return None - return response["dpval"]["value"] + return dpval["value"] async def _set_value(self, device_id, uid, value): result = await self._request(