Ver Fonte

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 há 1 mês atrás
pai
commit
9b609841e1
1 ficheiros alterados com 1 adições e 1 exclusões
  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 = [
         raw = [
             interval
             interval
             for timing in timings
             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)
         tuya_command = IR.pulses_to_base64(raw)
         _LOGGER.debug("Sending infrared command: %s", tuya_command)
         _LOGGER.debug("Sending infrared command: %s", tuya_command)