[solved] Aqara Gateway Wireless Switch: No event is fired

Hello,
I have a problem with my Aqara Wireless Switch. I have several of these devices in use. For some days no event is fired anymore or the automatisms do not work. I can not find the mistake.

I have only a single test automatism.

My configuration.yaml:

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - mac: 78:XX:XX:XX:XX:XX
      key: pnt22yxxxxxxxxxx
      host: 192.168.178.47

My automations:

  - id: schalter8
    alias: Schalter Hobbyraum einfach
    trigger:
      platform: event
      event_type: click
      event_data:
        entity_id: binary_sensor.switch_158d0001e7900e
        click_type: single
    action:
      service: light.turn_on
      entity_id: light.hobbyraum_tv

The following is visible in the logs (debug level for the gateway):

2018-11-26 10:34:14 DEBUG (Thread-2) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-11-26 10:34:14 INFO (Thread-2) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-11-26 10:34:19 DEBUG (Thread-2) [homeassistant.components.xiaomi_aqara] Gateways discovered. Listening for broadcasts
2018-11-26 10:34:52 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Switch_158d0001e7900e: off>: {'status': 'click'}

I have several devices (door sensors, motion detectors, etc.) that work properly.

Where is the mistake?

Did you try repairing them? Or maybe are they too far from the gateway?
The range of such a gateway is really not all that great. Especially if you have concrete (and reinforced) wall.

I had problem with my aqara push button while installed just ~10 meters from the gateway, but with 4 walls in between (the opening of the corridor didn’t help).
After moving the gateway closer, it works fine.

Can you check with the xiaomi app that those are functioning correctly?

Everything is displayed correctly in the app. And I also see in the HA Log that the pressure arrives … Only the event is not triggered.

If your indentention is the same as in your configuration.yaml file, you have an error in indentention.
action: should be in the same level with trigger:.

This is a Copy & Paste error (I have corrected the original entry)…
here for control

  - id: schalter8
    alias: Schalter Hobbyraum einfach
    trigger:
      platform: event
      event_type: click
      event_data:
        entity_id: binary_sensor.switch_158d0001e7900e
        click_type: single
    action:
      service: light.turn_on
      entity_id: light.hobbyraum_tv

My configuration is also different from yours. I don’t know if it creates an error point or not.

xiaomi_aqara:
  gateways:
    - mac: 34xxxxxxxx
      key: !secret aqara_key

One thing that also caught my eye is in the aqara definiton page the example action is given as below:

  action:
    service: light.toggle
    data:
      entity_id: light.living_room_lamp

I also don’t use data in action and it seems to work fine with only:

  action:
    service: switch.toggle
    entity_id: switch.wall_switch_xxxxxxxxxxx

Thanks first of all. I’ve already tried it in the configuration without the host. But that makes no difference.

I think that problem has to be somewhere else. In the logs you can see that the keystroke arrives quite well. Only the event is not processed …

The other components on the gateway also work correctly. Only all switches simply do not react within HA anymore …

If you recently updated the Xiaomi Gateway you might be out of luck, I’ve seen a few threads of people reporting it stopped working for them after they updated it.
I think the app has a very simple way of updating all devices at once and with no confirmation prompt so it’s pretty easy to just press on it and update it unintentionally, the update runs in the background so you won’t even notice it is happening.

So far I haven’t seen anyone reporting a fix for that or how to rollback the FW update.

Thanks for the note. Yes, the firmware is also in use. But there is another problem described. There seems to be no connection possible. With me, only the switches are no longer …

Discusson in openhab forum too.

I’m sorry, but I can not imagine that I’m affected by it. The problem is that the gateway is not accessible anymore. With me it is reachable and all components work without errors except for the switches.

DAMN!! Sorry. It was my mistake.

I had completely forgotten that I switched to the current beta due to the bug in my Onkyo receiver … And there is the processing of events has been changed … I have not read …

I have adjusted everything with me and the switches work again as desired …

I’m so sorry. Thanks anyway for the help.

This is correct automation.yaml (after upgrading to 0.83.0:

  - id: schalter8
    alias: Schalter Hobbyraum einfach
    trigger:
      - platform: event
        event_type: xiaomi_aqara.click
        event_data:
          entity_id: binary_sensor.switch_158d0001e7900e
          click_type: single
    action:
      - service: light.toggle
        entity_id: light.hobbyraum_tv

The key is the point “event_type”. See also

1 Like

I am getting the same error, can someone please help!

2018-12-02 04:34:14 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-12-02 04:34:54 ERROR (SyncWorker_7) [homeassistant.components.xiaomi_aqara] No gateway discovered
2018-12-02 04:34:54 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.

Below is my config .yaml
xiaomi_aqara:
discovery_retry: 10
gateways:
#hub1
- mac: XX:XX:XX:XX:XX:XX
key: key
#hub2
- mac: XX:XX:XX:XX:XX:XX
key: key

Ahhhh, thanks for posting this! All my switches stopped working a few weeks ago. I thought it was related to the gateway’s firmware being updated. Turns out I was caught out by the change to xiaomi_aqara.click.

I’m not running any betas, I just update to the latest version when I notice an update. I’m on 0.84.3 at the moment.

Is there a way to keep track of future changes like that? It’s quite a major change in the sense that it renders all switches unusable with no warning or indication as to what happened.