Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Mysli0210/3022884d78d2a263b700a45b53af17c8 to your computer and use it in GitHub Desktop.
Save Mysli0210/3022884d78d2a263b700a45b53af17c8 to your computer and use it in GitHub Desktop.
Home Assistant Blueprints: ZHA version for controlling media players with an Ikea Symfonisk
blueprint:
# Author Eric Kreuwels, Copyright 2022, publices under the free MIT license conditions, modified by Kasper Tulstrup
# This blueprint was inspired by:
# https://community.home-assistant.io/t/zha-ikea-symfonisk-sound-controller-for-media-the-spinny-one/266130
# This version requires to recreate your automations that are based on the version above (new options and therefor not compatible)
# Changes compared to the one that inspired me:
# moved from raw ZHA events to ZHA Symfonisk Device events (raw event attributes changed to often to keep it working)
# added configuration inputs for changing the volume delay and number of volume steps
# added option to either pause (default) or mute for single press action
# restricted the player selection to entities only
name: ZHA - IKEA Symfonisk sound controller for media
description: 'Control media with an IKEA Symfonisk sound controller (the spinny
ones).
You can set functions for single,double and triple press.
Rotating left/right will change the volume smoothly of the selected media player,
if that function is possible. Both a delay between volume changes and the number of volume steps can be configured'
domain: automation
input:
remote:
name: Remote
description: IKEA Symfonisk controller to use
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: SYMFONISK Sound Controller
media_player:
name: Media Player
description: Media player which will be controlled with this automation.
selector:
entity:
domain: media_player
multiple: false
volume_delay:
name: Volume stepping delay
description: The minimal delay in milliseconds between sending new volume adjustments.
default: 500
selector:
number:
min: 50
max: 1000
step: 50
unit_of_measurement: "msec"
mode: slider
volume_steps:
name: Volume number of steps
description: The number of steps for volume adjustments.
default: 10
selector:
number:
min: 5
max: 100
step: 5
unit_of_measurement: "Num"
mode: slider
single_press:
name: Single press
description: Action to run on single press
default: []
selector:
action: {}
double_press:
name: Double press
description: Action to run on double press
default: []
selector:
action: {}
triple_press:
name: Triple press
description: Action to run on triple press
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
trigger:
- device_id: !input 'remote'
id: press_single
domain: zha
platform: device
type: remote_button_short_press
subtype: turn_on
- device_id: !input 'remote'
id: press_double
domain: zha
platform: device
type: remote_button_double_press
subtype: turn_on
- device_id: !input 'remote'
id: press_triple
domain: zha
platform: device
type: remote_button_triple_press
subtype: turn_on
- device_id: !input 'remote'
id: rotate_right
domain: zha
platform: device
type: device_rotated
subtype: right
- device_id: !input 'remote'
id: rotate_left
domain: zha
platform: device
type: device_rotated
subtype: left
- device_id: !input 'remote'
id: rotate_stop
domain: zha
platform: device
type: device_rotated
subtype: stop
action:
- variables:
steps: !input volume_steps
stepsize: '{{ 1.0 / steps }}'
player: !input 'media_player'
single_mode: !input 'single_press'
- choose:
- conditions:
- condition: trigger
id: press_single
sequence: !input 'single_press'
- conditions:
- condition: trigger
id: press_double
sequence: !input 'double_press'
- conditions:
- condition: trigger
id: press_triple
sequence: !input 'triple_press'
- conditions:
- condition: trigger
id: rotate_right
sequence:
- repeat:
until:
- condition: trigger
id: rotate_stop
sequence:
- service: media_player.volume_set
target:
entity_id: !input 'media_player'
data_template:
volume_level: >-
{{ state_attr(player,
'volume_level') + stepsize }}
- conditions:
- condition: trigger
id: rotate_left
sequence:
- repeat:
until:
- condition: trigger
id: rotate_stop
sequence:
- service: media_player.volume_set
target:
entity_id: !input 'media_player'
data_template:
volume_level: >-
{{ state_attr(player,
'volume_level') - stepsize }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment