From 0e56496da6b8adb4933d8f9c9ea05d15898beb58 Mon Sep 17 00:00:00 2001 From: osk2 Date: Sun, 3 Oct 2021 22:33:51 +0800 Subject: [PATCH] Fix broken select entity --- custom_components/panasonic_smart_app/select.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/custom_components/panasonic_smart_app/select.py b/custom_components/panasonic_smart_app/select.py index 61fe6da..0a8673e 100644 --- a/custom_components/panasonic_smart_app/select.py +++ b/custom_components/panasonic_smart_app/select.py @@ -125,7 +125,7 @@ async def async_select_option(self, option: str) -> None: target_option = list(filter(lambda m: m[0] == option, raw_mode_list)) if len(target_option) > 0: _LOGGER.debug(f"[{self.label}] Set fan mode to {option}") - await self.client.set_command(self.auth, 142, target_option[0]) + await self.client.set_command(self.auth, 142, target_option[0][1]) await self.coordinator.async_request_refresh() else: return @@ -178,7 +178,7 @@ async def async_select_option(self, option: str) -> None: target_option = list(filter(lambda m: m[0] == option, raw_mode_list)) if len(target_option) > 0: _LOGGER.debug(f"[{self.label}] Set motion detection to {option}") - await self.client.set_command(self.auth, 153, target_option[0]) + await self.client.set_command(self.auth, 153, target_option[0][1]) await self.coordinator.async_request_refresh() else: return @@ -228,10 +228,11 @@ async def async_select_option(self, option: str) -> None: raw_mode_list = list( filter(lambda c: c["CommandType"] == "0x1f", self.commands) )[0]["Parameters"] + _LOGGER.debug(raw_mode_list) target_option = list(filter(lambda m: m[0] == option, raw_mode_list)) if len(target_option) > 0: - _LOGGER.debug(f"[{self.label}] Set indicator light to {option}") - await self.client.set_command(self.auth, 159, target_option[0]) + _LOGGER.debug(f"[{self.label}] Set motion detection to {option}") + await self.client.set_command(self.auth, 159, target_option[0][1]) await self.coordinator.async_request_refresh() else: - return + return \ No newline at end of file