Aqara Mini Switch / Zigbee setup

I am new to the Zigbee / ZHA world, and am a bit stuck …

I have plugged a Sonoff Zigbee USB stick in to my HA NUC, added the ZHA integration to HA, and added an Aqara Mini Switch.

But when I add an Automation (within the Integration, not within the “main” HA Automations section), nothing happens.

Taking this as an example, what might I be doing wrong? The device light.tall_lamp is a Hue bulb, and I am able to control it via my usual dashboard.

It could well be that I have not set up the switch correctly rather than made an error with the coding - but not sure where to start …

TIA

alias: New Automation Tall Lamp
description: ""
trigger:
  - device_id: a3f9cbb24f18b9a67de18761c8e44a86
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: remote_button_short_press
condition: []
action:
  - type: turn_on
    device_id: 49d2ca499d1f4555b7e6f83db04b0da3
    entity_id: light.tall_lamp
    domain: light
    brightness_pct: 100
mode: single

To add - if I select “RUN” within the automation, the light goes on and off as desired, so it looks like it is a communication / integration / hardware issue and not a coding problem. But how to determine what needs fixing?

TIA

I’m guessing you are puzzled because there is no state information for your ‘switch’ in the device info?

What you have is technically a momentary button. It doesn’t have a state - it’s not on or off. It does fire events though - which is why the automation works.

This is different to, say, a light switch which typically toggles on and off and stays in the on or off position. Because of this such a switch will have a state.

Thanks @templeton_nash - I understand what you are saying, but the automation only works if I select (ie click on) “RUN” - it does not work if I press the button. So there is a lack of communication between the button and HA, but this is the first time I have used Zigbee or ZHA, and can’t work out why :cold_sweat:

I use a Blueprint to work with my Aqara button. Maybe you could give it a try. I use this one.

Thanks again, @templeton_nash . I dug a bit deeper and saw that the button was “Offline”, so took the back off & re-paired it, and it now works perfectly. And now even the battery state shows up - Double Plus Good.

I can see that these Aqara switches are going to become quite addictive too!

1 Like

I paired my Aqara Mini Switch with Zigbee2MQTT and imported the blueprint. When I try to create an automation, however, the pulldown menu for Device is empty so I cannot assign this to a button.

What am I missing?

I’m a little new on HA using ZHA and have setup a lot of aqara door and motion sensors on Alarmo and it all works fine. When I pair the Aqara Mini Switch only see Battery (as a lot of people). I imported your Blueprint from github and that all went well. I see it on my Blueprint list in UI. I clicked on create animation for it and filled out the form with the button device. Wasn’t sure how to fill out the Action. I selected Event and saved. Went to dev tools events and looked for zha event. Pressed the button and see no event. I’m sure I messed something up. Can you help on this? Thanks

Update: Found solution, use the aqara_zigbee_button.yaml blueprint!

For me it worked, if I don’t try to setup an automation starting from the blueprint, but from the device itself.
So go to the device page and click in the automations tile on the “+”. There you can select the event and assign an action to it. Nothing needs to be setup in the blueprint at all.

2 Likes