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

It should work. However, I recommend installing some 3rd party software that gives you access to MQTT messages ( I use “MQTT Explorer”); after installing this type of software, you should be able to see all the messages sent to your MQTT broker and most probably determine if there is any spelling mistake.

This worked for me

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: queued
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 "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"
2 Likes

Yesterday I connected my Aqara H1 switch WXKG15LM to HA and saw this blueprint to get the multi buttons working. I have imported the blueprint and linked the automation to it, but unfortunately nothing happens when I press the button on the switch. I may have missed something that is causing it not to work.

I hope someone can help me so that I can get the buttons working. I was able to change the status from single button to multi by quickly pressing the left button 5 times.



2024-06-20 07_53_30-Window

Thank you.

I have got it working. Deleted the device and added again in 1 click mode.
In that mode it works for me.

how did you added it again in 1 click mode?

I used the switch manager addon to get it working.

I got it working as well. First time I tried I wasn’t able to switch the operation mode to ‘event’, it alqays changed back to ‘command’ on it’s own.
After removing and adding my H1 switch again to z2m, I was able to set click mode to multi and operation mode to ‘event’. After doing this, I saw action changes like double_left and triple_left in the logs.
So I changed the event names in the blueprint accordingly, like @Dis90 wrote above and it worked :partying_face:

Edited this blueprint to work with device triggers in MQTT, since action sensors have been removed in zigbee2mqtt 2.0.0

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_device:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        device:
          integration: mqtt
          multiple: false
    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: {}
  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
triggers:
- trigger: device
  id: 'button_1_single'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: single_left
- trigger: device
  id: 'button_1_double'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: double_left
- trigger: device
  id: 'button_1_triple'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: triple_left
- trigger: device
  id: 'button_1_hold'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: hold_left
- trigger: device
  id: 'button_2_single'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: single_right
- trigger: device
  id: 'button_2_double'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: double_right
- trigger: device
  id: 'button_2_triple'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: triple_right
- trigger: device
  id: 'button_2_hold'
  domain: mqtt
  device_id: !input button_device
  type: action
  subtype: hold_right       
action:
- choose:
  - conditions:
    - '{{ trigger.id == ''button_1_single'' }}'
    sequence: !input button_left_single_press
  - conditions:
    - '{{ trigger.id == ''button_1_double'' }}'
    sequence: !input button_left_double_press
  - conditions:
    - '{{ trigger.id == ''button_1_triple'' }}'
    sequence: !input button_left_triple_press
  - conditions:
    - '{{ trigger.id == ''button_1_hold'' }}'
    sequence: !input button_left_hold
  - conditions:
    - '{{ trigger.id == ''button_2_single'' }}'
    sequence: !input button_right_single_press
  - conditions:
    - '{{ trigger.id == ''button_2_double'' }}'
    sequence: !input button_right_double_press
  - conditions:
    - '{{ trigger.id == ''button_2_triple'' }}'
    sequence: !input button_right_triple_press
  - conditions:
    - '{{ trigger.id == ''button_2_hold'' }}'
    sequence: !input button_right_hold
2 Likes

Aha, I’d not spotted the update to the thread and made the bare minimum update the blueprint locally :grin:

Here’s my take if it helps anyone :blush:

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    aqara_switch:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        device:
          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: queued
max_exceeded: silent
trigger:
- platform: mqtt
  topic: zigbee2mqtt/+/action
variables:
  device_name: !input aqara_switch
  expected_topic: zigbee2mqtt/{{ device_attr(device_name, 'name') }}/action
action:
  - variables:
      command: "{{ trigger.payload }}"
  - 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"
3 Likes

Worked nicely. :+1:

i only see a battery power sensor… how come? i deleted the switch and added it again. changed to fast and multi.

same here, only able to select a bunch of battery sensors, but no remotes much less the H1. =\

i only just figured this one out, did you manage?

Can I ask how you figured this out? I only see battery sensor too.

use Marcus’ blueprint, select the sensor and save it. go back out into the automation page and you will see an error for that automation, go back in and now the device should appear.

Still no joy. The only entity I get is sensor.main_light_battery, I don’t get an error on the automation, nor does anything new appear when going back in.

I have it in multi mode but I don’t know about operation mode - could that make a difference? I can’t seem to change it from event to command anyway.

Hi, Newby here, needing some help :slight_smile:

What does the red exclamation mark in front of the file name mean? How can I fix it? This is Marcus’ blueprint from above. I would like to use it, but it does not show up in the list of HA Blueprints. What to do? I would really appreciate any help!

Hello there,
came to this thread after updating my Z2M and the actions didn’t worked anymore.
This blueprint worked fine, but I had the issue that I created multiple automations using it, and no matter which light switch I pressed, all automations based on this blueprint and the corresponding action were triggered.

I modified the blueprint so that it now works correctly for me.

blueprint:
  name: Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
  description: Scene & device control using Aqara two button remote
  domain: automation
  input:
    aqara_switch:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        device:
          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: queued
max_exceeded: silent

trigger:
  - platform: mqtt
    topic: zigbee2mqtt/+/action

variables:
  device_name: !input aqara_switch
  expected_topic: zigbee2mqtt/{{ device_attr(device_name, 'name') }}/action

condition:
  - condition: template
    value_template: "{{ trigger.topic == expected_topic }}"

action:
  - variables:
      command: "{{ trigger.payload }}"
  - 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"

Best Regards,

Springeraner

Hi, can some help me why I’m getting this error when edit the YAML of the/this blueprint(s)?


Unknown tag !