Forked from cooljimy84/zha-ikea-symfonisk-square-sound-controller.yaml
Last active
April 7, 2023 11:07
-
-
Save alexwmaustin/2c25cfa1a0ade1ab9fc1ef0940289672 to your computer and use it in GitHub Desktop.
Home Assistant Blueprints: ZHA version for controlling media players with an Ikea Symfonisk GEN2
This file contains 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: | |
# Adapted to include finer volume control | |
# Based on https://gist.github.com/erkr/a437ebcb98a2b5ba2deebabd02f5ffae Eric Kreuwels | |
# And on https://gist.github.com/cooljimy84/f1f2da3a6b214879b82bf06a68d89264 | |
name: ZHA - IKEA Symfonisk sound controller GEN2 for media | |
description: 'Control media with an IKEA Symfonisk sound controller GEN2 (Square one) | |
Single press will toggle Play/Pause on your selected media player. | |
Single dot and double dots are not working due to errors in zigpy March 2023 | |
WARNING (MainThread) [zigpy.zcl] [0x125C:1:0xfc7f] Unknown cluster command 1 b \x02\x01 | |
WARNING (MainThread) [zigpy.zcl] [0x125C:1:0xfc7f] Unknown cluster command 1 b \x01\x01' | |
domain: automation | |
input: | |
remote: | |
name: Remote | |
description: IKEA Symfonisk controller GEN2 to use | |
selector: | |
device: | |
integration: zha | |
manufacturer: IKEA of Sweden | |
model: SYMFONISK sound remote gen2 | |
multiple: false | |
media_player: | |
name: Media Player | |
description: Media player which will be controlled with this automation. | |
selector: | |
entity: | |
domain: media_player | |
multiple: false | |
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_dots: | |
name: Single Dots | |
description: Action to run on single dot press (not yet working in ZHA) | |
default: [] | |
selector: | |
action: {} | |
double_dots: | |
name: Double Dots | |
description: Action to run on double dot press (not yet working in ZHA) | |
default: [] | |
selector: | |
action: {} | |
mode: single | |
max_exceeded: silent | |
trigger: | |
- platform: event | |
event_type: zha_event | |
event_data: | |
device_id: !input remote | |
action: | |
- variables: | |
steps: !input volume_steps | |
stepsize: '{{ 1.0 / steps }}' | |
player: !input 'media_player' | |
command: '{{ trigger.event.data.command }}' | |
cluster_id: '{{ trigger.event.data.cluster_id }}' | |
endpoint_id: '{{ trigger.event.data.endpoint_id }}' | |
args: '{{ trigger.event.data.args }}' | |
- choose: | |
- conditions: | |
- '{{ command == ''toggle'' }}' | |
- '{{ cluster_id == 6 }}' | |
- '{{ endpoint_id == 1 }}' | |
sequence: | |
- service: media_player.media_play_pause | |
entity_id: !input 'media_player' | |
- conditions: | |
- '{{ command == ''step'' }}' | |
- '{{ cluster_id == 8 }}' | |
- '{{ endpoint_id == 1 }}' | |
- '{{ trigger.event.data.params.step_mode == 0 }}' | |
sequence: | |
- service: media_player.media_next_track | |
entity_id: !input 'media_player' | |
- conditions: | |
- '{{ command == ''step'' }}' | |
- '{{ cluster_id == 8 }}' | |
- '{{ endpoint_id == 1 }}' | |
- '{{ trigger.event.data.params.step_mode == 1 }}' | |
sequence: | |
- service: media_player.media_previous_track | |
entity_id: !input 'media_player' | |
# - conditions: | |
# - '{{ command == ''step'' }}' | |
# - '{{ cluster_id == 8 }}' | |
# - '{{ endpoint_id == 1 }}' | |
# - '{{ trigger.event.data.params.step_mode == 0 }}' | |
# sequence: !input single_dots | |
# - conditions: | |
# - '{{ command == ''step'' }}' | |
# - '{{ cluster_id == 8 }}' | |
# - '{{ endpoint_id == 1 }}' | |
# - '{{ trigger.event.data.params.step_mode == 1 }}' | |
# sequence: !input double_dots | |
- conditions: | |
- '{{ command == ''move_with_on_off'' }}' | |
- '{{ cluster_id == 8 }}' | |
- '{{ endpoint_id == 1 }}' | |
- '{{ trigger.event.data.params.move_mode == 0}}' | |
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' | |
- conditions: | |
- '{{ command == ''move_with_on_off'' }}' | |
- '{{ cluster_id == 8 }}' | |
- '{{ endpoint_id == 1 }}' | |
- '{{ trigger.event.data.params.move_mode == 1 }}' | |
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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this.
With the update of Home Assistant to 2023.04 the events for the dots buttons are now picked up by ZHA. I've forked your gist, and added correct handling for the buttons, and they now seem to do the right thing - at least for me.
Feel free to merge back my changes - my update is available here: https://gist.github.com/krillerdk/000bac0f146ae83728b71a6bd797d03c