Xiaomi button errors

Hi,
So ive got an aqara double wireless switch and a mi button to but none of the state changes are picked up by home assistant but they do show up in the mi home app.

scratch that automations work but the state never shows any changes in the ui,

I’m having the exact same problem.
Were you able to fix it?

Yeah the state changes never show up in the HA UI but they are happening, try use it as a trigger in your automation and it will work.

Oh, fantastic, thanks for your answer! Can it handle single, double and long press?
Mine seems to present itself as a binary sensor, that’s why I’m asking.

The buttons made by xiaomi support all three, the aquara button i think only support single presses

Aqara square button supports click and double click.
Annoyingly it does not support long press or release.
Also the double click needs to have more delay between clicks.
Weird

I dont think my aquara square suports double click because even if I try and double click it still fires the single click events.

I thought the same to start with.
With the old round buttons the double click is like you’d do with a mouse, but not the square ones. That is more click wait click…
Try leaving a half second or more between clicks.

@hijinx @matt2468
Hi guys.
Could you post some of the automation yaml? I’m not getting the trigger from the aqara button press.
Also, is it possible to handle the double click?
Thanks.

I’m not entirely sure if this is what you’re looking for, but i set automation rules to trigger based on an “event” from the button, not its state.

Also, as @hijinx described, the square one seems to need some kind of delay between the clicks to get a double click event. here is an example I use:

 - alias: 'Left Home or Sq Button (turn off all)'
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: group.portable_devices
        from: 'home'
        to: 'not_home'
        for:
          minutes: 10
      - platform: event
        event_type: click
        event_data:
          entity_id: binary_sensor.switch_158d000xxxxxxx
          click_type: double
    action:
      - service: switch.turn_off
        entity_id: group.living_room
      - service: switch.turn_off
        entity_id: group.bedroom
      - service: light.turn_off
        entity_id: group.all_lights
      - service: notify.me
        data:
          title: 'Left Home, Turned off everything'
          message: "Away mode triggered"

Here is an example:

- alias: Doorbell
  trigger:
    platform: event
    event_type: click
    event_data:
        entity_id: binary_sensor.switch_xxxxxxxxxxx
        click_type: single
  action:
    - service: script.sonos_say
      data:
        sonos_entity: media_player.office
        volume: 0.5
        delay: '00:00:04'
        message: 'Ding dong. Doorbell'

    - service: xiaomi.play_ringtone
      data:
        gw_mac: xxxxxxxxxxxx
        ringtone_id: 10
        ringtone_vol: 8

    - service: notify.PushBullet
      data:
        title: HA Notification
        message: 'Ding dong. Doorbell'
        data:
          url: google.com

Awesome. Thanks guys. Didn’t know it was a click event.