Core: Xiaomi Aqara button doesn't trigger automation

Created on 12 Aug 2018  Â·  7Comments  Â·  Source: home-assistant/core

Home Assistant release with the issue: 0.75.2

Last working Home Assistant release (if known): I think around version 0.72

Operating environment (Hass.io/Docker/Windows/etc.): Docker

Component/platform: Xiaomi Aqara switches

Description of problem: When I click a button of my Xiaomi Double Switch, I see that the button is triggered in the logs, but the automation isn't. The same problem with the smaller wireless buttons.
When I trigger the automation manually, it executes.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - host: 10.0.40.24
      mac: !secret xiaomi_mac
      key: !secret xiaomy_key
- alias: Switch living table
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.wall_switch_living_right
      click_type: single
  action:
    - service: script.notify_telegram
      data:
        message: 'Light button pressed'
        title: '*Message from home*'
    - service: homeassistant.toggle
      entity_id: light.living_tafel

Traceback (if applicable):

2018-08-12 15:25:20 INFO (MainThread) [homeassistant.core] Bus:Handling <Event click[L]: entity_id=binary_sensor.wall_switch_living_right, click_type=single>
2018-08-12 15:25:20 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch (Right)_158d000214fce0: off>: {'channel_1': 'click'}

Additional information:

Most helpful comment

Interesting this must only impact certain models as my Xiaomi Aqara buttons (small circular ones) are working fine in 0.75.x

All 7 comments

Interesting this must only impact certain models as my Xiaomi Aqara buttons (small circular ones) are working fine in 0.75.x

I am experiencing similar problems. After the 0.75.3 update, I lost connection to the Xiaomi Gateway. Uninstalling and reinstalling AppDeamon partly fixed this, no clue why. However, the Aqara Buttons (square ones) still won't trigger any automations at all. On my secondary Home Assistant (still on 0.75) it all works flawlessly. I rebooted the access point and router several times but can't seem to find a solution. Any ideas how to fix this issue?

Just updated to 0.75.3 and not seeing any problem with Xiaomi Gateway + Aqara buttons + automations (was running 0.75.2 for a week before that then 0.6x for many months). My YAML looks very similar except my "trigger" has a "-" making it an item in a list. My home assistant toggle has the entity under data

- alias: "Turn on bed room lights"
  hide_entity: true
  trigger:
    # Single press bedroom round switch
    - platform: event
      event_type: click
      event_data:
        entity_id: binary_sensor.switch_158d00019cafe8
        click_type: single
    # Single press square switch
    - platform: event
      event_type: click
      event_data:
        entity_id: binary_sensor.switch_158d0001b8f843
        click_type: single
  action:
    service: homeassistant.toggle
    data:
      entity_id: group.bedroom_lights

Occasionally I'll have to restart HA since it will stop talking to the Xiaomi gw. I also updated the gateway to the latest firmware a week ago--not sure if that makes a difference (the gw seems to be working since it's registering the event)

Tried with the small circle, small square, and wireless larger square that has 2 buttons and they're all working for me.

Might be able to debug more with the /dev-event/ page (radio tower icon under developer tools at the bottom of the navigation). It has a pane on the right showing listeners on events and allows you to manually send events by inputting the data

Hi, I am new to here.

I have the same problem with lumi.acpartner.v3 and xiaomi wireless switch (WHKG01LM) on HA 0.75.3 .

here is my automation YAML:

- id: '1534568106170'
  alias: 新建自动化2
  trigger:
  - event_data:
      click_type: single
      entity_id: binary_sensor.switch_158d000102fa6c_2
    event_type: click
    platform: event
  condition: []
  action:
  - data:
      gw_mac: [SECRET]
      ringtone_id: 8
      ringtone_vol: 10
    service: xiaomi_aqara.play_ringtone

After press wireless button, I can see those logs without any automation triggered:

2018-08-18 13:15:12 DEBUG (Thread-2) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'sensor_switch', 'sid': '158d000102fa6c', 'params': [{'button_0': 'click'}]}
2018-08-18 13:15:12 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Switch_158d000102fa6c: off>: {'button_0': 'click', 'raw_data': [{'button_0': 'click'}]}

After my troubleshooting, I tried to change the variable "_data_key" of switch_sensor from "channel_0" to "button_0".

Then the automation works.

Thanks.

Hi, glad to see I am not the only one experiencing problems.

I reflashed a new SD card and set everything up from scratch again on my PI 3. Same issues and it drove me insane. This was version 0.75.3. I tried to falsh a previous version but this didn't work for me. The PI never started Hassio.

I created a virtual PI on a Windows 10 machine with Virtualbox and Ubuntu 18.04 and that worked like a charm. I am using 0.75.3 on this one as well I don't have the issues with the Xiaomi hub error and dead sensor. I don't know why but it's been working for the last few days. Having running it on a PC is something I wanted to do all the time anyway. Gives me the opportunity to clone an entire set-up for quick testing and configuration tweaks. I will certainly test every update before rolling it out to the live system. Having no corridor light and no bathroom ventilation wasn't great.

Cheers

Most of the comments here are about packet loss: https://github.com/Danielhiversen/PyXiaomiGateway/issues/26

@aheadlead should update HA. The data_key issue of the v2 protocol is fixed already.

I can confirm that everything works again, and I've only updated Home Assistant a few weeks ago!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abouelric picture abouelric  Â·  165Comments

rschaeuble picture rschaeuble  Â·  230Comments

Ciqsky picture Ciqsky  Â·  129Comments

soldag picture soldag  Â·  143Comments

jeromelaban picture jeromelaban  Â·  123Comments