Browse Source

fix (infrared): reduce threshold for splitting commands

- reduce from 65535 to 50000us
- add .0 in sleep time calculation to ensure floating point arithmetic
Jason Rumney 5 days ago
parent
commit
4309c386a1
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

@@ -48,11 +48,11 @@ class TuyaLocalInfrared(TuyaLocalEntity, InfraredEntity):
         raw = []
         i = 0
         for timing in timings:
-            if timing.high_us > 65535:
+            if timing.high_us > 50000:
                 split[i] = timing.high_us
                 raw.append(0)
                 raw.append(timing.low_us)
-            elif timing.low_us > 65535:
+            elif timing.low_us > 50000:
                 raw.append(timing.high_us)
                 raw.append(0)
                 split[i + 2] = timing.low_us
@@ -69,7 +69,7 @@ class TuyaLocalInfrared(TuyaLocalEntity, InfraredEntity):
             )
             start = s
             await self._ir_send(tuya_command)
-            await asyncio.sleep(t / 1000000)
+            await asyncio.sleep(t / 1000000.0)
         if start < len(raw):
             tuya_command = IR.pulses_to_base64(raw[start:])
             _LOGGER.info(