4
0
Эх сурвалжийг харах

fix (infrared): _ir_send must be async

Jason Rumney 1 сар өмнө
parent
commit
ba080cc0cf

+ 3 - 3
custom_components/tuya_local/infrared.py

@@ -63,15 +63,15 @@ class TuyaLocalInfrared(TuyaLocalEntity, InfraredEntity):
         for s, t in split:
             tuya_command = IR.pulses_to_base64(raw[start:s])
             _LOGGER.debug("Sending infrared command: %s", tuya_command)
-            self._ir_send(tuya_command)
             start = s
+            await self._ir_send(tuya_command)
             asyncio.sleep(t / 1000000)
         if start < len(raw):
             tuya_command = IR.pulses_to_base64(raw[start:])
             _LOGGER.debug("Sending infrared command: %s", tuya_command)
-            self._ir_send(tuya_command)
+            await self._ir_send(tuya_command)
 
-    def _ir_send(self, tuya_command: str):
+    async def _ir_send(self, tuya_command: str):
         """Send the infrared command to the device."""
         if self._send_dp:
             if self._command_dp: