blueprint:
  name: ZHA - IKEA Somrig remote dot-buttons control
  description: Fully customisable dot-buttons, with options for single, double and
    long press for each one.
  domain: automation
  input:
    remote:
      name: Remote
      description: IKEA Somrig remote to use
      selector:
        device:
          integration: zha
          manufacturer: IKEA of Sweden
          model: SOMRIG shortcut button
          multiple: false
    single_dot_single_press:
      name: Single dot (Single press)
      description: Action to run on single dot press
      default: []
      selector:
        action: {}
    single_dot_double_press:
      name: Single dot (Double press)
      description: Action to run on single dot double press
      default: []
      selector:
        action: {}
    single_dot_long_press:
      name: Single dot (Long press)
      description: Action to run on single dot long press
      default: []
      selector:
        action: {}
    single_dot_long_release:
      name: Single dot (Release after long press)
      description: Action to run on releasing after a long press on the single dot
      default: []
      selector:
        action: {}
    double_dot_single_press:
      name: Double dot (Single press)
      description: Action to run on double dot press
      default: []
      selector:
        action: {}
    double_dot_double_press:
      name: Double dot (Double press)
      description: Action to run on double dot double press
      default: []
      selector:
        action: {}
    double_dot_long_press:
      name: Double dot (Long press)
      description: Action to run on double dot long press
      default: []
      selector:
        action: {}
    double_dot_long_release:
      name: Double dot (Release after long press)
      description: Action to run on releasing after a long press on the double dot
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/ikea-somrig-remote-e2213-zha/668671
mode: single
max_exceeded: silent
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 == ''short_release'' }}'
    - '{{ endpoint_id == 1 }}'
    sequence: !input single_dot_single_press
  - conditions:
    - '{{ command == ''multi_press_complete'' }}'
    - '{{ endpoint_id == 1 }}'
    sequence: !input single_dot_double_press
  - conditions:
    - '{{ command == ''long_press'' }}'
    - '{{ endpoint_id == 1 }}'
    sequence: !input single_dot_long_press
  - conditions:
    - '{{ command == ''long_release'' }}'
    - '{{ endpoint_id == 1 }}'
    sequence: !input single_dot_long_release
  - conditions:
    - '{{ command == ''short_release'' }}'
    - '{{ endpoint_id == 2 }}'
    sequence: !input double_dot_single_press
  - conditions:
    - '{{ command == ''multi_press_complete'' }}'
    - '{{ endpoint_id == 2 }}'
    sequence: !input double_dot_double_press
  - conditions:
    - '{{ command == ''long_press'' }}'
    - '{{ endpoint_id == 2 }}'
    sequence: !input double_dot_long_press
  - conditions:
    - '{{ command == ''long_release'' }}'
    - '{{ endpoint_id == 2 }}'
    sequence: !input double_dot_long_release
