Xiaomi Aqara Smart Wireless Button

Hi all,

I would like to integrate my Xiaomi Aqara Smart Wireless Button in an automation. The goal is that after a click my living rool lamp (Xiaomi Bulb) turns on. Then after a further click the lamp turns off.

I have tried it several times with the configuartion which is used for the wall switches but it doesn’t work.

  • alias: Livingroom switch left button single click
    trigger:
    • platform: event
      event_type: click
      event_data:
      entity_id: binary_sensor.wall_switch_left_158d000171d630
      click_type: single
      action:

Can someone tell me which event or sate I have to you to start the automation?

Xiaomi Aqara Smart Wireless Button

Try the automation below it works for me. I use the old Xiaomi button but it should be the same

# Xiaomi Button click toggle gateway light
- id: button_press
  alias: Toggle Gateway light with button click
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d0000ed4f98  <- replace with your switch
      click_type: single
  action:
    service: light.toggle
    data:
      entity_id: light.gateway_light_34ce00fa69ef <- replace with the light you want to toggle

Thank you for your automation script. I got the following error message:

2017-11-04 09:34:06 ERROR (SyncWorker_4) [homeassistant.util.yaml] expected ‘’, but found ‘’
in “/config/automations.yaml”, line 24, column 1
2017-11-04 09:34:06 ERROR (MainThread) [homeassistant.components.automation] expected ‘’, but found ‘’
in “/config/automations.yaml”, line 24, column 1

Check your single quotes.

The automation from dodacs works fine. As slonkar said the issue was based on my quotes from the previous autoamtion. Thank you very much for your help!

Hi, do you need the xiaomi zigbee hub for this button?

Yes, you need the Xiaomi Gateway.
https://xiaomi-mi.com/mi-smart-home/xiaomi-mi-gateway-2/

1 Like

thanks Kanishkaz,

Hi to all!

I am trying basically the same thing, only I have Xiaomi aqara wireless single switch + Ikea tradfri bulb.
I copied your code and adopted it:

# Xiaomi Button click toggle gateway light
- id: button_press
  alias: Toggle Light
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.wall_switch_158d00017100b7
      click_type: single
  action:
    service: light.toggle
    data:
      entity_id: light.boravak

But I am getting this error then:

end of the stream or a document separator is expected at line 90, column 1:
- id: button_press
^

I got it to work, thanks…

Hi, excuse me for reviving this thread, but I’ve read it all and I can’t find a way to see my Aqara button ( this one : https://fr.gearbest.com/access-control/pp_626695.html ) in HASSio :frowning:
When I check the dev info in mi Home it shows :

{"model":"lumi.remote.b1acn01","did":"lumi.158d0001a66d77","name":"Aqara Wireless Mini Switch"},

Then I tried several way to call the entity_id in my automation but can’t find the right syntax. Can someone help me please ?

Last I tried was :

- alias: Bouton allumer éteindre bureau
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d0001a66d77
      click_type: single
  action:
    - service: light.toggle
      entity_id: light.hue_bloom_nico
1 Like

Hi is It possible tô use xiaomi Button with other bulbs? I have limitless lamps they work through a Gateway in wi-fi.

Tks