Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blizzrdof77/ced20025d0328d4adce4c28e8d22cee5 to your computer and use it in GitHub Desktop.
Save blizzrdof77/ced20025d0328d4adce4c28e8d22cee5 to your computer and use it in GitHub Desktop.
Blueprint for Home Assistant | Zigbee IKEA Symfonisk sound controller (for lights) [ZHA]
blueprint:
name: ZHA - Area-Based IKEA Symfonisk Sound Controller Knob Light Dimmer
description: Control lights with an IKEA Symfonisk sound controller (the spinny ones).
You can set functions for single press, double press, and triple press (e.g., scenes or scripts).
Rotating adjusts brightness smoothly.
domain: automation
input:
remote:
name: Remote
description: IKEA Symfonisk controller to use
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: SYMFONISK Sound Controller
area:
name: Target Area
description: The area to run the light control in.
selector:
area:
light:
name: Light(s)
description: The light or light group to control.
default: []
selector:
entity:
domain: light
multiple: true
sensitivity:
name: Sensitivity
description: Reduces the rate of brightness change.
default: 5
selector:
number:
min: 1.0
max: 10.0
step: 0.1
mode: slider
transition:
name: Transition
description: Transition time in seconds.
default: 0.5
selector:
number:
min: 0.0
max: 5.0
step: 0.1
mode: slider
single_press:
name: Single press
description: Action(s) to run on single press
default: []
selector:
action: {}
double_press:
name: Double press
description: Action(s) to run on double press
default: []
selector:
action: {}
triple_press:
name: Triple press
description: Action(s) to run on triple press
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: 'toggle'
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: 'move'
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
command: 'step'
action:
- variables:
command: '{{ trigger.event.data.command }}'
cluster_id: '{{ trigger.event.data.cluster_id }}'
endpoint_id: '{{ trigger.event.data.endpoint_id }}'
args: '{{ trigger.event.data.args }}'
sensitivity: !input sensitivity
transition_time: !input transition
room_id: !input area
light_entity: !input light
- variables:
brightness_change_pct: '{{ (sensitivity|float * 2)|int }}'
repetitions: '{{ ((100 / ((sensitivity|float * 2)|int))|int) + 1 }}'
area_slug: >-
{{ area_name(room_id)|lower|replace(' ', '_') }}
evening_lights: >-
{{ "light." }}{{ area_slug }}{{ "_" }}{{ "evening_lights" }}
daytime_lights: >-
{{ "light." }}{{ area_slug }}{{ "_" }}{{ "daytime_lights" }}
all_lights: >-
{{ "light." }}{{ area_slug }}{{ "_" }}{{ "lights" }}
target_entity: >-
{%- if states(evening_lights) == states(daytime_lights) -%}
{{ all_lights }}
{%- elif is_state(evening_lights, 'on') -%}
{{ evening_lights }}
{%- else -%}
{{ daytime_lights }}
{%- endif -%}
actions_single: !input single_press
actions_double: !input double_press
actions_triple: !input triple_press
- choose:
- conditions:
- '{{ command == "toggle" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence:
- if:
- condition: template
value_template: >-
{{ actions_single | list | length > 0 and actions_single | string != "[]" }}
then: !input single_press
else:
- action: script.super_smart_circadian_area_light_toggle
data:
on_or_off: toggle
change_temp: true
extra_bright: true
transition: "{{ transition_time|float(0.5) }}"
area: "{{ room_id }}"
- conditions:
- '{{ command == "step" }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{ (args | string | contains("StepMode.Up") ) }}'
sequence:
- if:
- condition: template
value_template: >-
{{ actions_double | list | length > 0 and actions_double | string != "[]" }}
then: !input double_press
else:
- action: script.light_toggle_max
data:
on_or_off: toggle
transition: "{{ transition_time|float(0.5) }}"
entity_id: "{{ all_lights }}"
- conditions:
- '{{ command == "step" }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{ (args | string | contains("StepMode.Down") ) }}'
sequence:
- if:
- condition: template
value_template: >-
{{ actions_triple | list | length > 0 and actions_triple | string != "[]" }}
then: !input triple_press
else:
- action: script.random_light_color
data:
entity_id: "{{ target_entity }}"
transition: "{{ transition_time|float(0.5) }}"
- conditions:
- '{{ command == "move" }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{ (args | string | contains("MoveMode.Up") ) }}'
sequence:
- repeat:
count: '{{ repetitions|int }}'
sequence:
- service: light.turn_on
data:
entity_id: "{{ target_entity }}"
brightness_step_pct: '{{ brightness_change_pct }}'
transition: '{{ transition_time|float(0.5) }}'
- delay: '{{ transition_time|float(0.5) }}'
- conditions:
- '{{ command == "move" }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{ (args | string | contains("MoveMode.Down") ) }}'
sequence:
- repeat:
count: '{{ repetitions|int }}'
sequence:
- service: light.turn_on
data:
entity_id: "{{ target_entity }}"
brightness_step_pct: '{{ brightness_change_pct * -1 }}'
transition: '{{ transition_time|float(0.5) }}'
- delay: '{{ transition_time|float(0.5) }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment