Xiaomi Gateway integration - call wireless button click

Hi guys,

I am setting up HA with Xiaomi Gateway. It was very easy to configure switches and scenes to control power sockets and light.

I also have Wireless Button, which supports single, double-click and long press. Is there a way to trigger a single click from HA? Or put it to the home page so I can simulate single/double/long click from the dashboard?

Thanks

You can put a script in your frontend to controll whatever you are controlling with your button
Cordially

Don’t know how to put a script to the frontend yet, will take me some time to understand how it works. Anyway there are so many actions configured for a single click in my case so it is easier for me today just to trigger this, if it is possible

So I guess you have already a script or an automation attached to the button single click event, you just add that script or a script calling your automation also to the front end.

Group
Script

And then you use the same functionallity as the button, from the Frontend

Cordially

Jose

No, I don’t have any scripts in home assistant, only automation configured in MI Home app, which is called by a single click.

There are 2 actions caused by a single click - turn off Xiaomi Philips EyeCare and also turn off TV via Xiaomi IR Remote. It is not possible for me to extract tokens for Philips lamp and IR Remote as I do not have rooted phone and this is the only way to extract it today. So I cannot add and control those devices from Home Assistant.

This is the reason why I want to call single click from the dashboard.

Hass does not send a click command to your Xiaomi Gateway it only monitors for clicks then with that information it triggers a script or automation. I’ve included a example of HASS waiting for a " single" click to trigger a light to turn on.

- id: '1525140123456'
  alias: Xiaomi Button - Living Room - Lamp
  trigger:
  - event_data:
      click_type: single
      entity_id: binary_sensor.wall_switch_right_158XXXXXXXXXXX
    event_type: click
    platform: event
  condition: []
  action:
  - data:
      entity_id: light.livingroom_lamp
    service: homeassistant.toggle
1 Like

@gambit2552 I see the @Serg’s point and I have same issue. I want to trigger event (like button click) from HA that will do some automations in Mi Home because I also have a couple of devices (e.g. Aqara bulb) which I cannot integrate to HA.

@Serg I believe that there is no solution for our task. I left my automation on Mi Home side and decided to buy in future only devices that have HA support.

@Serg At least at this moment I see the this as a solution, but I am not sure that it is feasible. Please look at my diagram.

The idea here is to share all the possible devices with HA from two sides. All the supported Xiaomi devices can be integrated via Xiaomi Gateway, all the rest should go via Aqara Hub to HomeKit and from HomeKit to HA.

For my case it means that aqara bulb will be available in HA and I’ll be able directly control it.
What do you think guys?

I had a different case, but managed to solve it via script, don’t remember now what was the case as it was 2 years ago. Also I am getting rid of all xiaomi/aqara hubs - uzing deconz to control all xiaomi sensors/switches.