Aqara h1 button press not triggering automation

Hi,

I’m very new to Home Assistant and Home Automation in general. I installed HA on my RPi 4 following the documentation on this page. As I understand it that means I’m running HassOS and not Hass.io? Anyway I installed my Conbee II and it seems to be working correctly.

I’m running the latest version as far as I can tell. core-2022.2.2, supervisor-2022.01.1, OS Home Assistant OS 7.2

The scenario I’m trying to realize is this: I have a lamp at the bottom of out stairs. I installed an Aqara Smart Wall Switch H1 EU (No Neutral, Single Rocker) for it. The switch turns the lamp on/ off when clicked so it is installed correctly. I want to be able to turn the lamp on/ off from the top of the stairs as well. I have an Aqara Wireless Remote Switch H1 (Double Rocker) I want to use for this.

The Conbee II was in my list of detected devises (I did install the deCONZ add-on first, not sure if that was necessary) so I configured it from there. Then I added both Aqara switches via the Conbee II device. Both are now listed in my devices and it shows the battery of the wireless switch is 100%.

From the wireless switch I added an automation to turn on/ off the wall switch.

alias: Switch lights at the bottom of the stairs
description: ''
trigger:
  - device_id: 5ae3031cc21a64f56ac304836170b4d5
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: right
condition: []
action:
  - type: toggle
    device_id: ceffc466a2d94029f5a2a974ad9aea00
    entity_id: light.lumi_lumi_switch_l1aeu1_44452200_on_off
    domain: light
mode: single

When I run the automation, the lamp is turned on/ off. So the action is working. The part I’m having issues with is that it is not triggering when I press the remote switch’s right button (or left button, of course I tried that as well). The automation is enabled.
I tried changing the trigger to the left button and I tried double click and long click but the automation is not triggered.

When I look in the logs, I see when the wall switch is pressed and when the automation is run manually from the automation screen. But I don’t see any log entries when I press the remote switch buttons.

I’ve been looking for a solution for a couple of hours now but everything I find either isn’t helpful or it is for some other or older version of HA. Often I’m referred to the Supervisor tab but I don’t have a Supervisor tab.

I could really use some help with this. Thanks!
Wouter

Have a look in the developer tools → events. Start listening to zha_event and press the button of your rocker. You should see the event data of the device.

Here is what i use in my automation, just replace with your data in there and it should work:

  trigger:
    - event_data:
        device_ieee: 00:15:8d:00:03:55:b4:3e [replace]
        unique_id: 00:15:8d:00:03:55:b4:3e:1:0x0012 [replace]
        command: single [replace]
        args:
          value: 1 [replace]
      event_type: zha_event

Thanks for your reply!

I listened to the zha_event as you said and I captured both the right button short click (Event 2) and the left button short click (Event 3):

Event 2 fired 20:15:
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "54:ef:44:10:00:06:64:cb",
        "unique_id": "54:ef:44:10:00:06:64:cb:1:0x0006",
        "device_id": "5ae3031cc21a64f56ac304836170b4d5",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "toggle",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2022-02-06T19:15:23.086786+00:00",
    "context": {
        "id": "204c4da1d24d83e3b90121c21cb97fa4",
        "parent_id": null,
        "user_id": null
    }
}

Event 3 fired 20:16:
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "54:ef:44:10:00:06:64:cb",
        "unique_id": "54:ef:44:10:00:06:64:cb:1:0x0006",
        "device_id": "5ae3031cc21a64f56ac304836170b4d5",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "toggle",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2022-02-06T19:16:43.498525+00:00",
    "context": {
        "id": "d084a193ea3e62b63e123fc17c1ea842",
        "parent_id": null,
        "user_id": null
    }
}

I copied your trigger and copy pasted my device_ieee, unique_id and command. I have no args so I tried both leaving out the args line and using args: []

trigger:
    - event_data:
        device_ieee: 54:ef:44:10:00:06:64:cb
        unique_id: 54:ef:44:10:00:06:64:cb:1:0x0006
        command: toggle
        args: []
      event_type: zha_event

But when I save the automation, I get this error message:
Message malformed: required key not provided @ data[‘trigger’][0][‘platform’]

I noticed the indentation is different from my old trigger, 4 spaces instead of 2 so I tried it with 2 spaces but I get the same error.

Also, since both the left and right button seem to generate identical data and the only difference between the events is the context id, I guess I need to add that somewhere to differentiate between the two?

The Aqara Wireless Remote Switch H1 Double Rocker has quite a few events you can use for the trigger:

I had been trying to use any of the “Left”/ “Right” button xxx events but none of them worked.

I’ve been playing around with NodeRED lately and I hooked up a debugger to the output of the switch. This way I discovered the only event that is sent when pressing either button is the “button” button pressed (Alternate mode) event. This event is fired for either the left or the right button and makes no distinction between short or long presses or multiple presses (double clicking). In the context it does send unique id’s for the left and right buttons but I can’t figure out how to use that in my trigger.

I’ve used the “button” button pressed (Alternate mode) event as my trigger now, but as you’d expect the automation is now triggered by both left and right buttons being pressed. Not what I was hoping for. But this also means I can’t detect double clicking or long presses or both buttons being pressed simultaneously. Functions I was hoping to use later on.

alias: Switch lights at the bottom of the stairs
description: ''
trigger:
  - device_id: 5ae3031cc21a64f56ac304836170b4d5
    domain: zha
    platform: device
    type: remote_button_alt_short_press
    subtype: button
    id: SwitchLandingTrigger
condition: []
action:
  - type: toggle
    device_id: ceffc466a2d94029f5a2a974ad9aea00
    entity_id: light.lumi_lumi_switch_l1aeu1_44452200_on_off
    domain: light
mode: single

Can someone help me to get the trigger to distinguish what button was pressed?

1 Like

Hi,

I had some problem, and it’s because of the “operation mode” the switch is in. As you’ve found out, your switch will only trigger the “alternate” mode event rather than the individual sides.

Changing this is reasonably easy. Find the device from your devices/integration page.

Click manage clusters in bottom left.

Select the AqaraRemoteManuSpecificCluster option from the drop down.

Select “operation_mode” from the attribute drop down list:
image

Now click a switch button 5 times and as soon as the LED flashes blue click “get Zigbee Attribute”. If Home Assistant can reach your switch the value will populate as “0” as in my last screenshot.

Now, change the value to “1” and the manufacturer override code as “4447”.

Wake the device again by pressing a switch 5 times an as soon as it’s flashing, hit the “set zigbee attribute button”.

If this worked correctly, you should be able to go back to an automation and you’ll find the left/right presses are now working as you’d expect. If not, go back to the cluster and the attribute mentioned below, and make sure when you “get” the attribute, it’s coming back as “1” and not “0”. If it comes back as “0” it means your “set” command didn’t work and you’ll have to keep trying to wake and set until it works :slight_smile:

8 Likes

I’m having the same problem. I navigate to the same page but there’s no option for AqaraRemoteManuSpecificCluster option unfortunately. I’ve checked all the others, to see if there’s an attribute for operation_mode to no avail. Any suggestions anyone please?

Have you find it?

I did, but I needed to change from ZHA to Z2M for it to work.

1 Like

Yes thank you, me too

The battery in my switch died and since I was having trouble using this switch and was only using it to switch one single light, I decided to use a sonoff button I had lying around. I basically gave up on the aqara switch…

Thanks for your advice! I will give this a go and see if I can get it working.

That’s good to know, I will probably have to switch to Z2M as well. Now to google what that means and how to do it :slight_smile:

Hi,

I’m having the same trouble, the switch when pressed doesn’t trigger the automation. I cannot find the cluster option mentioned above.

I use a cronbee ii and deconz if that’s anything to do with it?

I am interested in the Aqara wireless double-rocker switch H1 (WRS-R02).
I have a Conbee II stick with Deconz.
Is it really a pain to use in Home Assistant out of the box with this coordinator/integration ?

I have the previous version (WXKG02LM with no light on the front) and it works fine.

I’ve just received my Aqara H1 (wireless double-rocker) and successfully added it in Deconz (I’m using a Conbee 2 stick)

image

The problem is no action are exposed when trying to add trigger in an automation : only the Battery level shows up :crying_cat_face:

I do catch events if I start listening to deconz_event and push either buttons :

Anyone else got more lucky with this H1 device with Deconz / Conbee 2 ?

NB : I see all available actions (single/double/long left/right buttons) when using my Aqara WXKG02LM model.

I found a different way using the event_type as a trigger like so to toggle the right button for instance :

alias: Aqara H1 Toggle dining room pendant lights
description: ""
trigger:
  - platform: event
    event_type: deconz_event
    event_data:
      id: aqara_switch_dining_room
      unique_id: 54:ef:44:10:00:06:5f:e8
      event: 2002
      device_id: 77d17f9d2a63cc777023d3f5f60aad1a
condition: []
action:
  - service: homeassistant.toggle
    data:
      brightness_pct: |
        {% if is_state('sun.sun', 'above_horizon') %}
          40
        {% else %}
          70
        {% endif %}
      kelvin: |
        {% if is_state('sun.sun', 'above_horizon') %}
          3500
        {% else %}
          2700
        {% endif %}
    target:
      entity_id: light.dining_pendant_lights
mode: single

I wish the actions were directly exposed on the device in the automation though for a much more user-friendly approach.
Or I could look for a blueprint to simplify and not have to create automations for each and every single action.

[Edit] Ok, so apparently, that’s how it’s supposed to work, that is use the deconz_event (or the zha_event depending on your integration) to use in automations.

1 Like

Thank you for sharing this.

I aslo have Deconz/Conbee and do not have this Cluster Attributes menu.
It’s only available with Z2M (Zigbee2MQTT) if I understood correctly.

Amazing.
This workee. But in ZHA i still can use only left click and right click. I cannot use double click or continuosly pressing. Is there another option to set?

Works well! Thanks a million!

Have you found how to use double press or long press on an Aqara switch on ZHA? I use a wired no-neutral H1 EU switch and it only triggers in short press.

If I do a double press, it turns the light on and off, or simply ignores the second press if they’re on very rapid succession.