Xiaomi_aqara - Aqara Wireless Remote Switch (Double Rocker)

This blueprint will let you configure a Aqara Wireless Remote Switch (Double Rocker) (Eu Version) which is paired with Xiaomi gateway via xiaomi_aqara integration. It supports commands for single, double and long-press for each rocker or both rockers together.

Requirements:

  • Aqara Wireless Remote Switch (Double Rocker). Both right and left binary_sensor entiries must have “Right” and “Left” in their names for this blueprint to work - this is a limitation of xiaomi_aqara integration.

This blueprint is based on ZHA - Aqara Wireless Remote Switch (Double Rocker) from NachtaktiverHalbaffe. Thanks!

Blueprint:

blueprint:
  name: xiaomi_aqara - Aqara Wireless Remote Switch (Double Rocker)
  description: Automate your Xiaomi Aqara Wireless Remote Switch (Double Rocker) using xiaomi events.
  domain: automation
  input:
    aqara_double_switch:
      name: Select the Aqara Wireless Remote Switch (Double Rocker)
      description: Aqara Wireless Remote Switch (Double Rocker)
      selector:
        device:
          entity:
            integration: xiaomi_aqara
          filter:
            model: remote.b286acn01
    button_single_press_left:
      name: Single Press Left
      description: Action to run on single press
      default: []
      selector:
        action:
    button_double_press_left:
      name: Double Press Left
      description: Action to run on double press
      default: []
      selector:
        action:
    button_long_press_left:
      name: Long Press Left
      description: Action to run when button is long pressed (held down)
      default: []
      selector:
        action:
    button_single_press_right:
      name: Single Press Right
      description: Action to run on single press
      default: []
      selector:
        action:
    button_double_press_right:
      name: Double Press Right
      description: Action to run on double press
      default: []
      selector:
        action:
    button_long_press_right:
      name: Long Press Right
      description: Action to run when button is long pressed (held down)
      default: []
      selector:
        action:
    button_single_press_both:
      name: Single Press Both Buttons
      description: Action to run on single presses
      default: []
      selector:
        action:
    button_double_press_both:
      name: Double Press Both Buttons
      description: Action to run on double presses
      default: []
      selector:
        action:
    button_long_press_both:
      name: Long Press Both Buttons
      description: Action to run when buttons are long pressed (held down)
      default: []
      selector:
        action:

mode: restart
max_exceeded: silent

variables:
  aqara_double_switch: !input aqara_double_switch

triggers:
  - trigger: event
    event_type: xiaomi_aqara.click

conditions:
  - condition: template
    value_template: "{{ device_id(trigger.event.data.entity_id) == aqara_double_switch }}"
    alias: Check for device_id

actions:
  - variables:
      click_type: "{{ trigger.event.data.click_type }}"
      entity_id: "{{ trigger.event.data.entity_id }}"

  - choose:
      - conditions:
          - "{{ click_type == 'single' }}"
          - "{{ state_attr(entity_id, 'friendly_name') | contains('Left') }}"
        sequence: !input button_single_press_left
      - conditions:
          - "{{ click_type == 'double' }}"
          - "{{ state_attr(entity_id, 'friendly_name') | contains('Left') }}"
        sequence: !input button_double_press_left
      - conditions:
          - "{{ click_type == 'long' }}"
          - "{{ state_attr(entity_id, 'friendly_name') | contains('Left') }}"
        sequence: !input button_long_press_left
      - conditions:
          - "{{ click_type == 'single' }}"
          - "{{ state_attr(entity_id, 'friendly_name') | contains('Right') }}"
        sequence: !input button_single_press_right
      - conditions:
          - "{{ click_type == 'double' }}"
          - "{{ state_attr(entity_id, 'friendly_name') | contains('Right') }}"
        sequence: !input button_double_press_right
      - conditions:
          - "{{ click_type == 'long' }}"
          - "{{ state_attr(entity_id, 'friendly_name') | contains('Right') }}"
        sequence: !input button_long_press_right
      - conditions:
          - "{{ click_type == 'both' }}"
        sequence: !input button_single_press_both
      - conditions:
          - "{{ click_type == 'double_both' }}"
        sequence: !input button_double_press_both
      - conditions:
          - "{{ click_type == 'long_both' }}"
        sequence: !input button_long_press_both