diff --git a/pyintesishome/intesishomelocal.py b/pyintesishome/intesishomelocal.py index d712420..6fc1286 100644 --- a/pyintesishome/intesishomelocal.py +++ b/pyintesishome/intesishomelocal.py @@ -169,7 +169,7 @@ async def _request(self, command: str, **kwargs) -> dict: # If there's neither a "success" or "error" key, something is very # wonky, so log an error plus the entire response. if json_response.get("success", False): - return json_response.get("data") + return json_response.get("data") or {} if "error" in json_response: error = json_response["error"] if error.get("code") in [1, 5]: @@ -205,11 +205,12 @@ async def _request_value(self, name: str) -> dict: return response["dpval"]["value"] async def _set_value(self, device_id, uid, value): - return await self._request( + result = await self._request( LOCAL_CMD_SET_DP_VALUE, uid=uid, value=value, ) + return result is not None async def get_datapoints(self) -> dict: """Get all available datapoints.""" @@ -334,6 +335,7 @@ def get_horizontal_swing_list(self, device_id) -> list: INTESIS_MAP[uid]["values"][i] for i in self._datapoints[uid]["descr"]["states"] ] + def has_horizontal_swing(self, device_id) -> bool: """Entity supports horizontal swing.""" return self._has_datapoint("hvane")