From 479568b2a6d662dcf5a93e3031795fe324d6f5d9 Mon Sep 17 00:00:00 2001 From: Luke Morrigan Date: Fri, 22 Mar 2024 00:30:57 +0000 Subject: [PATCH 1/5] Revert "Fix set fan speed" This reverts commit 8676cb3faddbe32ec53d9d8c6605fb0d92f6e4bb. --- custom_components/robovac/vacuum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/robovac/vacuum.py b/custom_components/robovac/vacuum.py index 71df1e1..f4b36a1 100644 --- a/custom_components/robovac/vacuum.py +++ b/custom_components/robovac/vacuum.py @@ -432,7 +432,7 @@ async def async_set_fan_speed(self, fan_speed, **kwargs): fan_speed = "Boost_IQ" elif fan_speed == "Pure": fan_speed = "Quiet" - await self.vacuum.async_set({"130": fan_speed}) + await self.vacuum.async_set({"102": fan_speed}) async def async_send_command( self, command: str, params: dict | list | None = None, **kwargs From 8b09c067396ff360ed32dd69c135925b9a887cb7 Mon Sep 17 00:00:00 2001 From: Luke Morrigan Date: Fri, 22 Mar 2024 00:30:57 +0000 Subject: [PATCH 2/5] Revert "Add debug" This reverts commit 94ae2b55ea627609be9ba2b0971ee647b83c3b10. --- custom_components/robovac/vacuum.py | 32 ++++++----------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/custom_components/robovac/vacuum.py b/custom_components/robovac/vacuum.py index f4b36a1..2eb7ae2 100644 --- a/custom_components/robovac/vacuum.py +++ b/custom_components/robovac/vacuum.py @@ -89,28 +89,16 @@ class TUYA_CODES(StrEnum): - MODE = "5" - STATE = "15" - # FAN_SPEED = "102" - FAN_SPEED = "130" BATTERY_LEVEL = "104" + STATE = "15" ERROR_CODE = "106" - CLEANING_TIME = "109" + MODE = "5" + FAN_SPEED = "102" CLEANING_AREA = "110" + CLEANING_TIME = "109" + AUTO_RETURN = "135" DO_NOT_DISTURB = "107" - DO_NOT_DISTURB2 = "139" BOOST_IQ = "118" - AUTO_RETURN = "135" - RETURN_HOME = "101" # boolean - A_111 = "111" # 65? - A_122 = "122" # continue - A_131 = "131" # false - A_137 = "137" # 0 - HARDWARE_CODE = "115" # decoded - A_112 = "112" # decoded clean record? - A_113 = "113" # decoded - CLEAN_STATISTIC = "114" # decoded - MULTI_MAPS = "117" # decoded TUYA_CONSUMABLES_CODES = ["142", "116"] @@ -384,15 +372,7 @@ def update_entity_values(self): _LOGGER.debug( "Consumables decoded value is: {}".format(consumables) ) - if ( - "consumable" in consumables - and "duration" in consumables["consumable"] - ): - _LOGGER.debug( - "Consumables encoded value is: {}".format( - consumables["consumable"]["duration"] - ) - ) + if "consumable" in consumables and "duration" in consumables: self._attr_consumables = consumables["consumable"]["duration"] async def async_locate(self, **kwargs): From 6e50fd95f88987a5c6e3b7f71dda64ba7584b12f Mon Sep 17 00:00:00 2001 From: Luke Morrigan Date: Fri, 22 Mar 2024 00:30:57 +0000 Subject: [PATCH 3/5] Revert "Add debug infos" This reverts commit 4f1bdb3bac41ddc1aaa9b51d6675c7a0a10b9b9b. --- custom_components/robovac/vacuum.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/custom_components/robovac/vacuum.py b/custom_components/robovac/vacuum.py index 2eb7ae2..0da7ba2 100644 --- a/custom_components/robovac/vacuum.py +++ b/custom_components/robovac/vacuum.py @@ -352,14 +352,7 @@ def update_entity_values(self): # self.map_data = self.tuyastatus.get("121") # self.erro_msg? = self.tuyastatus.get("124") if self.robovac_supported & RoboVacEntityFeature.CONSUMABLES: - _LOGGER.debug("Support Consumables") for CONSUMABLE_CODE in TUYA_CONSUMABLES_CODES: - _LOGGER.debug("Consumable code is: {}".format(CONSUMABLE_CODE)) - _LOGGER.debug( - "Consumables value is: {}".format( - self.tuyastatus.get(CONSUMABLE_CODE) - ) - ) if ( CONSUMABLE_CODE in self.tuyastatus and self.tuyastatus.get(CONSUMABLE_CODE) is not None @@ -369,9 +362,6 @@ def update_entity_values(self): "ascii" ) ) - _LOGGER.debug( - "Consumables decoded value is: {}".format(consumables) - ) if "consumable" in consumables and "duration" in consumables: self._attr_consumables = consumables["consumable"]["duration"] From 6cf2274e5001dbcb364f26ef4dcece6ac45eed4f Mon Sep 17 00:00:00 2001 From: Luke Morrigan Date: Fri, 22 Mar 2024 00:30:57 +0000 Subject: [PATCH 4/5] Revert "Fix the missing error key" This reverts commit 8e6e311bfcc771cb0766ecd6f913f9dcf300992a. --- custom_components/robovac/vacuum.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/custom_components/robovac/vacuum.py b/custom_components/robovac/vacuum.py index 0da7ba2..af87754 100644 --- a/custom_components/robovac/vacuum.py +++ b/custom_components/robovac/vacuum.py @@ -357,13 +357,11 @@ def update_entity_values(self): CONSUMABLE_CODE in self.tuyastatus and self.tuyastatus.get(CONSUMABLE_CODE) is not None ): - consumables = ast.literal_eval( + self._attr_consumables = ast.literal_eval( base64.b64decode(self.tuyastatus.get(CONSUMABLE_CODE)).decode( "ascii" ) - ) - if "consumable" in consumables and "duration" in consumables: - self._attr_consumables = consumables["consumable"]["duration"] + )["consumable"]["duration"] async def async_locate(self, **kwargs): """Locate the vacuum cleaner.""" From 684347247484618a937ca526b5e373bc5d2e5209 Mon Sep 17 00:00:00 2001 From: Luke Bonaccorsi Date: Fri, 22 Mar 2024 00:35:35 +0000 Subject: [PATCH 5/5] fix: re-add consumables code --- custom_components/robovac/vacuum.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/custom_components/robovac/vacuum.py b/custom_components/robovac/vacuum.py index af87754..48ffafa 100644 --- a/custom_components/robovac/vacuum.py +++ b/custom_components/robovac/vacuum.py @@ -357,11 +357,16 @@ def update_entity_values(self): CONSUMABLE_CODE in self.tuyastatus and self.tuyastatus.get(CONSUMABLE_CODE) is not None ): - self._attr_consumables = ast.literal_eval( + consumables = ast.literal_eval( base64.b64decode(self.tuyastatus.get(CONSUMABLE_CODE)).decode( "ascii" ) - )["consumable"]["duration"] + ) + if ( + "consumable" in consumables + and "duration" in consumables["consumable"] + ): + self._attr_consumables = consumables["consumable"]["duration"] async def async_locate(self, **kwargs): """Locate the vacuum cleaner."""