Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)

Here is the Aqara wireless remote switch H1 (double rocker) blueprint, test with WXKG15LM, I think it also can be used with WRS-R02

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    button_sensor:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
    button_left_single_press:
      name: Left button - Single press
      description: Action to run on a single press of the left button
      default: []
      selector:
        action: {}
    button_left_double_press:
      name: Left button - Double press
      description: Action to run on a double press of the left button
      default: []
      selector:
        action: {}
    button_left_triple_press:
      name: Left button - Triple press
      description: Action to run on a triple press of the left button
      default: []
      selector:
        action: {}
    button_left_hold:
      name: Left button - Hold
      description: Action to run when left button is held
      default: []
      selector:
        action: {}
    button_right_single_press:
      name: Right button - Single press
      description: Action to run on a single press of the right button
      default: []
      selector:
        action: {}
    button_right_double_press:
      name: Right button - Double press
      description: Action to run on a double press of the right button
      default: []
      selector:
        action: {}
    button_right_triple_press:
      name: Right button - Triple press
      description: Action to run on a triple press of the right button
      default: []
      selector:
        action: {}
    button_right_hold:
      name: Right button - Hold
      description: Action to run when right button is held
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input 'button_sensor'
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''button_1_single'' }}'
    sequence: !input 'button_left_single_press'
  - conditions:
    - '{{ command == ''button_1_double'' }}'
    sequence: !input 'button_left_double_press'
  - conditions:
    - '{{ command == ''button_1_triple'' }}'
    sequence: !input 'button_left_triple_press'
  - conditions:
    - '{{ command == ''button_1_hold'' }}'
    sequence: !input 'button_left_hold'
  - conditions:
    - '{{ command == ''button_2_single'' }}'
    sequence: !input 'button_right_single_press'
  - conditions:
    - '{{ command == ''button_2_double'' }}'
    sequence: !input 'button_right_double_press'
  - conditions:
    - '{{ command == ''button_2_triple'' }}'
    sequence: !input 'button_right_triple_press'
  - conditions:
    - '{{ command == ''button_2_hold'' }}'
    sequence: !input 'button_right_hold'

3 Likes

I tried to set it up but I can’t seem to get it to recognizes my Aqara H1 switches? It says not matching devices found? Im using Aqara Wireless Remote Switch H1 dubble switches.

Pls tell me the your switch’s model number that showing in the front page of Z2M.

Im using a Aqara Hub M2 however its connected via HomeKit directly to HA.
The model nr I get when I look at HA shows up as AR009. Would I need to connect it to the application to get the exact model nr?

Hopefully it still would work even tho I use it via M2 hub and HomeKit.

This blueprint only work with Z2M(zigbee2mqtt).

This Blueprint no longer seems to work for me after the 2022.2 update

2 Likes

Awesome work mate, cheers ( dunno why it came out british lol ). Tested with WRS-R02 on HA 2021.12.8. I guess I’m never updating again.

Hello! The actions have been updated so I edited this blueprint and added three new functions. Double and triple press both & hold both.

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    button_sensor:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
    button_left_single_press:
      name: Left button - Single press
      description: Action to run on a single press of the left button
      default: []
      selector:
        action: {}
    button_left_double_press:
      name: Left button - Double press
      description: Action to run on a double press of the left button
      default: []
      selector:
        action: {}
    button_left_triple_press:
      name: Left button - Triple press
      description: Action to run on a triple press of the left button
      default: []
      selector:
        action: {}
    button_left_hold:
      name: Left button - Hold
      description: Action to run when left button is held
      default: []
      selector:
        action: {}
    button_right_single_press:
      name: Right button - Single press
      description: Action to run on a single press of the right button
      default: []
      selector:
        action: {}
    button_right_double_press:
      name: Right button - Double press
      description: Action to run on a double press of the right button
      default: []
      selector:
        action: {}
    button_right_triple_press:
      name: Right button - Triple press
      description: Action to run on a triple press of the right button
      default: []
      selector:
        action: {}
    button_right_hold:
      name: Right button - Hold
      description: Action to run when right button is held
      default: []
      selector:
        action: {}
    button_hold_both:
      name: Both buttons - Hold
      description: Action to run when both, left and right button is held
      default: []
      selector:
        action: {}
    button_double_both:
      name: Both buttons - Double press
      description: Action to run on a double press of the right and left button
      default: []
      selector:
        action: {}
    button_triple_both:
      name: Both buttons - Triple press
      description: Action to run on a triple press of the right and left button
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input 'button_sensor'
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''single_left'' }}'
    sequence: !input 'button_left_single_press'
  - conditions:
    - '{{ command == ''double_left'' }}'
    sequence: !input 'button_left_double_press'
  - conditions:
    - '{{ command == ''triple_left'' }}'
    sequence: !input 'button_left_triple_press'
  - conditions:
    - '{{ command == ''hold_left'' }}'
    sequence: !input 'button_left_hold'
  - conditions:
    - '{{ command == ''single_right'' }}'
    sequence: !input 'button_right_single_press'
  - conditions:
    - '{{ command == ''double_right'' }}'
    sequence: !input 'button_right_double_press'
  - conditions:
    - '{{ command == ''triple_right'' }}'
    sequence: !input 'button_right_triple_press'
  - conditions:
    - '{{ command == ''hold_right'' }}'
    sequence: !input 'button_right_hold'
  - conditions:
    - '{{ command == ''hold_both'' }}'
    sequence: !input 'button_hold_both'
  - conditions:
    - '{{ command == ''double_both'' }}'
    sequence: !input 'button_double_both'
  - conditions:
    - '{{ command == ''triple_both'' }}'
    sequence: !input 'button_triple_both'

Blueprint is not working for me too. The automation just doesn’t fire, so even no trace to look at.

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    button_sensor:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
    button_left_single_press:
      name: Left button - Single press
      description: Action to run on a single press of the left button
      default: []
      selector:
        action: {}
    button_left_double_press:
      name: Left button - Double press
      description: Action to run on a double press of the left button
      default: []
      selector:
        action: {}
    button_left_triple_press:
      name: Left button - Triple press
      description: Action to run on a triple press of the left button
      default: []
      selector:
        action: {}
    button_left_hold:
      name: Left button - Hold
      description: Action to run when left button is held
      default: []
      selector:
        action: {}
    button_right_single_press:
      name: Right button - Single press
      description: Action to run on a single press of the right button
      default: []
      selector:
        action: {}
    button_right_double_press:
      name: Right button - Double press
      description: Action to run on a double press of the right button
      default: []
      selector:
        action: {}
    button_right_triple_press:
      name: Right button - Triple press
      description: Action to run on a triple press of the right button
      default: []
      selector:
        action: {}
    button_right_hold:
      name: Right button - Hold
      description: Action to run when right button is held
      default: []
      selector:
        action: {}
    button_hold_both:
      name: Both buttons - Hold
      description: Action to run when both, left and right button is held
      default: []
      selector:
        action: {}
    button_double_both:
      name: Both buttons - Double press
      description: Action to run on a double press of the right and left button
      default: []
      selector:
        action: {}
    button_triple_both:
      name: Both buttons - Triple press
      description: Action to run on a triple press of the right and left button
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input 'button_sensor'
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''single_left'' }}'
    sequence: !input 'button_left_single_press'
  - conditions:
    - '{{ command == ''double_left'' }}'
    sequence: !input 'button_left_double_press'
  - conditions:
    - '{{ command == ''triple_left'' }}'
    sequence: !input 'button_left_triple_press'
  - conditions:
    - '{{ command == ''hold_left'' }}'
    sequence: !input 'button_left_hold'
  - conditions:
    - '{{ command == ''single_right'' }}'
    sequence: !input 'button_right_single_press'
  - conditions:
    - '{{ command == ''double_right'' }}'
    sequence: !input 'button_right_double_press'
  - conditions:
    - '{{ command == ''triple_right'' }}'
    sequence: !input 'button_right_triple_press'
  - conditions:
    - '{{ command == ''hold_right'' }}'
    sequence: !input 'button_right_hold'
  - conditions:
    - '{{ command == ''hold_both'' }}'
    sequence: !input 'button_hold_both'
  - conditions:
    - '{{ command == ''double_both'' }}'
    sequence: !input 'button_double_both'
  - conditions:
    - '{{ command == ''triple_both'' }}'
    sequence: !input 'button_triple_both'

editing the blueprints .yaml worked for me ( 2022.6.6 )

you might have to reload automations and create a new automation for it

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    button_sensor:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
          multiple: false
    single_left:
      name: Left button - Single press
      description: Action to run on a single press of the left button
      default: []
      selector:
        action: {}
    double_left:
      name: Left button - Double press
      description: Action to run on a double press of the left button
      default: []
      selector:
        action: {}
    triple_left:
      name: Left button - Triple press
      description: Action to run on a triple press of the left button
      default: []
      selector:
        action: {}
    hold_left:
      name: Left button - Hold
      description: Action to run when left button is held
      default: []
      selector:
        action: {}
    single_right:
      name: Right button - Single press
      description: Action to run on a single press of the right button
      default: []
      selector:
        action: {}
    double_right:
      name: Right button - Double press
      description: Action to run on a double press of the right button
      default: []
      selector:
        action: {}
    triple_right:
      name: Right button - Triple press
      description: Action to run on a triple press of the right button
      default: []
      selector:
        action: {}
    hold_right:
      name: Right button - Hold
      description: Action to run when right button is held
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/z2m-aqara-h1-wrs-r02-wireless-remote-switch-double-rocker/376959/7
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input 'button_sensor'
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''single_left'' }}'
    sequence: !input 'single_left'
  - conditions:
    - '{{ command == ''double_left'' }}'
    sequence: !input 'double_left'
  - conditions:
    - '{{ command == ''triple_left'' }}'
    sequence: !input 'triple_left'
  - conditions:
    - '{{ command == ''hold_left'' }}'
    sequence: !input 'hold_left'
  - conditions:
    - '{{ command == ''single_right'' }}'
    sequence: !input 'single_right'
  - conditions:
    - '{{ command == ''double_right'' }}'
    sequence: !input 'double_right'
  - conditions:
    - '{{ command == ''triple_right'' }}'
    sequence: !input 'triple_right'
  - conditions:
    - '{{ command == ''hold_right'' }}'
    sequence: !input 'hold_right'

Added double press/hold actions

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    button_sensor:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
          multiple: false
    single_left:
      name: Left button - Single press
      description: Action to run on a single press of the left button
      default: []
      selector:
        action: {}
    double_left:
      name: Left button - Double press
      description: Action to run on a double press of the left button
      default: []
      selector:
        action: {}
    triple_left:
      name: Left button - Triple press
      description: Action to run on a triple press of the left button
      default: []
      selector:
        action: {}
    hold_left:
      name: Left button - Hold
      description: Action to run when left button is held
      default: []
      selector:
        action: {}
    single_right:
      name: Right button - Single press
      description: Action to run on a single press of the right button
      default: []
      selector:
        action: {}
    double_right:
      name: Right button - Double press
      description: Action to run on a double press of the right button
      default: []
      selector:
        action: {}
    triple_right:
      name: Right button - Triple press
      description: Action to run on a triple press of the right button
      default: []
      selector:
        action: {}
    hold_right:
      name: Right button - Hold
      description: Action to run when right button is held
      default: []
      selector:
        action: {}
    single_both:
      name: Both buttons - Single press
      description: Action to run on a single press of both buttons
      default: []
      selector:
        action: {}
    double_both:
      name: Both buttons - Double press
      description: Action to run on a double press of both buttons
      default: []
      selector:
        action: {}
    hold_both:
      name: Both buttons - Hold
      description: Action to run when both buttons are held
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/z2m-aqara-h1-wrs-r02-wireless-remote-switch-double-rocker/376959/7
mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input "button_sensor"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == 'single_left' }}"
        sequence: !input "single_left"
      - conditions:
          - "{{ command == 'double_left' }}"
        sequence: !input "double_left"
      - conditions:
          - "{{ command == 'triple_left' }}"
        sequence: !input "triple_left"
      - conditions:
          - "{{ command == 'hold_left' }}"
        sequence: !input "hold_left"
      - conditions:
          - "{{ command == 'single_right' }}"
        sequence: !input "single_right"
      - conditions:
          - "{{ command == 'double_right' }}"
        sequence: !input "double_right"
      - conditions:
          - "{{ command == 'triple_right' }}"
        sequence: !input "triple_right"
      - conditions:
          - "{{ command == 'hold_right' }}"
        sequence: !input "hold_right"
      - conditions:
          - "{{ command == 'single_both' }}"
        sequence: !input "single_both"
      - conditions:
          - "{{ command == 'double_both' }}"
        sequence: !input "double_both"
      - conditions:
          - "{{ command == 'hold_both' }}"
        sequence: !input "hold_both"

@hhalibo maybe you can update your code to the working versions for WRS-R02?

Eine ganz blöde Frage, aber ich bin neu hier: Wo muss ich drn Code einfügen, damit der Schalter funktioniert? Ich benutze die App mit grafischer Oberfläche.

Vielen Dank und viele Grüße Benny

It might be a silly question but I am an noobie here:

Where do I have to copy the code? I am using the homeassistant android app.
Do I have to create and upload a file with the code. Until now I only used the visuell tools to program my task.

Best regards
Ben

Hi,

I am trying to make blueprint for similar single rocker wired version (no neutral). I am not sure if that will ever work, but why not to try.

blueprint:
  name: Z2M - Aqara H1 single rocker
  description: Scene & device control using Aqara single button remote
  domain: automation
  input:
    button_sensor:
      name: Aqara switch single
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
          multiple: false
    single:
      name: Button - Single press
      description: Action to run on a single press of the button
      default: []
      selector:
        action: {}
    double:
      name: Button - Double press
      description: Action to run on a double press of the button
      default: []
      selector:
        action: {}
    triple:
      name: Button - Triple press
      description: Action to run on a triple press of the button
      default: []
      selector:
        action: {}
    hold:
      name: Button - Hold
      description: Action to run when button is held
      default: []
      selector:
        action: {}
        source_url: https://community.home-assistant.io/t/z2m-aqara-h1-wrs-r02-wireless-remote-switch-double-rocker/376959/7
mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input "button_sensor"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == 'single' }}"
        sequence: !input "single"
      - conditions:
          - "{{ command == 'double' }}"
        sequence: !input "double"
      - conditions:
          - "{{ command == 'triple' }}"
        sequence: !input "triple"
      - conditions:
          - "{{ command == 'hold' }}"
        sequence: !input "hold"

First problem is error I am getting on entity_id: !input “button_sensor” … unresolved tag: !input.

It can be something stupid, but I am not getting that. Any help appreciated.

Added triple press for both buttons

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    button_sensor:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
          integration: mqtt
          multiple: false
    single_left:
      name: Left button - Single press
      description: Action to run on a single press of the left button
      default: []
      selector:
        action: {}
    double_left:
      name: Left button - Double press
      description: Action to run on a double press of the left button
      default: []
      selector:
        action: {}
    triple_left:
      name: Left button - Triple press
      description: Action to run on a triple press of the left button
      default: []
      selector:
        action: {}
    hold_left:
      name: Left button - Hold
      description: Action to run when left button is held
      default: []
      selector:
        action: {}
    single_right:
      name: Right button - Single press
      description: Action to run on a single press of the right button
      default: []
      selector:
        action: {}
    double_right:
      name: Right button - Double press
      description: Action to run on a double press of the right button
      default: []
      selector:
        action: {}
    triple_right:
      name: Right button - Triple press
      description: Action to run on a triple press of the right button
      default: []
      selector:
        action: {}
    hold_right:
      name: Right button - Hold
      description: Action to run when right button is held
      default: []
      selector:
        action: {}
    single_both:
      name: Both buttons - Single press
      description: Action to run on a single press of both buttons
      default: []
      selector:
        action: {}
    double_both:
      name: Both buttons - Double press
      description: Action to run on a double press of both buttons
      default: []
      selector:
        action: {}
    triple_both:
      name: Both buttons - Triple press
      description: Action to run on a triple press of both buttons
      default: []
      selector:
        action: {}
    hold_both:
      name: Both buttons - Hold
      description: Action to run when both buttons are held
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/z2m-aqara-h1-wrs-r02-wireless-remote-switch-double-rocker/376959/16
mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input "button_sensor"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == 'single_left' }}"
        sequence: !input "single_left"
      - conditions:
          - "{{ command == 'double_left' }}"
        sequence: !input "double_left"
      - conditions:
          - "{{ command == 'triple_left' }}"
        sequence: !input "triple_left"
      - conditions:
          - "{{ command == 'hold_left' }}"
        sequence: !input "hold_left"
      - conditions:
          - "{{ command == 'single_right' }}"
        sequence: !input "single_right"
      - conditions:
          - "{{ command == 'double_right' }}"
        sequence: !input "double_right"
      - conditions:
          - "{{ command == 'triple_right' }}"
        sequence: !input "triple_right"
      - conditions:
          - "{{ command == 'hold_right' }}"
        sequence: !input "hold_right"
      - conditions:
          - "{{ command == 'single_both' }}"
        sequence: !input "single_both"
      - conditions:
          - "{{ command == 'double_both' }}"
        sequence: !input "double_both"
      - conditions:
          - "{{ command == 'triple_both' }}"
        sequence: !input "triple_both"
      - conditions:
          - "{{ command == 'hold_both' }}"
        sequence: !input "hold_both"

For me I had to delete the attribute: action line for the blueprint to work, but YMMV

When I paste this into config.yaml I get a bunch of unresolved tag !input errors. Any advice on how to fix?

Did you ever figure this out? I’m connecting my wireless remote control through Hub M1S gen 2 through homekit controller to HomeAssistant and it detects as AR009 which means I don’t access to the actual sensors for the buttons pressed on the physical switch itself.