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
blueprint: | |
name: Styrbar multiple lights | |
description: A blueprint that allows Ikea styrbar light controller to be used to controll multiple lights made by Zuul. | |
domain: automation | |
input: | |
controller: | |
name: Controller | |
description: The styrbar controller to be used to controll the lights. | |
selector: | |
entity: | |
domain: sensor | |
light_number: | |
name: Zone 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 | |
light_brightness: | |
name: Light brightness | |
description: The brightness the lights will be when turned on by the controller. | |
selector: | |
number: | |
min: 0 | |
max: 100 | |
unit_of_measurement: "%" | |
lights: | |
name: Light(s) | |
description: The lights that will be controlled by the controller. | |
selector: | |
entity: | |
domain: light | |
multiple: true | |
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] }}" | |
data: | |
brightness_pct: !input light_brightness | |
- 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 states(light_number) < len(lights) %} 1 | |
{{ states(light_number) + 1 }} | |
{% else %} 1 | |
{% endif %} | |
target: | |
entity_id: !input light_number | |
- conditions: | |
- condition: trigger | |
id: "arrow_right_click" | |
sequence: | |
- service: input_number.set_value | |
data: | |
value: >- | |
{% if states(light_number) < len(lights) %} 1 | |
{{ states(light_number) - 1 }} | |
{% else %} | |
{{ len(lights) - 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 | |
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 | |
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