-
Notifications
You must be signed in to change notification settings - Fork 58
Setting the LED on the Inovelli Blue light switch #486
Unanswered
j-steve
asked this question in
Show and tell
-
For those of you who are utilizing the fantastic Inovelli Blue light switch, I've written some code to simplify the process of changing the LED strip color/pattern.
For example, here's how I set my switch LED to "fast blinking red":
set_inovelli_switch_led('42:a2:f2:13:42', Colors.RED, effect=Effects.FAST_BLINK)
Here's the full code:
# FILE: modules/inovelli.py class EventName: UP_BUTTON_CLICK = 'button_2_press' UP_BUTTON_CLICK_2X = 'button_2_double' DOWN_BUTTON_CLICK = 'button_1_press' DOWN_BUTTON_CLICK_2X = 'button_1_double' class Colors: RED = 0 ORANGE = 10 YELLOW = 25 LIME_GREEN = 55 GREEN = 85 CYAN = 150 BLUE = 172 PURPLE = 185 PINK = 235 MAGENTA = 250 WHITE = 255 class Effects: SOLID = 1 FAST_BLINK = 2 SLOW_BLINK = 3 PULSE = 4 CHASE = 5 OPEN_CLOSE = 6 SMALL_BIG = 7 BREATHING = 8 SLOW_FALLING = 9 MED_FALLING = 10 FAST_FALLING = 11 SLOW_RISING = 12 MED_RISING = 13 FAST_RISING = 14 MEDIUM_BLINK = 15 SLOW_BOUNCING = 16 FAST_BOUNCING = 17 FAST_HALF_FLASHING = 18 SLOW_HALF_FLASHING = 19 def set_switch_led(device_ieee, color, brightness=255, effect=Effects.SOLID, duration=255): """ Set the state of an Inovelli Blue switch's LED. Args: device_ieee (str): The unique Zigbee identifier (IEEE) for the Inovelli switch. color (Colors): The color to set the LED. brightness (int): The brightness level of the LED. Defaults to 255 (max brightness). effect (Effects): The effect to apply to the LED. Defaults to Effects.SOLID. duration (int): The duration of the LED effect. Defaults to 255 ("forever"). Returns: None """ if not (0 <= brightness <= 255): raise ValueError(f'Invalid brightness: {brightness}. It should be in the range 0-255.') if not (0 <= duration <= 255): raise ValueError(f'Invalid duration: {duration}. It should be in the range 0-255.') zha.issue_zigbee_cluster_command( ieee=device_ieee, endpoint_id=1, command=1, cluster_id=64561, cluster_type='in', command_type='server', manufacturer=4655, params={ 'led_effect': effect, 'led_color': color, 'led_level': brightness, 'led_duration': duration})
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment