| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
from typing import cast |
| 4 |
|
| 5 |
from .const import MultiColorEffects |
| 6 |
|
| 7 |
EFFECT_COLORLOOP = "colorloop" |
| 8 |
EFFECT_RED_FADE = "red_fade" |
| 9 |
EFFECT_GREEN_FADE = "green_fade" |
| 10 |
EFFECT_BLUE_FADE = "blue_fade" |
| 11 |
EFFECT_YELLOW_FADE = "yellow_fade" |
| 12 |
EFFECT_CYAN_FADE = "cyan_fade" |
| 13 |
EFFECT_PURPLE_FADE = "purple_fade" |
| 14 |
EFFECT_WHITE_FADE = "white_fade" |
| 15 |
EFFECT_RED_GREEN_BLUE_CROSS_FADE = "rgb_cross_fade" |
| 16 |
EFFECT_RED_GREEN_CROSS_FADE = "rg_cross_fade" |
| 17 |
EFFECT_RED_BLUE_CROSS_FADE = "rb_cross_fade" |
| 18 |
EFFECT_GREEN_BLUE_CROSS_FADE = "gb_cross_fade" |
| 19 |
EFFECT_COLORSTROBE = "colorstrobe" |
| 20 |
EFFECT_RED_STROBE = "red_strobe" |
| 21 |
EFFECT_GREEN_STROBE = "green_strobe" |
| 22 |
EFFECT_BLUE_STROBE = "blue_strobe" |
| 23 |
EFFECT_YELLOW_STROBE = "yellow_strobe" |
| 24 |
EFFECT_CYAN_STROBE = "cyan_strobe" |
| 25 |
EFFECT_PURPLE_STROBE = "purple_strobe" |
| 26 |
EFFECT_WHITE_STROBE = "white_strobe" |
| 27 |
EFFECT_CYCLE_RGB = "cycle_rgb" |
| 28 |
EFFECT_CYCLE_SEVEN_COLORS = "cycle_seven_colors" |
| 29 |
EFFECT_COLORJUMP = "colorjump" |
| 30 |
EFFECT_CUSTOM = "custom" |
| 31 |
|
| 32 |
EFFECT_WARM_FLASH = "Warm Flash" |
| 33 |
EFFECT_COOL_FLASH = "Cool Flash" |
| 34 |
EFFECT_WARM_GRADUAL = "Warm Gradual" |
| 35 |
EFFECT_COOL_GRADUAL = "Cool Gradual" |
| 36 |
|
| 37 |
EFFECT_MAP = { |
| 38 |
EFFECT_COLORLOOP: 0x25, |
| 39 |
EFFECT_RED_FADE: 0x26, |
| 40 |
EFFECT_GREEN_FADE: 0x27, |
| 41 |
EFFECT_BLUE_FADE: 0x28, |
| 42 |
EFFECT_YELLOW_FADE: 0x29, |
| 43 |
EFFECT_CYAN_FADE: 0x2A, |
| 44 |
EFFECT_PURPLE_FADE: 0x2B, |
| 45 |
EFFECT_WHITE_FADE: 0x2C, |
| 46 |
EFFECT_RED_GREEN_CROSS_FADE: 0x2D, |
| 47 |
EFFECT_RED_BLUE_CROSS_FADE: 0x2E, |
| 48 |
EFFECT_GREEN_BLUE_CROSS_FADE: 0x2F, |
| 49 |
EFFECT_COLORSTROBE: 0x30, |
| 50 |
EFFECT_RED_STROBE: 0x31, |
| 51 |
EFFECT_GREEN_STROBE: 0x32, |
| 52 |
EFFECT_BLUE_STROBE: 0x33, |
| 53 |
EFFECT_YELLOW_STROBE: 0x34, |
| 54 |
EFFECT_CYAN_STROBE: 0x35, |
| 55 |
EFFECT_PURPLE_STROBE: 0x36, |
| 56 |
EFFECT_WHITE_STROBE: 0x37, |
| 57 |
EFFECT_COLORJUMP: 0x38, |
| 58 |
} |
| 59 |
EFFECT_MAP_DIMMABLE = { |
| 60 |
EFFECT_RED_GREEN_BLUE_CROSS_FADE: 0x24, |
| 61 |
**EFFECT_MAP, |
| 62 |
EFFECT_CYCLE_RGB: 0x39, |
| 63 |
EFFECT_CYCLE_SEVEN_COLORS: 0x3A, |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
EFFECT_MAP_LEGACY_CCT = { |
| 70 |
EFFECT_WARM_GRADUAL: 0x3A, |
| 71 |
EFFECT_WARM_FLASH: 0x3C, |
| 72 |
EFFECT_COOL_GRADUAL: 0x4A, |
| 73 |
EFFECT_COOL_FLASH: 0x4C, |
| 74 |
} |
| 75 |
|
| 76 |
EFFECT_ID_NAME_LEGACY_CCT = {v: k for k, v in EFFECT_MAP_LEGACY_CCT.items()} |
| 77 |
EFFECT_ID_NAME = {v: k for k, v in EFFECT_MAP_DIMMABLE.items()} |
| 78 |
EFFECT_CUSTOM_CODE = 0x60 |
| 79 |
|
| 80 |
EFFECT_LIST = sorted(EFFECT_MAP) |
| 81 |
EFFECT_LIST_DIMMABLE = sorted(EFFECT_MAP_DIMMABLE) |
| 82 |
EFFECT_LIST_LEGACY_CCT = sorted(EFFECT_MAP_LEGACY_CCT) |
| 83 |
|
| 84 |
ADDRESSABLE_EFFECT_ID_NAME = { |
| 85 |
1: "RBM 1", |
| 86 |
2: "RBM 2", |
| 87 |
3: "RBM 3", |
| 88 |
4: "RBM 4", |
| 89 |
5: "RBM 5", |
| 90 |
6: "RBM 6", |
| 91 |
7: "RBM 7", |
| 92 |
8: "RBM 8", |
| 93 |
9: "RBM 9", |
| 94 |
10: "RBM 10", |
| 95 |
11: "RBM 11", |
| 96 |
12: "RBM 12", |
| 97 |
13: "RBM 13", |
| 98 |
14: "RBM 14", |
| 99 |
15: "RBM 15", |
| 100 |
16: "RBM 16", |
| 101 |
17: "RBM 17", |
| 102 |
18: "RBM 18", |
| 103 |
19: "RBM 19", |
| 104 |
20: "RBM 20", |
| 105 |
21: "RBM 21", |
| 106 |
22: "RBM 22", |
| 107 |
23: "RBM 23", |
| 108 |
24: "RBM 24", |
| 109 |
25: "RBM 25", |
| 110 |
26: "RBM 26", |
| 111 |
27: "RBM 27", |
| 112 |
28: "RBM 28", |
| 113 |
29: "RBM 29", |
| 114 |
30: "RBM 30", |
| 115 |
31: "RBM 31", |
| 116 |
32: "RBM 32", |
| 117 |
33: "RBM 33", |
| 118 |
34: "RBM 34", |
| 119 |
35: "RBM 35", |
| 120 |
36: "RBM 36", |
| 121 |
37: "RBM 37", |
| 122 |
38: "RBM 38", |
| 123 |
39: "RBM 39", |
| 124 |
40: "RBM 40", |
| 125 |
41: "RBM 41", |
| 126 |
42: "RBM 42", |
| 127 |
43: "RBM 43", |
| 128 |
44: "RBM 44", |
| 129 |
45: "RBM 45", |
| 130 |
46: "RBM 46", |
| 131 |
47: "RBM 47", |
| 132 |
48: "RBM 48", |
| 133 |
49: "RBM 49", |
| 134 |
50: "RBM 50", |
| 135 |
51: "RBM 51", |
| 136 |
52: "RBM 52", |
| 137 |
53: "RBM 53", |
| 138 |
54: "RBM 54", |
| 139 |
55: "RBM 55", |
| 140 |
56: "RBM 56", |
| 141 |
57: "RBM 57", |
| 142 |
58: "RBM 58", |
| 143 |
59: "RBM 59", |
| 144 |
60: "RBM 60", |
| 145 |
61: "RBM 61", |
| 146 |
62: "RBM 62", |
| 147 |
63: "RBM 63", |
| 148 |
64: "RBM 64", |
| 149 |
65: "RBM 65", |
| 150 |
66: "RBM 66", |
| 151 |
67: "RBM 67", |
| 152 |
68: "RBM 68", |
| 153 |
69: "RBM 69", |
| 154 |
70: "RBM 70", |
| 155 |
71: "RBM 71", |
| 156 |
72: "RBM 72", |
| 157 |
73: "RBM 73", |
| 158 |
74: "RBM 74", |
| 159 |
75: "RBM 75", |
| 160 |
76: "RBM 76", |
| 161 |
77: "RBM 77", |
| 162 |
78: "RBM 78", |
| 163 |
79: "RBM 79", |
| 164 |
80: "RBM 80", |
| 165 |
81: "RBM 81", |
| 166 |
82: "RBM 82", |
| 167 |
83: "RBM 83", |
| 168 |
84: "RBM 84", |
| 169 |
85: "RBM 85", |
| 170 |
86: "RBM 86", |
| 171 |
87: "RBM 87", |
| 172 |
88: "RBM 88", |
| 173 |
89: "RBM 89", |
| 174 |
90: "RBM 90", |
| 175 |
91: "RBM 91", |
| 176 |
92: "RBM 92", |
| 177 |
93: "RBM 93", |
| 178 |
94: "RBM 94", |
| 179 |
95: "RBM 95", |
| 180 |
96: "RBM 96", |
| 181 |
97: "RBM 97", |
| 182 |
98: "RBM 98", |
| 183 |
99: "RBM 99", |
| 184 |
100: "RBM 100", |
| 185 |
101: "RBM 101", |
| 186 |
102: "RBM 102", |
| 187 |
255: "Circulate all modes", |
| 188 |
} |
| 189 |
ADDRESSABLE_EFFECT_NAME_ID = {v: k for k, v in ADDRESSABLE_EFFECT_ID_NAME.items()} |
| 190 |
|
| 191 |
ASSESSABLE_MULTI_COLOR_ID_NAME = { |
| 192 |
MultiColorEffects.STATIC.value: "Multi Color Static", |
| 193 |
MultiColorEffects.RUNNING_WATER.value: "Multi Color Running Water", |
| 194 |
MultiColorEffects.STROBE.value: "Multi Color Strobe", |
| 195 |
MultiColorEffects.JUMP.value: "Multi Color Jump", |
| 196 |
MultiColorEffects.BREATHING.value: "Multi Color Breathing", |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
ASSESSABLE_MULTI_COLOR_NAME_ID = { |
| 201 |
v: k for k, v in ASSESSABLE_MULTI_COLOR_ID_NAME.items() |
| 202 |
} |
| 203 |
|
| 204 |
ORIGINAL_ADDRESSABLE_EFFECT_ID_NAME = { |
| 205 |
1: "Circulate all modes", |
| 206 |
2: "7 colors change gradually", |
| 207 |
3: "7 colors run in olivary", |
| 208 |
4: "7 colors change quickly", |
| 209 |
5: "7 colors strobe-flash", |
| 210 |
6: "7 colors running, 1 point from start to end and return back", |
| 211 |
7: "7 colors running, multi points from start to end and return back", |
| 212 |
8: "7 colors overlay, multi points from start to end and return back", |
| 213 |
9: "7 colors overlay, multi points from the middle to the both ends and return back", |
| 214 |
10: "7 colors flow gradually, from start to end and return back", |
| 215 |
11: "Fading out run, 7 colors from start to end and return back", |
| 216 |
12: "Runs in olivary, 7 colors from start to end and return back", |
| 217 |
13: "Fading out run, 7 colors start with white color from start to end and return back", |
| 218 |
14: "Run circularly, 7 colors with black background, 1point from start to end", |
| 219 |
15: "Run circularly, 7 colors with red background, 1point from start to end", |
| 220 |
16: "Run circularly, 7 colors with green background, 1point from start to end", |
| 221 |
17: "Run circularly, 7 colors with blue background, 1point from start to end", |
| 222 |
18: "Run circularly, 7 colors with yellow background, 1point from start to end", |
| 223 |
19: "Run circularly, 7 colors with purple background, 1point from start to end", |
| 224 |
20: "Run circularly, 7 colors with cyan background, 1point from start to end", |
| 225 |
21: "Run circularly, 7 colors with white background, 1point from start to end", |
| 226 |
22: "Run circularly, 7 colors with black background, 1point from end to start", |
| 227 |
23: "Run circularly, 7 colors with red background, 1point from end to start", |
| 228 |
24: "Run circularly, 7 colors with green background, 1point from end to start", |
| 229 |
25: "Run circularly, 7 colors with blue background, 1point from end to start", |
| 230 |
26: "Run circularly, 7 colors with yellow background, 1point from end to start", |
| 231 |
27: "Run circularly, 7 colors with purple background, 1point from end to start", |
| 232 |
28: "Run circularly, 7 colors with cyan background, 1point from end to start", |
| 233 |
29: "Run circularly, 7 colors with white background, 1point from end to start", |
| 234 |
30: "Run circularly, 7 colors with black background, 1point from start to end and return back", |
| 235 |
31: "Run circularly, 7 colors with red background, 1point from start to end and return back", |
| 236 |
32: "Run circularly, 7 colors with green background, 1point from start to end and return back", |
| 237 |
33: "Run circularly, 7 colors with blue background, 1point from start to end and return back", |
| 238 |
34: "Run circularly, 7 colors with yellow background, 1point from start to end and return back", |
| 239 |
35: "Run circularly, 7 colors with purple background, 1point from start to end and return back", |
| 240 |
36: "Run circularly, 7 colors with cyan background, 1point from start to end and return back", |
| 241 |
37: "Run circularly, 7 colors with white background, 1point from start to end and return back", |
| 242 |
38: "Run circularly, 7 colors with black background, 1point from middle to both ends", |
| 243 |
39: "Run circularly, 7 colors with red background, 1point from middle to both ends", |
| 244 |
40: "Run circularly, 7 colors with green background, 1point from middle to both ends", |
| 245 |
41: "Run circularly, 7 colors with blue background, 1point from middle to both ends", |
| 246 |
42: "Run circularly, 7 colors with yellow background, 1point from middle to both ends", |
| 247 |
43: "Run circularly, 7 colors with purple background, 1point from middle to both ends", |
| 248 |
44: "Run circularly, 7 colors with cyan background, 1point from middle to both ends", |
| 249 |
45: "Run circularly, 7 colors with white background, 1point from middle to both ends", |
| 250 |
46: "Run circularly, 7 colors with black background, 1point from both ends to middle", |
| 251 |
47: "Run circularly, 7 colors with red background, 1point from both ends to middle", |
| 252 |
48: "Run circularly, 7 colors with green background, 1point from both ends to middle", |
| 253 |
49: "Run circularly, 7 colors with blue background, 1point from both ends to middle", |
| 254 |
50: "Run circularly, 7 colors with yellow background, 1point from both ends to middle", |
| 255 |
51: "Run circularly, 7 colors with purple background, 1point from both ends to middle", |
| 256 |
52: "Run circularly, 7 colors with cyan background, 1point from both ends to middle", |
| 257 |
53: "Run circularly, 7 colors with white background, 1point from both ends to middle", |
| 258 |
54: "Run circularly, 7 colors with black background, 1point from middle to both ends and return back", |
| 259 |
55: "Run circularly, 7 colors with red background, 1point from middle to both ends and return back", |
| 260 |
56: "Run circularly, 7 colors with green background, 1point from middle to both ends and return back", |
| 261 |
57: "Run circularly, 7 colors with blue background, 1point from middle to both ends and return back", |
| 262 |
58: "Run circularly, 7 colors with yellow background, 1point from middle to both ends and return back", |
| 263 |
59: "Run circularly, 7 colors with purple background, 1point from middle to both ends and return back", |
| 264 |
60: "Run circularly, 7 colors with cyan background, 1point from middle to both ends and return back", |
| 265 |
61: "Run circularly, 7 colors with white background, 1point from middle to both ends and return back", |
| 266 |
62: "Overlay circularly, 7 colors with black background from start to end", |
| 267 |
63: "Overlay circularly, 7 colors with red background from start to end", |
| 268 |
64: "Overlay circularly, 7 colors with green background from start to end", |
| 269 |
65: "Overlay circularly, 7 colors with blue background from start to end", |
| 270 |
66: "Overlay circularly, 7 colors with yellow background from start to end", |
| 271 |
67: "Overlay circularly, 7 colors with purple background from start to end", |
| 272 |
68: "Overlay circularly, 7 colors with cyan background from start to end", |
| 273 |
69: "Overlay circularly, 7 colors with white background from start to end", |
| 274 |
70: "Overlay circularly, 7 colors with black background from end to start", |
| 275 |
71: "Overlay circularly, 7 colors with red background from end to start", |
| 276 |
72: "Overlay circularly, 7 colors with green background from end to start", |
| 277 |
73: "Overlay circularly, 7 colors with blue background from end to start", |
| 278 |
74: "Overlay circularly, 7 colors with yellow background from end to start", |
| 279 |
75: "Overlay circularly, 7 colors with purple background from end to start", |
| 280 |
76: "Overlay circularly, 7 colors with cyan background from end to start", |
| 281 |
77: "Overlay circularly, 7 colors with white background from end to start", |
| 282 |
78: "Overlay circularly, 7 colors with black background from start to end and return back", |
| 283 |
79: "Overlay circularly, 7 colors with red background from start to end and return back", |
| 284 |
80: "Overlay circularly, 7 colors with green background from start to end and return back", |
| 285 |
81: "Overlay circularly, 7 colors with blue background from start to end and return back", |
| 286 |
82: "Overlay circularly, 7 colors with yellow background from start to end and return back", |
| 287 |
83: "Overlay circularly, 7 colors with purple background from start to end and return back", |
| 288 |
84: "Overlay circularly, 7 colors with cyan background from start to end and return back", |
| 289 |
85: "Overlay circularly, 7 colors with white background from start to end and return back", |
| 290 |
86: "Overlay circularly, 7 colors with black background from middle to both ends", |
| 291 |
87: "Overlay circularly, 7 colors with red background from middle to both ends", |
| 292 |
88: "Overlay circularly, 7 colors with green background from middle to both ends", |
| 293 |
89: "Overlay circularly, 7 colors with blue background from middle to both ends", |
| 294 |
90: "Overlay circularly, 7 colors with yellow background from middle to both ends", |
| 295 |
91: "Overlay circularly, 7 colors with purple background from middle to both ends", |
| 296 |
92: "Overlay circularly, 7 colors with cyan background from middle to both ends", |
| 297 |
93: "Overlay circularly, 7 colors with white background from middle to both ends", |
| 298 |
94: "Overlay circularly, 7 colors with black background from both ends to middle", |
| 299 |
95: "Overlay circularly, 7 colors with red background from both ends to middle", |
| 300 |
96: "Overlay circularly, 7 colors with green background from both ends to middle", |
| 301 |
97: "Overlay circularly, 7 colors with blue background from both ends to middle", |
| 302 |
98: "Overlay circularly, 7 colors with yellow background from both ends to middle", |
| 303 |
99: "Overlay circularly, 7 colors with purple background from both ends to middle", |
| 304 |
100: "Overlay circularly, 7 colors with cyan background from both ends to middle", |
| 305 |
101: "Overlay circularly, 7 colors with white background from both ends to middle", |
| 306 |
102: "Overlay circularly, 7 colors with black background from middle to both sides and return back", |
| 307 |
103: "Overlay circularly, 7 colors with red background from middle to both sides and return back", |
| 308 |
104: "Overlay circularly, 7 colors with green background from middle to both sides and return back", |
| 309 |
105: "Overlay circularly, 7 colors with blue background from middle to both sides and return back", |
| 310 |
106: "Overlay circularly, 7 colors with yellow background from middle to both sides and return back", |
| 311 |
107: "Overlay circularly, 7 colors with purple background from middle to both sides and return back", |
| 312 |
108: "Overlay circularly, 7 colors with cyan background from middle to both sides and return back", |
| 313 |
109: "Overlay circularly, 7 colors with white background from middle to both sides and return back", |
| 314 |
110: "Fading out run circularly, 1point with black background from start to end", |
| 315 |
111: "Fading out run circularly, 1point with red background from start to end", |
| 316 |
112: "Fading out run circularly, 1point with green background from start to end", |
| 317 |
113: "Fading out run circularly, 1point with blue background from start to end", |
| 318 |
114: "Fading out run circularly, 1point with yellow background from start to end", |
| 319 |
115: "Fading out run circularly, 1point with purple background from start to end", |
| 320 |
116: "Fading out run circularly, 1point with cyan background from start to end", |
| 321 |
117: "Fading out run circularly, 1point with white background from start to end", |
| 322 |
118: "Fading out run circularly, 1point with black background from end to start", |
| 323 |
119: "Fading out run circularly, 1point with red background from end to start", |
| 324 |
120: "Fading out run circularly, 1point with green background from end to start", |
| 325 |
121: "Fading out run circularly, 1point with blue background from end to start", |
| 326 |
122: "Fading out run circularly, 1point with yellow background from end to start", |
| 327 |
123: "Fading out run circularly, 1point with purple background from end to start", |
| 328 |
124: "Fading out run circularly, 1point with cyan background from end to start", |
| 329 |
125: "Fading out run circularly, 1point with white background from end to start", |
| 330 |
126: "Fading out run circularly, 1point with black background from start to end and return back", |
| 331 |
127: "Fading out run circularly, 1point with red background from start to end and return back", |
| 332 |
128: "Fading out run circularly, 1point with green background from start to end and return back", |
| 333 |
129: "Fading out run circularly, 1point with blue background from start to end and return back", |
| 334 |
130: "Fading out run circularly, 1point with yellow background from start to end and return back", |
| 335 |
131: "Fading out run circularly, 1point with purple background from start to end and return back", |
| 336 |
132: "Fading out run circularly, 1point with cyan background from start to end and return back", |
| 337 |
133: "Fading out run circularly, 1point with white background from start to end and return back", |
| 338 |
134: "Flows in olivary circularly, 7 colors with black background from start to end", |
| 339 |
135: "Flows in olivary circularly, 7 colors with red background from start to end", |
| 340 |
136: "Flows in olivary circularly, 7 colors with green background from start to end", |
| 341 |
137: "Flows in olivary circularly, 7 colors with blue background from start to end", |
| 342 |
138: "Flows in olivary circularly, 7 colors with yellow background from start to end", |
| 343 |
139: "Flows in olivary circularly, 7 colors with purple background from start to end", |
| 344 |
140: "Flows in olivary circularly, 7 colors with cyan background from start to end", |
| 345 |
141: "Flows in olivary circularly, 7 colors with white background from start to end", |
| 346 |
142: "Flows in olivary circularly, 7 colors with black background from end to start", |
| 347 |
143: "Flows in olivary circularly, 7 colors with red background from end to start", |
| 348 |
144: "Flows in olivary circularly, 7 colors with green background from end to start", |
| 349 |
145: "Flows in olivary circularly, 7 colors with blue background from end to start", |
| 350 |
146: "Flows in olivary circularly, 7 colors with yellow background from end to start", |
| 351 |
147: "Flows in olivary circularly, 7 colors with purple background from end to start", |
| 352 |
148: "Flows in olivary circularly, 7 colors with cyan background from end to start", |
| 353 |
149: "Flows in olivary circularly, 7 colors with white background from end to start", |
| 354 |
150: "Flows in olivary circularly, 7 colors with black background from start to end and return back", |
| 355 |
151: "Flows in olivary circularly, 7 colors with red background from start to end and return back", |
| 356 |
152: "Flows in olivary circularly, 7 colors with green background from start to end and return back", |
| 357 |
153: "Flows in olivary circularly, 7 colors with blue background from start to end and return back", |
| 358 |
154: "Flows in olivary circularly, 7 colors with yellow background from start to end and return back", |
| 359 |
155: "Flows in olivary circularly, 7 colors with purple background from start to end and return back", |
| 360 |
156: "Flows in olivary circularly, 7 colors with cyan background from start to end and return back", |
| 361 |
157: "Flows in olivary circularly, 7 colors with white background from start to end and return back", |
| 362 |
158: "7 colors run circularly, each color in every 1 point with black background from start to end", |
| 363 |
159: "7 colors run circularly, each color in every 1 point with red background from start to end", |
| 364 |
160: "7 colors run circularly, each color in every 1 point with green background from start to end", |
| 365 |
161: "7 colors run circularly, each color in every 1 point with blue background from start to end", |
| 366 |
162: "7 colors run circularly, each color in every 1 point with yellow background from start to end", |
| 367 |
163: "7 colors run circularly, each color in every 1 point with purple background from start to end", |
| 368 |
164: "7 colors run circularly, each color in every 1 point with cyan background from start to end", |
| 369 |
165: "7 colors run circularly, each color in every 1 point with white background from start to end", |
| 370 |
166: "7 colors run circularly, each color in every 1 point with black background from end to start", |
| 371 |
167: "7 colors run circularly, each color in every 1 point with red background from end to start", |
| 372 |
168: "7 colors run circularly, each color in every 1 point with green background from end to start", |
| 373 |
169: "7 colors run circularly, each color in every 1 point with blue background from end to start", |
| 374 |
170: "7 colors run circularly, each color in every 1 point with yellow background from end to start", |
| 375 |
171: "7 colors run circularly, each color in every 1 point with purple background from end to start", |
| 376 |
172: "7 colors run circularly, each color in every 1 point with cyan background from end to start", |
| 377 |
173: "7 colors run circularly, each color in every 1 point with white background from end to start", |
| 378 |
174: "7 colors run circularly, each color in every 1 point with black background from start to end and return back", |
| 379 |
175: "7 colors run circularly, each color in every 1 point with red background from start to end and return back", |
| 380 |
176: "7 colors run circularly, each color in every 1 point with green background from start to end and return back", |
| 381 |
177: "7 colors run circularly, each color in every 1 point with blue background from start to end and return back", |
| 382 |
178: "7 colors run circularly, each color in every 1 point with yellow background from start to end and return back", |
| 383 |
179: "7 colors run circularly, each color in every 1 point with purple background from start to end and return back", |
| 384 |
180: "7 colors run circularly, each color in every 1 point with cyan background from start to end and return back", |
| 385 |
181: "7 colors run circularly, each color in every 1 point with white background from start to end and return back", |
| 386 |
182: "7 colors run circularly, each color in multi points with red background from start to end", |
| 387 |
183: "7 colors run circularly, each color in multi points with green background from start to end", |
| 388 |
184: "7 colors run circularly, each color in multi points with blue background from start to end", |
| 389 |
185: "7 colors run circularly, each color in multi points with yellow background from start to end", |
| 390 |
186: "7 colors run circularly, each color in multi points with purple background from start to end", |
| 391 |
187: "7 colors run circularly, each color in multi points with cyan background from start to end", |
| 392 |
188: "7 colors run circularly, each color in multi points with white background from start to end", |
| 393 |
189: "7 colors run circularly, each color in multi points with red background from end to start", |
| 394 |
190: "7 colors run circularly, each color in multi points with green background from end to start", |
| 395 |
191: "7 colors run circularly, each color in multi points with blue background from end to start", |
| 396 |
192: "7 colors run circularly, each color in multi points with yellow background from end to start", |
| 397 |
193: "7 colors run circularly, each color in multi points with purple background from end to start", |
| 398 |
194: "7 colors run circularly, each color in multi points with cyan background from end to start", |
| 399 |
195: "7 colors run circularly, each color in multi points with white background from end to start", |
| 400 |
196: "7 colors run circularly, each color in multi points with red background from start to end and return back", |
| 401 |
197: "7 colors run circularly, each color in multi points with green background from start to end and return back", |
| 402 |
198: "7 colors run circularly, each color in multi points with blue background from start to end and return back", |
| 403 |
199: "7 colors run circularly, each color in multi points with yellow background from start to end and return back", |
| 404 |
200: "7 colors run circularly, each color in multi points with purple background from start to end and return back", |
| 405 |
201: "7 colors run circularly, each color in multi points with cyan background from start to end and return back", |
| 406 |
202: "7 colors run circularly, each color in multi points with white background from start to end and return back", |
| 407 |
203: "Fading out run circularly, 7 colors each in red fading from start to end", |
| 408 |
204: "Fading out run circularly, 7 colors each in green fading from start to end", |
| 409 |
205: "Fading out run circularly, 7 colors each in blue fading from start to end", |
| 410 |
206: "Fading out run circularly, 7 colors each in yellow fading from start to end", |
| 411 |
207: "Fading out run circularly, 7 colors each in purple fading from start to end", |
| 412 |
208: "Fading out run circularly, 7 colors each in cyan fading from start to end", |
| 413 |
209: "Fading out run circularly, 7 colors each in white fading from start to end", |
| 414 |
210: "Fading out run circularly, 7 colors each in red fading from end to start", |
| 415 |
211: "Fading out run circularly, 7 colors each in green fading from end to start", |
| 416 |
212: "Fading out run circularly, 7 colors each in blue fading from end to start", |
| 417 |
213: "Fading out run circularly, 7 colors each in yellow fading from end to start", |
| 418 |
214: "Fading out run circularly, 7 colors each in purple fading from end to start", |
| 419 |
215: "Fading out run circularly, 7 colors each in cyan fading from end to start", |
| 420 |
216: "Fading out run circularly, 7 colors each in white fading from end to start", |
| 421 |
217: "Fading out run circularly, 7 colors each in red fading from start to end and return back", |
| 422 |
218: "Fading out run circularly, 7 colors each in green fading from start to end and return back", |
| 423 |
219: "Fading out run circularly, 7 colors each in blue fading from start to end and return back", |
| 424 |
220: "Fading out run circularly, 7 colors each in yellow fading from start to end and return back", |
| 425 |
221: "Fading out run circularly, 7 colors each in purple fading from start to end and return back", |
| 426 |
222: "Fading out run circularly, 7 colors each in cyan fading from start to end and return back", |
| 427 |
223: "Fading out run circularly, 7 colors each in white fading from start to end and return back", |
| 428 |
224: "7 colors each in red run circularly, multi points from start to end", |
| 429 |
225: "7 colors each in green run circularly, multi points from start to end", |
| 430 |
226: "7 colors each in blue run circularly, multi points from start to end", |
| 431 |
227: "7 colors each in yellow run circularly, multi points from start to end", |
| 432 |
228: "7 colors each in purple run circularly, multi points from start to end", |
| 433 |
229: "7 colors each in cyan run circularly, multi points from start to end", |
| 434 |
230: "7 colors each in white run circularly, multi points from start to end", |
| 435 |
231: "7 colors each in red run circularly, multi points from end to start", |
| 436 |
232: "7 colors each in green run circularly, multi points from end to start", |
| 437 |
233: "7 colors each in blue run circularly, multi points from end to start", |
| 438 |
234: "7 colors each in yellow run circularly, multi points from end to start", |
| 439 |
235: "7 colors each in purple run circularly, multi points from end to start", |
| 440 |
236: "7 colors each in cyan run circularly, multi points from end to start", |
| 441 |
237: "7 colors each in white run circularly, multi points from end to start", |
| 442 |
238: "7 colors each in red run circularly, multi points from start to end and return back", |
| 443 |
239: "7 colors each in green run circularly, multi points from start to end and return back", |
| 444 |
240: "and return back7 colors each in blue run circularly, multi points from start to end", |
| 445 |
241: "7 colors each in yellow run circularly, multi points from start to end and return back", |
| 446 |
242: "7 colors each in purple run circularly, multi points from start to end and return back", |
| 447 |
243: "7 colors each in cyan run circularly, multi points from start to end and return back", |
| 448 |
244: "7 colors each in white run circularly, multi points from start to end and return back", |
| 449 |
245: "Flows gradually and circularly, 6 colors with red background from start to end", |
| 450 |
246: "Flows gradually and circularly, 6 colors with green background from start to end", |
| 451 |
247: "Flows gradually and circularly, 6 colors with blue background from start to end", |
| 452 |
248: "Flows gradually and circularly, 6 colors with yellow background from start to end", |
| 453 |
249: "Flows gradually and circularly, 6 colors with purple background from start to end", |
| 454 |
250: "Flows gradually and circularly, 6 colors with cyan background from start to end", |
| 455 |
251: "Flows gradually and circularly, 6 colors with white background from start to end", |
| 456 |
252: "Flows gradually and circularly, 6 colors with red background from end to start", |
| 457 |
253: "Flows gradually and circularly, 6 colors with green background from end to start", |
| 458 |
254: "Flows gradually and circularly, 6 colors with blue background from end to start", |
| 459 |
255: "Flows gradually and circularly, 6 colors with yellow background from end to start", |
| 460 |
256: "Flows gradually and circularly, 6 colors with purple background from end to start", |
| 461 |
257: "Flows gradually and circularly, 6 colors with cyan background from end to start", |
| 462 |
258: "Flows gradually and circularly, 6 colors with white background from end to start", |
| 463 |
259: "Flows gradually and circularly, 6 colors with red background from start to end and return back", |
| 464 |
260: "Flows gradually and circularly, 6 colors with green background from start to end and return back", |
| 465 |
261: "Flows gradually and circularly, 6 colors with blue background from start to end and return back", |
| 466 |
262: "Flows gradually and circularly, 6 colors with yellow background from start to end and return back", |
| 467 |
263: "Flows gradually and circularly, 6 colors with purple background from start to end and return back", |
| 468 |
264: "Flows gradually and circularly, 6 colors with cyan background from start to end and return back", |
| 469 |
265: "Flows gradually and circularly, 6 colors with white background from start to end and return back", |
| 470 |
266: "7 colors run with black background from start to end", |
| 471 |
267: "7 colors run with red background from start to end", |
| 472 |
268: "7 colors run with green background from start to end", |
| 473 |
269: "7 colors run with blue background from start to end", |
| 474 |
270: "7 colors run with yellow background from start to end", |
| 475 |
271: "7 colors run with purple background from start to end", |
| 476 |
272: "7 colors run with cyan background from start to end", |
| 477 |
273: "7 colors run with white background from start to end", |
| 478 |
274: "7 colors run with black background from end to start", |
| 479 |
275: "7 colors run with red background from end to start", |
| 480 |
276: "7 colors run with green background from end to start", |
| 481 |
277: "7 colors run with blue background from end to start", |
| 482 |
278: "7 colors run with yellow background from end to start", |
| 483 |
279: "7 colors run with purple background from end to start", |
| 484 |
280: "7 colors run with cyan background from end to start", |
| 485 |
281: "7 colors run with white background from end to start", |
| 486 |
282: "7 colors run with black background from start to end and return back", |
| 487 |
283: "7 colors run with red background from start to end and return back", |
| 488 |
284: "7 colors run with green background from start to end and return back", |
| 489 |
285: "7 colors run with blue background from start to end and return back", |
| 490 |
286: "7 colors run with yellow background from start to end and return back", |
| 491 |
287: "7 colors run with purple background from start to end and return back", |
| 492 |
288: "7 colors run with cyan background from start to end and return back", |
| 493 |
289: "7 colors run with white background from start to end and return back", |
| 494 |
290: "7 colors run gradually + 7 colors run in olivary", |
| 495 |
291: "7 colors run gradually + 7 colors change quickly", |
| 496 |
292: "7 colors run gradually + 7 colors flash", |
| 497 |
293: "7 colors run in olivary + 7 colors change quickly", |
| 498 |
294: "7 colors run in olivary + 7 colors flash", |
| 499 |
295: "7 colors change quickly + 7 colors flash", |
| 500 |
296: "7 colors run gradually + 7 colors run in olivary + 7 colors change quickly", |
| 501 |
297: "7 colors run gradually + 7 colors run in olivary + 7 colors flash", |
| 502 |
298: "7 colors run gradually + 7 colors change quickly + 7 colors flash", |
| 503 |
299: "7 colors run in olivary + 7 colors change quickly + 7 colors flash", |
| 504 |
300: "7 colors run gradually + 7 colors run in olivary + 7 colors change quickly + 7 color flash", |
| 505 |
} |
| 506 |
ORIGINAL_ADDRESSABLE_EFFECT_NAME_ID = { |
| 507 |
v: k for k, v in ORIGINAL_ADDRESSABLE_EFFECT_ID_NAME.items() |
| 508 |
} |
| 509 |
|
| 510 |
|
| 511 |
CHRISTMAS_ADDRESSABLE_EFFECT_ID_NAME = { |
| 512 |
1: "Random Jump Async", |
| 513 |
2: "Random Gradient Async", |
| 514 |
3: "Fill-in Red, Green", |
| 515 |
4: "Fill-in Green, Blue", |
| 516 |
5: "Fill-in Green, Yellow", |
| 517 |
6: "Fill-in Green, Cyan", |
| 518 |
7: "Fill-in Green, White", |
| 519 |
8: "Fill-in Green, Red", |
| 520 |
9: "Twinkle Red", |
| 521 |
10: "Twinkle Green", |
| 522 |
11: "Twinkle Yellow", |
| 523 |
12: "Twinkle Blue", |
| 524 |
13: "Twinkle Purple", |
| 525 |
14: "Twinkle Cyan", |
| 526 |
15: "Twinkle White", |
| 527 |
16: "Alternating Flash Red, Green, Blue", |
| 528 |
17: "Alternating Flash Red, Green", |
| 529 |
18: "Alternating Flash Green, Blue", |
| 530 |
19: "Alternating Flash Blue, Yellow", |
| 531 |
20: "Alternating Flash Yellow, Cyan", |
| 532 |
21: "Alternating Flash Cyan, Purple", |
| 533 |
22: "Alternating Flash Purple, White", |
| 534 |
23: "Wave Seven-Color", |
| 535 |
24: "Wave RGB", |
| 536 |
25: "Wave Red", |
| 537 |
26: "Wave Green", |
| 538 |
27: "Wave Yellow", |
| 539 |
28: "Wave Blue", |
| 540 |
29: "Wave Purple", |
| 541 |
30: "Wave Cyan", |
| 542 |
31: "Wave White", |
| 543 |
32: "Breathe Sync Seven-Color", |
| 544 |
33: "Breathe Sync RGB", |
| 545 |
34: "Breathe Sync Red, Green", |
| 546 |
35: "Breathe Sync Red, Blue", |
| 547 |
36: "Breathe Sync Green, Blue", |
| 548 |
37: "Breathe Sync Red", |
| 549 |
38: "Breathe Sync Green", |
| 550 |
39: "Breathe Sync Yellow", |
| 551 |
40: "Breathe Sync Blue", |
| 552 |
41: "Breathe Sync Purple", |
| 553 |
42: "Breathe Sync Cyan", |
| 554 |
43: "Breathe Sync White", |
| 555 |
44: "Fill-in and Reset Red, Green", |
| 556 |
45: "Fill-in and Reset Green, Blue", |
| 557 |
46: "Fill-in and Reset Blue, Yellow", |
| 558 |
47: "Fill-in and Reset Yellow, Cyan", |
| 559 |
48: "Fill-in and Reset Cyan, Purple", |
| 560 |
49: "Fill-in and Reset Purple, White", |
| 561 |
50: "Fill-in and Reset Red, Green, Blue, Yellow", |
| 562 |
51: "Fill-in and Reset Red, Blue, Green, White", |
| 563 |
52: "Fill-in and Reset Blue, White, Purple, Yellow", |
| 564 |
53: "Fill-in and Reset White, Purple, Cyan, Green", |
| 565 |
54: "Strobe Red, Green, Blue, Yellow, Cyan, Purple, White", |
| 566 |
55: "Strobe Green, Red, Blue, Yellow, Cyan, Purple, White", |
| 567 |
56: "Strobe Blue, Green, Red, Yellow, Cyan, Purple, White", |
| 568 |
57: "Strobe Yellow, Green, Blue, Red, Cyan, Purple, White", |
| 569 |
58: "Strobe Cyan, Green, Blue, Yellow, Red, Purple, White", |
| 570 |
59: "Strobe Purple, Green, Blue, Yellow, Cyan, Red, White", |
| 571 |
60: "Strobe White, Green, Blue, Yellow, Cyan, Purple, Red", |
| 572 |
61: "Strobe Red, Green", |
| 573 |
62: "Strobe Green, Blue", |
| 574 |
63: "Strobe Blue, Yellow", |
| 575 |
64: "Strobe Yellow, Cyan", |
| 576 |
65: "Strobe Cyan, Purple", |
| 577 |
66: "Strobe Purple, White", |
| 578 |
67: "Strobe Black, White", |
| 579 |
68: "Flash Sync Seven-color", |
| 580 |
69: "Flash Sync RGB", |
| 581 |
70: "Flash Sync Red", |
| 582 |
71: "Flash Sync Green", |
| 583 |
72: "Flash Sync Yellow", |
| 584 |
73: "Flash Sync Blue", |
| 585 |
74: "Flash Sync Purple", |
| 586 |
75: "Flash Sync Cyan", |
| 587 |
76: "Jump Sync Seven-color", |
| 588 |
77: "Jump Sync RGB", |
| 589 |
78: "Jump Sync Red", |
| 590 |
79: "Jump Sync Green", |
| 591 |
80: "Jump Sync Yellow", |
| 592 |
81: "Jump Sync Blue", |
| 593 |
82: "Jump Sync Purple", |
| 594 |
83: "Jump Sync Cyan", |
| 595 |
84: "Red Wave, Breathe Sync, Flash, Jump", |
| 596 |
85: "Green Wave, Breathe Sync, Flash, Jump", |
| 597 |
86: "Yellow Wave, Breathe Sync, Flash, Jump", |
| 598 |
87: "Blue Wave, Breathe Sync, Flash, Jump", |
| 599 |
88: "Purple Wave, Breathe Sync, Flash, Jump", |
| 600 |
89: "Cyan Wave, Breathe Sync, Flash, Jump", |
| 601 |
90: "White Wave, Breathe Sync, Flash, Jump", |
| 602 |
91: "Seven-color Wave, Breathe Sync", |
| 603 |
92: "Seven-color Breathe Sync, Flash Sync", |
| 604 |
93: "Seven-color Flash Sync, Jump Sync", |
| 605 |
94: "Seven-color Wave, Breathe Sync, Flash Sync, Jump Sync", |
| 606 |
95: "Overlap Red, Green, Blue", |
| 607 |
96: "Overlap Red, Green, Blue, Cyan, Purple, White", |
| 608 |
97: "Overlap Green, Blue, Cyan", |
| 609 |
98: "Overlap Blue, Cyan, Purple", |
| 610 |
99: "Overlap Cyan, Purple, White", |
| 611 |
100: "Overlap White, Black, Red", |
| 612 |
} |
| 613 |
|
| 614 |
CHRISTMAS_ADDRESSABLE_EFFECT_NAME_ID = { |
| 615 |
v: k for k, v in CHRISTMAS_ADDRESSABLE_EFFECT_ID_NAME.items() |
| 616 |
} |
| 617 |
|
| 618 |
|
| 619 |
class PresetPattern: |
| 620 |
_instance = None |
| 621 |
warm_flash = EFFECT_MAP_LEGACY_CCT[EFFECT_WARM_FLASH] |
| 622 |
cool_flash = EFFECT_MAP_LEGACY_CCT[EFFECT_COOL_FLASH] |
| 623 |
warm_gradual = EFFECT_MAP_LEGACY_CCT[EFFECT_WARM_GRADUAL] |
| 624 |
cool_gradual = EFFECT_MAP_LEGACY_CCT[EFFECT_COOL_GRADUAL] |
| 625 |
seven_color_cross_fade = EFFECT_MAP[EFFECT_COLORLOOP] |
| 626 |
red_gradual_change = EFFECT_MAP[EFFECT_RED_FADE] |
| 627 |
green_gradual_change = EFFECT_MAP[EFFECT_GREEN_FADE] |
| 628 |
blue_gradual_change = EFFECT_MAP[EFFECT_BLUE_FADE] |
| 629 |
yellow_gradual_change = EFFECT_MAP[EFFECT_YELLOW_FADE] |
| 630 |
cyan_gradual_change = EFFECT_MAP[EFFECT_CYAN_FADE] |
| 631 |
purple_gradual_change = EFFECT_MAP[EFFECT_PURPLE_FADE] |
| 632 |
white_gradual_change = EFFECT_MAP[EFFECT_WHITE_FADE] |
| 633 |
red_green_cross_fade = EFFECT_MAP[EFFECT_RED_GREEN_CROSS_FADE] |
| 634 |
red_blue_cross_fade = EFFECT_MAP[EFFECT_RED_BLUE_CROSS_FADE] |
| 635 |
green_blue_cross_fade = EFFECT_MAP[EFFECT_GREEN_BLUE_CROSS_FADE] |
| 636 |
seven_color_strobe_flash = EFFECT_MAP[EFFECT_COLORSTROBE] |
| 637 |
red_strobe_flash = EFFECT_MAP[EFFECT_RED_STROBE] |
| 638 |
green_strobe_flash = EFFECT_MAP[EFFECT_GREEN_STROBE] |
| 639 |
blue_strobe_flash = EFFECT_MAP[EFFECT_BLUE_STROBE] |
| 640 |
yellow_strobe_flash = EFFECT_MAP[EFFECT_YELLOW_STROBE] |
| 641 |
cyan_strobe_flash = EFFECT_MAP[EFFECT_CYAN_STROBE] |
| 642 |
purple_strobe_flash = EFFECT_MAP[EFFECT_PURPLE_STROBE] |
| 643 |
white_strobe_flash = EFFECT_MAP[EFFECT_WHITE_STROBE] |
| 644 |
seven_color_jumping = EFFECT_MAP[EFFECT_COLORJUMP] |
| 645 |
cycle_rgb = EFFECT_MAP_DIMMABLE[EFFECT_CYCLE_RGB] |
| 646 |
cycle_seven_colors = EFFECT_MAP_DIMMABLE[EFFECT_CYCLE_SEVEN_COLORS] |
| 647 |
red_green_blue_cross_fade = EFFECT_MAP_DIMMABLE[EFFECT_RED_GREEN_BLUE_CROSS_FADE] |
| 648 |
|
| 649 |
def __init__(self) -> None: |
| 650 |
self._value_to_str: dict[int, str] = { |
| 651 |
**EFFECT_ID_NAME_LEGACY_CCT, |
| 652 |
**{ |
| 653 |
v: k.replace("_", " ").title() |
| 654 |
for k, v in PresetPattern.__dict__.items() |
| 655 |
if type(v) is int |
| 656 |
}, |
| 657 |
} |
| 658 |
self._hex_str_valid_values = {f"0x{byte:02X}" for byte in self._value_to_str} |
| 659 |
|
| 660 |
@classmethod |
| 661 |
def instance(cls) -> PresetPattern: |
| 662 |
"""Get preset pattern instance.""" |
| 663 |
if cls._instance is None: |
| 664 |
cls._instance = cls() |
| 665 |
return cls._instance |
| 666 |
|
| 667 |
@staticmethod |
| 668 |
def valid(pattern: int) -> bool: |
| 669 |
instance = PresetPattern.instance() |
| 670 |
return pattern in instance._value_to_str |
| 671 |
|
| 672 |
@staticmethod |
| 673 |
def valid_or_raise(pattern: int) -> None: |
| 674 |
instance = PresetPattern.instance() |
| 675 |
if pattern not in instance._value_to_str: |
| 676 |
raise ValueError(f"Pattern must be one of {instance._hex_str_valid_values}") |
| 677 |
|
| 678 |
@staticmethod |
| 679 |
def valtostr(pattern: int) -> str | None: |
| 680 |
instance = PresetPattern.instance() |
| 681 |
return instance._value_to_str.get(pattern) |
| 682 |
|
| 683 |
@staticmethod |
| 684 |
def str_to_val(effect: str) -> int: |
| 685 |
if effect in EFFECT_MAP_DIMMABLE: |
| 686 |
return EFFECT_MAP_DIMMABLE[effect] |
| 687 |
mapped_effect = effect.replace(" ", "_").lower() |
| 688 |
if hasattr(PresetPattern, mapped_effect): |
| 689 |
return cast("int", getattr(PresetPattern, mapped_effect)) |
| 690 |
raise ValueError(f"{effect} is not a known effect name.") |