Aqara button automation not working [Solved]

Hi all,

I am trying to setup my first automation using the aqara button, I have copied the code from the guide and replaced it with my entities but it is not working, am I missing something?
This is what I have in the automations yalm:

- id: button_press
  alias: Toggle Gateway light with button click
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d0001ef3ad8
      click_type: single
  action:
    service: light.toggle
    data:
      entity_id: light.buro

Could you format your code using the </> button in the editor please? It makes it easier to see whether there are obvious syntax/indentation issues
image

done :slight_smile:

Can you try this and let me know if it works?

- id: button_press
  alias: Toggle Gateway light with button click
  trigger:
    platform: event
    event_type: signal_received
    event_data:
      entity_id: binary_sensor.switch_158d0001ef3ad8
  action:
    service: light.toggle
    data:
      entity_id: light.buro

Thank you for the suggestion but unfortunatly it doesn’t work.
I have turned on the log for the button and as far as I can tell it is working.

2018-10-18 11:29:18 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Switch_158d0001ef3ad8: off>: {'button_0': 'click', 'raw_data': [{'button_0': 'click'}]}
2018-10-18 11:29:20 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Switch_158d0001ef3ad8: off>: {'button_0': 'click', 'raw_data': [{'button_0': 'click'}]}
2018-10-18 11:30:45 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Switch_158d0001ef3ad8: off>: {'button_0': 'click', 'raw_data': [{'button_0': 'click'}]}
2018-10-18 11:30:50 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Switch_158d0001ef3ad8: off>: {'button_0': 'click', 'raw_data': [{'button_0': 'click'}]}

I’m also using the buttons from Xiaomi and I love them
Here is what I have and I can confirm that it is working :slight_smile:

Xiaomi Button

- alias: Xiaomi Button
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_xxxxxxxxxxxxxxx
      click_type: long_click_press
  action:
    service: light.toggle
    data:
      entity_id: light.gateway_light_xxxxxxxxxxx

In this case I’m using the long press, not the single or double, but that can be changed to your matters.
Any luck?

Yes im really liking their products, its the reason I switched from vera to home assistant, when i get everything to work im going on a shopping spree :smiley:

Anyway, I think my buttons version doesnt support long click, this is confirmed by the log file i think, it only shows single clicks and double clicks.
Tried it anyway but it doesnt work :frowning:

Oh okay :frowning:.
Do you know wha version you are using?
What about your gateway?

The button is the aqara second gen, the square one.
The hub is the third generation, the one with the AC function.

upgrading HA has fixed my problem!
After the upgrade the switch entity changed name for some reason, changed it in the config file and it worked!
(Changed from “binary_sensor.switch_158d0001ef3ad8” to “binary_sensor.switch_158d0001ef3ad8_2”)