Xiaomi Aqara Mini Switch doesn't show switch

Hello, have you ever tried the direct connection from the Xiaomi gateway to HA? I have no experience with the homekit, but maybe that’s the cause of your problem

Hi, do you solve the problem yet? I have the same problem with my wireless mini switch(WXKG11LM). The mini switch is paired with a homekit version of aqara hub(ZHWG11LM) and I use homekit controller to add hub into HA. I can only see the sensor.wireless_mini_switch_9fdc_battery in entity list. No luck to find any binary_sensor entity and any related event in event tab.

Did you try listening for all events by entering * in the listening box? The event_type doesn’t need to be in the list in the event tab. I have for example deconz_event, which is also not showing up in the events list.

There are a couple of things going on here:

  • “Stateless Programmable Switch” is not supported by homekit_controller (see list of supported devices here: https://www.home-assistant.io/integrations/homekit_controller/)
  • The “Stateless Programmable Switch” type is stateless and won’t show up as a binary_sensor anyway (binary_sensor inherently is on/off, where as stateless switch is just a “pressed” event)
  • homekit_controller doesn’t support events in any released version and as there is no state on this switch there is nothing to poll

The unreleased dev version of home-assistant does support events (PR was merged yesterday) and will be in 0.107.0 hopefully. Support for “Stateless Programmable Switch” is next on my list (My Hue remote also shows up as a “Stateless Programmable Switch”).

4 Likes

Thanks @Jc2k , Any update? Does the latest version now support the “stateless programmable switch”, I am still looking for the solution. As I have two Aqara mini switich and one xiaomi cube switch, I can’t use it now.

2 Likes

As per last update, 0.107.0 now supports events. I’ve also had good feedback on users with Aqara gateways and sensors like motion sensors. Unfortunately some other devices don’t have very robust HK implementations so i’ve spent most of 0.108.0 answering support tickets. At this point i don’t think “stateless programmable switch” support will be in 0.108.x unfortunately.

It’s next on my todo, though. I’ve had a rough and ready PR working but it needs some refactoring as entity-less event sources aren’t something homekit_controller has had to deal with before.

Yes, in current version there is no stateless programmable switch support yet.
We are looking forward to hearing from you! Thank you for your work!

Hi!
What about stateless programmable switch support in 0.109x ?
Thank you!

Again, Thanks @Jc2k, sorry for keep bothering you. But I am a newbie to HA, I have no other way to use thoese stateless programmable swith, maybe I think I can use xiaomi gateway without Homekit suppport. But I am not sure if it possible, even that work, I need to repaired all the sensor and switch to the new xiaomi gateway, and maybe lot of work to make it work with siri. So I prefer to wait the new version of HA to support it, as I have all these device from Aqara support homekit.
BTW, if there is HA release note anywhere? So I can check the new feature by myself.

When you go on the main website there is a wite box on the left hand side that says “Current Version”. In that box there is a link that says “Release Notes”. Click on it. Right now it points to the release notes for 0.109 which are here. You can search for homekit_controller to find stuff that might be related to this.

Right now you won’t find anything. After the massive push at the start of the year (arguably used more time than i actually had to give) i’ve run out of free time and what I do have is currently going on triaging bug reports (especially regressions), not new features. E.g. last night another Aqara user was having trouble with unstable async connections. We found the Aqara can’t handle the level of concurrency we used by default and when I have time i’ll be putting in a PR for that bug.

With where we are in the release cycle, the lack of anyone else contributing to homekit_controller, and my crippling lack of free time I can’t tell you when the change will land. I would say it almost certainly won’t be in 0.110.

But it is a feature that is coming. It is the priority new feature. I have this type of device myself and i want it to work with Home Assistant. I got a prototype working already. The problem is really just one of refactoring the prototype so that it is suitable for code review (it took shortcuts that aren’t of sufficient quality).

If it’s of any interest I got a couple of these switches recently (these ones, right?) and when paired with the Xiaomi gateway they appear as binary sensors. They work fine, I have a couple of automations detecting double clicks and long_click_press.

Hi @thoughton

Which version of the button do you have? Mine says on the back WXKG11LM

BR

Either my eyes are getting worse or those numbers are a bit faint! Yes, it’s the same model WXKG11LM.

OK I have the same, but just now realized you have a Xiaomi-Hub and not an Aqara-Hub. I added it via the Homekit-Controller --> https://www.home-assistant.io/integrations/homekit_controller/
You’ve probably added it via the Xiaomi-Integration, right? --> https://www.home-assistant.io/integrations/xiaomi_aqara/

OK for anyone who wants a stupid solution :smiley:

I create in the Aqara-App for each button-event i want to check an automation, each sets the Aqara-Hub-Light to a different brightness level, waits 1s, and turns it off again. And then I check in HA for the brightness-level, and thus i know which button was clicked.
Here’s my table for a Switch with 2 buttons, first is the brightness in the Aqara-App and second is the one in HA since in HA its from 0-255:

Single-L: 20 / 51
Double-L: 21 / 53.55
Long-L: 22 / 56.1
Single-R: 25 / 63.75
Double-R: 26 / 66.3
Long-R: 27 / 68.85

And then just create a template-sensor:

        tmpl_button2:
            friendly_name: "Button 2"
            value_template: >-
                {% if state_attr('light.aqara_hub_eab7', 'brightness') == 51 %}
                  Links_Klick
                {% elif state_attr('light.aqara_hub_eab7', 'brightness') == 53.55 %}
                  Links_Klick-Doppel
                {% elif state_attr('light.aqara_hub_eab7', 'brightness') == 56.1 %}
                  Links_Klick-Lang
                {% elif state_attr('light.aqara_hub_eab7', 'brightness') == 63.75 %}
                  Rechts_Klick
                {% elif state_attr('light.aqara_hub_eab7', 'brightness') == 66.3 %}
                  Rechts_Klick-Doppel
                {% elif state_attr('light.aqara_hub_eab7', 'brightness') == 68.85 %}
                  Rechts_Klick-Lang
                {% else %}
                  Fertig
                {% endif %}

Works so far, delay of ~1s to turn on a light :slight_smile:

1 Like

Thats brilliant! If it works its not stupid :smile:

Any news? Will it drop in 0.111.x?

Hey, I tried your setup and it kinda works for me, I adjust the brightness the same way you did, but sometimes the template sensor misbehaves, sometimes when I click once it will says Single_Click (working good) but then I would double click and it will still says Single_Click, then after a few presses it will change to Double_Click, (thinking it finally work but…) if I press the button once, it will still say Double_Click on the template sensor! Any insights on this?

I have the same issue. My Aqara switch is connected via a HUSBZB-1 though.

I open to suggestions as well.

I have now Zigbee2MQTT, but what I did was, I set the Hub-Light on, and then i check in HA for the brightness, then set the brightness to a default value, and then turn it of in the HA-Automation rather than on the Aqara-Automation. So it’s as long/short turn on as needed. Better then a set amount of time.
If you don’t set the brightness back to default, next time you turn the light on, for a short time it’s the old value.