Last active
February 11, 2025 23:28
-
-
Save Zuulcode/6149d9c61c8679d963aeecde02055269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Zuulcode(2023), all rights reserved. | |
blueprint: | |
name: Styrbar multiple lights | |
description: A blueprint that allows Ikea styrbar light controller to be used to | |
control multiple lights, made by Zuul. | |
domain: automation | |
input: | |
controller: | |
name: Controller | |
description: The styrbar controller to be used to control the lights. | |
selector: | |
entity: | |
domain: sensor | |
multiple: false | |
light_number: | |
name: Light number | |
description: An input_number helper with minimum value 1 and maximum value of | |
at least the amount of lights used. This input should be configured to use | |
increments of 1. | |
selector: | |
entity: | |
domain: input_number | |
multiple: false | |
lights: | |
name: Light(s) | |
description: The lights that will be controlled by the controller. | |
selector: | |
entity: | |
domain: light | |
multiple: true | |
source_url: https://gist.github.com/Zuulcode/6149d9c61c8679d963aeecde02055269 | |
variables: | |
light_number: !input light_number | |
lights: !input lights | |
mode: restart | |
trigger: | |
- platform: state | |
entity_id: | |
- !input controller | |
to: 'on' | |
id: 'on' | |
- platform: state | |
entity_id: | |
- !input controller | |
to: 'off' | |
id: 'off' | |
- platform: state | |
entity_id: | |
- !input controller | |
to: arrow_left_click | |
id: arrow_left_click | |
- platform: state | |
entity_id: | |
- !input controller | |
to: arrow_right_click | |
id: arrow_right_click | |
- platform: state | |
entity_id: | |
- !input controller | |
to: brightness_move_up | |
id: brightness_move_up | |
- platform: state | |
entity_id: | |
- !input controller | |
to: brightness_move_down | |
id: brightness_move_down | |
- platform: state | |
entity_id: | |
- !input controller | |
to: brightness_stop | |
id: brightness_stop | |
action: | |
- choose: | |
- conditions: | |
- condition: trigger | |
id: 'on' | |
sequence: | |
- service: light.turn_on | |
target: | |
entity_id: '{{ lights[int(states(light_number)) - 1] }}' | |
- conditions: | |
- condition: trigger | |
id: 'off' | |
sequence: | |
- service: light.turn_off | |
target: | |
entity_id: '{{ lights[int(states(light_number)) - 1] }}' | |
- conditions: | |
- condition: trigger | |
id: arrow_left_click | |
sequence: | |
- service: input_number.set_value | |
data: | |
value: '{% if int(states(light_number)) > 1 %} {{ int(states(light_number)) | |
- 1 }} {% else %} {{ lights|length }} {% endif %}' | |
target: | |
entity_id: !input light_number | |
- conditions: | |
- condition: trigger | |
id: arrow_right_click | |
sequence: | |
- service: input_number.set_value | |
data: | |
value: '{% if int(states(light_number)) < lights|length %} {{ int(states(light_number)) | |
+ 1 }} {% else %} 1 {% endif %}' | |
target: | |
entity_id: !input light_number | |
- conditions: | |
- condition: trigger | |
id: brightness_move_up | |
sequence: | |
- repeat: | |
until: | |
- condition: trigger | |
id: brightness_stop | |
sequence: | |
- service: light.turn_on | |
target: | |
entity_id: '{{ lights[int(states(light_number)) - 1] }}' | |
data: | |
brightness_step_pct: 10 | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: 0 | |
milliseconds: 500 | |
- conditions: | |
- condition: trigger | |
id: brightness_move_down | |
sequence: | |
- repeat: | |
until: | |
- condition: trigger | |
id: brightness_stop | |
sequence: | |
- service: light.turn_on | |
target: | |
entity_id: '{{ lights[int(states(light_number)) - 1] }}' | |
data: | |
brightness_step_pct: -10 | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: 0 | |
milliseconds: 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can't post a PR but I forked the project and added support for
update
entities for the remotehttps://gist.github.com/gilgoldzweig/c823f9caaa8ab85d2ed2627582f1cab7