From c8041ac98e0b05943496f9364e68526117e8a1d1 Mon Sep 17 00:00:00 2001 From: Glen Akins Date: Wed, 17 Jan 2024 16:19:13 -0700 Subject: [PATCH] fix chase when the number of colors in the colors list is not exactly six --- examples/Contrib/XmCosyStringLight-example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Contrib/XmCosyStringLight-example.py b/examples/Contrib/XmCosyStringLight-example.py index 4a15d5d1..70195b57 100644 --- a/examples/Contrib/XmCosyStringLight-example.py +++ b/examples/Contrib/XmCosyStringLight-example.py @@ -107,7 +107,7 @@ def xmcosy_string_lights_encode_colors (lights, colors, offset): # make the colors chase down the string d = tinytuya.BulbDevice(DEVICE_ID, DEVICE_IP, DEVICE_KEY, version=DEVICE_VER, persist=False) while True: - for i in range (6): - d102 = xmcosy_string_lights_encode_colors (lights, colors, 5-i) + for i in range (len(colors)): + d102 = xmcosy_string_lights_encode_colors (lights, colors, len(colors)-1-i) d.set_value (102, d102) time.sleep(1)