From 4515ba0ea563eaf63c70d07b4d10e2bdf01c4be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=BE=E5=90=AF?= <18442047+tsutsuku@users.noreply.github.com> Date: Wed, 30 Jun 2021 21:26:53 +0800 Subject: [PATCH] [fix] vacuum cleaner send command --- custom_components/tuya_v2/vacuum.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/custom_components/tuya_v2/vacuum.py b/custom_components/tuya_v2/vacuum.py index 6d17237..3e36d7f 100644 --- a/custom_components/tuya_v2/vacuum.py +++ b/custom_components/tuya_v2/vacuum.py @@ -160,9 +160,7 @@ def start(self, **kwargs: Any) -> None: """Turn the device on.""" _LOGGER.debug(f"Starting {self.name}") - self.tuya_device_manager.sendCommands( - self.tuya_device.id, [{"code": DPCODE_POWER_GO, "value": True}] - ) + self._send_command([{"code": DPCODE_POWER_GO, "value": True}]) # Turn off/pause/stop all do the same thing @@ -176,16 +174,12 @@ def start(self, **kwargs: Any) -> None: def stop(self, **kwargs: Any) -> None: """Turn the device off.""" _LOGGER.debug(f"Stopping {self.name}") - self.tuya_device_manager.sendCommands( - self.tuya_device.id, [{"code": DPCODE_POWER_GO, "value": False}] - ) + self._send_command([{"code": DPCODE_POWER_GO, "value": False}]) def pause(self, **kwargs: Any) -> None: """Pause the device.""" _LOGGER.debug(f"Pausing {self.name}") - self.tuya_device_manager.sendCommands( - self.tuya_device.id, [{"code": DPCODE_PAUSE, "value": True}] - ) + self._send_command([{"code": DPCODE_PAUSE, "value": True}]) # def start_pause(self, **kwargs: Any) -> None: # """Start/Pause the device""" @@ -199,6 +193,4 @@ def pause(self, **kwargs: Any) -> None: def return_to_base(self, **kwargs: Any) -> None: """Return device to Dock""" _LOGGER.debug(f"Return to base device {self.name}") - self.tuya_device_manager.sendCommands( - self.tuya_device.id, [{"code": DPCODE_MODE, "value": "chargego"}] - ) + self._send_command([{"code": DPCODE_MODE, "value": "chargego"}])