Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)


(Keith G) #708

Actually, the end user doesn’t need to worry about it, and there’s no additional settings to be concerned with either.

I just explained it above as a proof of concept. All the user has to do is either set the motion reset time to what they prefer or leave it at the default of 60 seconds. The second countdown timer would make sure the behavior of the DTH matches that setting regardless of whether the sensor is in testing mode or not (instead of not matching as happens right now.)

But I do agree that users should be aware of the testing mode and the advantages of reducing the motion reset preference setting to make the process of deciding on the placement of the sensor easier to accomplish. This is just a DTH though, and not a Smart App, so it’s a bit out of the scope of the code’s functions to send notifications to the user regarding the testing mode.

EDIT: Just to clarify - This change I’m suggesting would not disable the test mode in any way. The motion reset preference setting should still be set to a lower number, such as 6-7 seconds, and then the mobile app would still give frequent immedate visual feedback to help determine the best location for the sensor.


(phil) #709

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


(Keith G) #710

To anyone using a round “original” Xiaomi button and also using webCoRE:

I have made changes the DTH to reincorporate and improve on a4refillpad’s method for a momentary button mode that allows for short presses to generate a button “pushed” event, and holding the button for a custom length of time generates a button “held” event.

It’s working great as far as I can tell, but I am not an avid webCoRE user.

So if you’d like to beta test the DTH code, please PM me.


#711

If anybody wants to buy, sell, or trade devices, please create a thread in the Deals section of the forum.

https://community.smartthings.com/c/devices-integrations/deals

(Atle Dale) #713

so I should not enter anything for Zigbee id? Will it hurt to do it?


(Keith G) #714

If you don’t know what the device’s ZigBee ID is, it doesn’t hurt anything to leave it blank.

However, if you do have it, I have read that knowing the ZigBee ID can be helpful for the hub to maintain a connection to the device.

However, I have a couple of Xiaomi devices (the Mi Cube, and a wall-mount light switch) that refuse to pair the normal way and I needed to use the catchall method, and I later noticed that the hub had automatically filled in their ZigBee IDs. I guess that it must have received a message from them which contained their ZigBee ID.


(Kenneth Eriksen) #715

Thank you SO much for all your work here guys…! :clap:
Have multiple door sensors and buttons working flawlessly (if you don’t count in the pairing) :roll_eyes:

Is there any hope for the same “held” functionality regarding the Aqara button DH?

I am using this DH with the “new” Aqara wireless wall button (1 button - battery powered) and it works very well, and would love getting the hold function to work on these too:

I must say that i’m impressed with both the the finish and the build quality of these, which is very high.
They have been very reliable as simple push buttons and the WAF (Wife Acceptance Factor) is 10/10. :grinning:

I’m new to ST and trying to steer clear of WebCore, so if the hold functionality was implemented so these devices could send a “Held” to Smart Lighting and the other apps, they would double in value… :slight_smile:


(Zen) #716

Yes I just bought the same and it is just nice for the wireless one, thanks @veeceeoh and others for the hard work for improving this DTH, I got a bit of challenge for installing the in wall verison but it paired fine


(Keith G) #717

I’m sorry to say that both battery-powered wall surface-mounted Aqara Wireless Smart Switch models (1-button model WXKG03LM and 2-button model WXKG02LM) do not support the hold function in hardware. They only send one message when a button is pressed.

I have no experience with the in-wall mains-powered versions of the Aqara Wireless Smart Switches (models QBKG11LM & QBKG12LM) because they require 250V and I am in the US, but according to this website they also only support single (toggle) button press with no hold function.

The only Xiaomi buttons that support a button hold function are the round “original” Xiaomi Button (model WXKG01LM) and the new version of the square-shaped Xiaomi Aqara Button (model WXKG12LM).

I have ordered a couple of the new Aqara Button model WXKG12LM and will adapt the new round Xiaomi Button DTH I’ve been working on to work with it. The Aqara WXKG12LM hardware sends messages for press, release, hold, double-click, and also SHAKE!


#718

Not quite sure what happend but one of the 4 open-close sensors was in unknown state. Tried to pair it again but now it seems to be “unknows” in devicelist. I had additional new sensor and tried to pair it and it does same thing. I have two things in my devicelist and both of them are “unknown”. Three open/close sensors are working normally. Any ideas. Pairing worked just like it is supposed to work. Blue light flashes three times and sensor is found but it’s unknown.


#719

Ok now it they both works. Problem was that I had to change device type manually. For some reason they were Samsung 2015 TV’s… changed them to Xiaomi Awara and that helped. Weird thing.


(Kenneth Eriksen) #720

Thank you for at clear answer @veeceeoh though it’s bad news… :disappointed_relieved:

Just to try and learn a bit - still new to ST:

  1. So the “Xaiomi button was released” message i see in the Activity feed is generated from the DH?
  2. And the delay between pushed and released messages is controlled by the “Minimum time in seconds for a press to clear” setting in the DH?
  3. And if i understand it correctly, that a hold, a double or triple click is normally generated by the button/the device itself?

Is there ANY way of getting a second control option out of this button?
Maybe a smartapp that would pick up on a double click (button pushed twice within a certain time)?
I can see that if i set the “Minimum time in seconds for a press to clear” setting to 5 seconds and press the button twice within 2 seconds, the Activity feed shows two pressed and only one released…?

:crossed_fingers::crossed_fingers::crossed_fingers:


(Keith G) #721

Yes and yes. That’s right. The DH for the Aqara button model WXKG11LM provides an emulated momentary press.

When you press the button, the DH starts a countdown timer based on the “Minimum time in seconds for a press to clear” setting, and then automatically sends the button “released” event. Again, the button hardware does not support any button “held” function.

I’m not sure I understand your question. But if you’re asking about button devices in general, then yes, normally the button device needs to provide unique messages for single click, double-click, etc, or hold in order for the DH to send the correct events for the SmartThings hub to use.

However, in the case of the round “original” Xiaomi Button, it sends different messages for press and release, so in theory the DH can calculate the difference in time between the press and the release messages to decide if the button was clicked or held.

I say “in theory” because in reality this doesn’t work 100% reliably and accurately because the DH code is executed in “the cloud”, and there are small delays in code execution that can result in the release message being processed before the press message, which is in reverse order!!

Is there ANY way of getting a second control option out of this button?

Yes - Use another home automation solution besides SmartThings. The truth is that the Aqara Button model WXKG11LM hardware supports multi-clicks up to 4, but the SmartThings Zigbee API ignores those messages. So if you double-click Aqara button, the DH receives no message, and nothing happens. The button hardware is sending a unique message for double-click, but the SmartThings hub basically ignores it.

Of course if you use the button with the Xiaomi hub, all of the functions are available, but there’s no way to get a Xioami hub to communicate to a SmartThings hub. There are other home automation solutions that people have gotten to work with Xiaomi devices, and with those, you could use the multi-click function of the Aqara button. Personally, I have recently bought a Hubitat hub, and put together DHs based on the bspranger/Xiaomi GitHub repository, and that has gained access to all the functions of Xiaomi devices that the SmartThings Zigbee API ignores. I don’t have any Aqara buttons, but @ArstenA does, and he made a Hubitat DH so he can now use multi-clicks with it.

This would be a really bad idea, especially considering that SmartThings ignores the Aqara Button hardware’s multi-click messages. As I mentioned above, if you double-click the button, no message is received by the DH, and nothing happens. Adding some kind of emulated double-click function would result in all kinds of missed clicks and confusion.

This is because every time you press the button, it resets the countdown timer. The point of the emulated momentary press is to wait until the release message is sent before you press the button again. And what are you using the button for that you would like to press it that often?


(Keith G) #722

Hi everyone - I just noticed that user @fison67 has shared a Smart App + Device Handler solution to add virtual Xiaomi devices to SmartThings called Mi Connector.

This solution also allows adding Xiaomi Zigbee sensors, etc. that are connected directly to a Xiaomi Gateway hub.

Please note that it requires a Docker-based API sever running on Raspbery Pi or Synology NAS.


#723

Sweet. Will give it a go when I get back and let you know.

Cheers.


(Kenneth Eriksen) #724

Oh man…! You are truly - and i mean this in the most positive way - BADASS at this @veeceeoh
Thank you for taking your time to explain these thing in a good way, even for the noobs to understand… :+1::wink:

Just to be clear, i have the WXKG03LM buttons, but assume that it is the same game, regarding functionality…?

The idea was, that the last wall switch (button) i encounter on my way to bed, could be used to both control the lights in the hallway (single push), AND run the Good Night routine (hold or double push)… :slight_smile:


(Keith G) #725

Oh sorry, I was trying to explain how the Aqara button DTH was set up to work with the WXKG11LM square button.

Again, as I said before, the WXKG03LM & WXKG02LM wall surface-mounted Aqara Wireless Smart Switch models only send one kind of message when a button is pressed. And for the WXKG02LM model, SmartThings filters out the different messages for left, right, and both buttons pressed, so for any of those the DTH only see one type of button press message and there’s no way at all to know if it was left, right, or both pressed.

Also. something new: I am working on an update to the Aqara button DTH so it can also work with the new version of the Aqara square button, model WXKG12LM. I have learned from the SmartThings Developer Documentation that button “released” events are no longer supported, so that will probably be removed from the DTH, since Smart Apps won’t recognize a “released” event. This also means the Toggle mode will be removed, but this is not a big issue because Smart Apps like SmartThings Smart Lights App can provide a on/off toggle function.

You should consider getting a different button, because that just isn’t possible with the WXKG03LM or WXKG02LM models. I’m really sorry.


(Keith G) #726

I’ve looked at that update to the DTH and it wouldn’t fix the issue you’re experiencing.

I’m working on a new version of the Aqara motion sensor DTH to make sure it doesn’t disrupt people’s automations if the sensor is put into hardware test mode.


(CS) #727

Anyone have trouble seeing these devices on the new SmartThing app? They all show up in the original version (classic) but not on the newer app.


(Dave N) #728

The custom DTH’s don’t show up in the new app yet, that’s a future promise :wink: