Просмотр исходного кода

fix (infrared): Limit long pulses to 65.535ms

Tuya native format uses 16 bit integers, so remote pulses longer than
65.535ms cannot be encoded. The best we can do is emit a 65.535ms pulse
instead.
Jason Rumney 5 дней назад
Родитель
Сommit
9b609841e1
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      custom_components/tuya_local/infrared.py

+ 1 - 1
custom_components/tuya_local/infrared.py

@@ -45,7 +45,7 @@ class TuyaLocalInfrared(TuyaLocalEntity, InfraredEntity):
         raw = [
             interval
             for timing in timings
-            for interval in (timing.high_us, timing.low_us)
+            for interval in (min(timing.high_us, 65535), min(timing.low_us, 65535)))
         ]
         tuya_command = IR.pulses_to_base64(raw)
         _LOGGER.debug("Sending infrared command: %s", tuya_command)