Browse Source

fix (infrared): _ir_send must be async

Jason Rumney 2 days ago
parent
commit
ba080cc0cf
1 changed files with 3 additions and 3 deletions
  1. 3 3
      custom_components/tuya_local/infrared.py

+ 3 - 3
custom_components/tuya_local/infrared.py

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