-
-
Save erkr/a437ebcb98a2b5ba2deebabd02f5ffae to your computer and use it in GitHub Desktop.
blueprint: | |
# Author Eric Kreuwels, Copyright 2022, publices under the free MIT license conditions | |
# 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). | |
Single press will either toggle Play/Pause(default) of Mute/Unmute on your selected media player. | |
You can set functions for double press 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: 100 | |
max: 1000 | |
step: 100 | |
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: 50 | |
step: 5 | |
unit_of_measurement: "Num" | |
mode: slider | |
single_press: | |
name: Single press | |
description: Pause(default) or Mute on single press | |
default: Pause | |
selector: | |
select: | |
options: | |
- Pause | |
- Mute | |
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: single | |
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 | |
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 | |
- "{{ single_mode == 'Pause' }}" | |
sequence: | |
- service: media_player.media_play_pause | |
entity_id: !input 'media_player' | |
- delay: 0.5 | |
- conditions: | |
- condition: trigger | |
id: press_single | |
- "{{ single_mode == 'Mute' }}" | |
- "{{ state_attr(player, 'is_volume_muted') is not none }}" | |
sequence: | |
- service: media_player.volume_mute | |
data: | |
is_volume_muted: "{{ state_attr(player, 'is_volume_muted') == false }}" | |
entity_id: !input 'media_player' | |
- delay: 0.5 | |
- 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 | |
- "{{ state_attr(player, 'volume_level') is not none }}" | |
sequence: | |
- service: media_player.volume_set | |
data: | |
volume_level: >- | |
{% set volume = state_attr(player, 'volume_level') + stepsize %} | |
{{ 1.0 if volume > 1.0 else volume }} | |
entity_id: !input 'media_player' | |
- delay: | |
milliseconds: !input 'volume_delay' | |
- conditions: | |
- condition: trigger | |
id: rotate_left | |
- "{{ state_attr(player, 'volume_level') is not none }}" | |
sequence: | |
- service: media_player.volume_set | |
data: | |
volume_level: >- | |
{% set volume = state_attr(player, 'volume_level') - stepsize %} | |
{{ 0.0 if volume < 0.0 else volume }} | |
entity_id: !input 'media_player' | |
- delay: | |
milliseconds: !input 'volume_delay' | |
@broekhuijsen
Nice to hear that the blueprint is useful for you. Very nice idea, but I’m limited by the events that the symfonisk produces. Things like Rotate while pressed is not available. You can easily check it yourself. Create an automation, choose device as trigger and select your symfonisk. Then you will see the really limited list of events.
Best Eric
Thanks for your response. This is just stupid, I didn't even think of trying that.
Well thanks for the great work you did on this :D
In this case I promote your blueprint to the PERFECT status :D
This worked a treat. Is there any way to have it self discovery in HA like other blueprint. Took me weeks before I stumbled upon your github page.
@bertybassett
Officially publishing blueprints is also a commitment for support I don't have time for. Gist is great way to share things, as they are.
I hope it fulfills your needs 👍
Hoi / hey Eric,
I recently discovered your great blueprint. It rendered one of my controlers from useless (too big increments) to almost perfect.
Would it be possible to add an extra option for press and hold? This way the controler would be even better.
I don't think this is possible, but would it be possible to change the behaviour when you turn the dial while it is being pressed?
For instance. If I turn the dial, the volume goes up and down, but when I press and turn the dial, it skips songs backwards and forwards.
I guess this is not possible but if it would, it would be fantastic. Because then I could use double and tripple press to start radio stations or so :D