Skip to content

Instantly share code, notes, and snippets.

@tjd-dev
Created December 18, 2022 19:32
Show Gist options
  • Select an option

  • Save tjd-dev/02b47ab31f7003880b9f80c0d015956c to your computer and use it in GitHub Desktop.

Select an option

Save tjd-dev/02b47ab31f7003880b9f80c0d015956c to your computer and use it in GitHub Desktop.

Revisions

  1. Tim Dolan created this gist Dec 18, 2022.
    118 changes: 118 additions & 0 deletions ikea_spinny.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,118 @@
    blueprint:
    name: ZHA - IKEA Symfonisk sound controller for media
    description: 'Control media with an IKEA Symfonisk sound controller (the spinny
    ones).
    Single press will toggle Play/Pause 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.'
    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: The media player to control
    selector:
    target:
    entity:
    domain: media_player
    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: {}
    source_url: https://community.home-assistant.io/t/zha-ikea-symfonisk-sound-controller-for-media-the-spinny-one/266130/3
    mode: restart
    trigger:
    - platform: event
    event_type: zha_event
    event_data:
    device_id: !input 'remote'
    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 }}'
    - choose:
    - conditions:
    - '{{ command == ''stop'' }}'
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    sequence:
    - delay: 0.1
    - conditions:
    - '{{ command == ''toggle'' }}'
    - '{{ cluster_id == 6 }}'
    - '{{ endpoint_id == 1 }}'
    sequence:
    - wait_for_trigger:
    - platform: event
    event_type: zha_event
    event_data:
    device_id: !input 'remote'
    endpoint_id: 1
    cluster_id: 8
    command: 'toggle'
    timeout:
    milliseconds: 500
    continue_on_timeout: true
    - service: media_player.media_play_pause
    target: !input 'media_player'
    - conditions:
    - '{{ command == ''step'' }}'
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ args == [0, 1, 0] }}'
    sequence: !input 'double_press'
    - conditions:
    - '{{ command == ''step'' }}'
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ args == [1, 1, 0] }}'
    sequence: !input 'triple_press'
    - conditions:
    - '{{ command == ''move'' }}'
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ args == [0, 195] }}'
    sequence:
    repeat:
    while:
    - condition: template
    value_template: "{{ repeat.index < 10 }}"
    sequence:
    - service: media_player.volume_up
    target: !input 'media_player'
    - delay: 0.1
    - conditions:
    - '{{ command == ''move'' }}'
    - '{{ cluster_id == 8 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ args == [1, 195] }}'
    sequence:
    repeat:
    while:
    - condition: template
    value_template: "{{ repeat.index < 10 }}"
    sequence:
    - service: media_player.volume_down
    target: !input 'media_player'
    - delay: 0.1