Skip to content

Commit

Permalink
test filter reset
Browse files Browse the repository at this point in the history
  • Loading branch information
hmn committed Nov 9, 2024
1 parent a4a2692 commit c27989e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions custom_components/siku/api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async def party(self) -> None:

async def reset_filter_alarm(self) -> None:
"""Reset filter alarm."""
cmd = f"{COMMAND_RESET_ALARMS}".upper()
cmd = f"{COMMAND_RESET_ALARMS}00".upper()
await self._send_command(FUNC_WRITE, cmd)
return await self.status()

Expand Down Expand Up @@ -237,6 +237,10 @@ async def _send_command(self, func: str, data: str) -> list[str]:
)
s.sendto(packet_data, server_address)

if func == FUNC_WRITE:
LOGGER.debug("write command, no response expected")
return []

# Receive response
result_data, server = s.recvfrom(256)
LOGGER.debug(
Expand All @@ -250,7 +254,7 @@ async def _send_command(self, func: str, data: str) -> list[str]:

result_hexlist = ["".join(x) for x in zip(*[iter(result_str)] * 2)]
if not self._verify_checksum(result_hexlist):
raise Exception("Checksum error")
raise ValueError("Checksum error")
LOGGER.debug("returning hexlist %s", result_hexlist)
return result_hexlist

Expand Down Expand Up @@ -417,7 +421,7 @@ async def _parse_response(self, hexlist: list[str]) -> dict:
)
i += 1
except KeyError as ex:
raise Exception(
raise ValueError(
f"Error translating response from fan controller: {str(ex)}"
) from ex
return data

0 comments on commit c27989e

Please sign in to comment.