Z2M - Aqara H1(WRS-R02) - Wireless remote switch(Double Rocker) (Updated) - Single/Double + Single/Double/Hold

Updated version of Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker)
Tested on WRS-R02
HA: 2022.8.7
Z2M: 1.27.0/6.10.3.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_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-updated-single-double-single-double-hold/455665
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"
1 Like

Hello,

I used this blueprint with one of the Aqara H1 double rockers and was working fine. I tried to use it for other H1s I recently bought and is not working. I have been trying to troubleshoot but cannot figure it out. The aqara buttons have the same firmware so I don’t understand why they behave differently. Any ideas what I might be messing up ? Thanks

Check your MQTT logs to see what payload action is received. I don’t own other H1’s.
But I’m sure the payload varies between single and double buttons for example.
H1 single button actions: single , double , hold
While for the double rocker it is single_left, single_right and so on.

Let me know the model number of your exact H1 and I can make blueprint for you, drop me a PM, to keep this topic sort of clean :)!

Mind dropping me a message? I can’t seem to send you one.

I had to change the trigger to have it working. I don’t know why but for me it’s the state that hold the command.
So i just remove the attribute: action in the trigger and now it’s working.

Thank’s for the work.

Hi,

where do I paiste teh code? Into the config.yaml-File?

Best regard and thanks for your work
Ben

Hi @Christoxz thanks for this blueprint. It works for me with a single action per button - but not when there is more than one action.
So, this works to toggle an input selector to select the next scene:

  input:
    button_sensor: sensor.downstairs_hall_light_switch_action
    single_left:
      - service: input_select.select_next
        data: {}
        target:
          entity_id: input_select.downstairs_hall_lights

Or this works to select a scene directly:

  input:
    button_sensor: sensor.downstairs_hall_light_switch_action
    single_left:
      - service: scene.turn_on
        target:
          entity_id: scene.downstairs_hall_ambient

But the blueprint only takes the first action when there are multiple actions per button press:

  input:
    button_sensor: sensor.downstairs_hall_light_switch_action
    single_left:
      - service: input_select.select_next
        data: {}
      - service: scene.turn_on
        target:
          entity_id: "{{states('input_select.downstairs_hall_lights')}}"

What I’m want to achieve is to toggle between two scenes with the same button press (ambient and off).

I modified two lines of the blueprint to make this work:

  • change: mode: restart to mode: single
  • comment out: attribute: action (I don’t know what this does, but the blueprint didn’t do anything until I removed this line)

Hope that helps?

1 Like

Hi Ben, you need to create a new .yaml file under config/blueprints/automation. Once the file exists, you should be able to create a new automation using the blueprint (Z2M - Aqara H1(WRS-R02) - Wireless remote switch(double rocker))

If that doesn’t work for you, go to Blueprints > Import blueprint and paste this blueprint address

https://community.home-assistant.io/t/z2m-aqara-h1-wrs-r02-wireless-remote-switch-double-rocker-updated-single-double-single-double-hold/455665

Then click Preview > Import blueprint

You can now create a new automation from the blueprint. Both methods do the same thing. In the first you’re manually creating the blueprint yaml file. In the second, the import process creates the file for you.

Hope that helps?

Does anyone know about a blueprint for this device for Deconz ? thank you !

Thank you.

Can be added support of HOLD RELEASE?
Thanks.

For those who have been scratching their heads, when your actions does not seem to acting as you expect. In my case my scene of three lamps only turned on 1 or of them on.

The modeis set to restart which means the automation restart everything a change has happened in the state entity. For me it changed so quick, that it would restart the automation, before even finishing all of the task.

So please set: mode: true

Dear Martin,
Thanks for your reply and your help.
Importing the blueprint worked for me. But I cant create the automation because I cant select the switch as an entity?

Shown are only the devices I added by the mqtt-Broker.

Can you help me again?
Best regards
Ben

Hello all,

I don’t understand why but your blueprint don’t work with entity group. It just start the service on the first entity in the group and stop.

Dop you have a idea of this issue?

I am having the same issue. Have been using this blueprint for a long time. Was working great till the latest release.

Sorry everyone, at the moment I have no HA running, so I can’t check by my self.

I will look into it ASAP, and I will change my post if someone else came with a solution.

I also have used this for a long time with no issues, but after a recent update it stopped working for hold, right clicks etc. Only the left click worked.
Changed the mode to single and now everything works fine again.