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

Can. I have a Mi Cube, have looked through the DH code, and don’t see much in the way of need for changes / improvements.

I haven’t really put it into major use, but have tried to figure out what fingerprint would get it to pair without the need for the catchall method. Unlike with my other Xiaomi devices, I have not been able to pair my cube with a fingerprint, and it never even shows up as a generic Thing.

I’m just looking for a simple button press, and I can’t even accomplish that for some reason. I have the aqara button. Maybe it’s because it doesn’t register button press, but only release.

I don’t use WebCoRE yet, but isn’t this is just a case of what word is used when the button is pushed.

I think the device handler had to use a “released” event when in Momentary mode, because otherwise, the mobile app would just show “pushed” and stay stuck that way. But in Momentary mode, it also produces a “pushed” event first, and then “released”. Are you not seeing the “pushed” event?

Also, couldn’t you change the piston to say if Keypad 1's button #1 gets released?

Just so everyone understands the limitations of these Xiaomi buttons on SmartThings:

Although the button device itself may send different messages on button push and button release, all we have to work with that SmartThings passes on to the device handler is a message that says “On/Off: 1” when you push the button. This is because the SmartThings ZigBee event parser removes the data that we could use to know when the button is pushed vs released. There’s nothing we can do about that, and if you want that feature, then send an email to ST support asking them to add endpoint data to the ZigBee event description parser. That would help for a lot more devices than just the Xiaomi Buttons.

So, again, all we get is “On/Off: 1” when the button is pushed. Then the device handler has to announce that as a SmartThings event so that it is recognized by SmartApps. In this case, the device handler now has two modes: Momentary, and Toggle. If it’s set to Momentary in the settings, then a button push produces a “pushed” event, with a delay (that you can set in the settings), followed by a “released” event.

This means if you’re using Momentary mode, whatever SmartApp you’re using to make things happen should be able to take action on a “pushed” or “released” event. The timing would depend on which one you use, and what delay you’ve set.

If you use Toggle mode, then the event for the button in SmartThings alternates between “pushed” and “released” every time you push the button. In that case, your SmartApp would have to be able to take different actions based on whether it sees a “pushed” or “released” event from your button.

If that isn’t going to work for WebCoRE or other SmartApps, then @ArstenA and us others helping to improve the device handlers will have to work out a different method for the device handler to provide a different labeled event, but also still have the same functionality (e.g., the virtual button tile). However, as far as I can tell, with the option of Momentary or Toggle modes, most people should be able to make use of the Xiaomi button.

So is the Smartthings Link still not working properly with these Xiaomi sensors? I finally tried my Link hub (firmware 17.00113, ZigBee 2.2.22) and can’t get the sensors to stay active past 1hour. Changed 2.4Ghz wifi channel away from ZigBee channel, and I don’t have any other ZigBee devices. Xiaomi sensors were placed 1 ft away from Link hub

It never worked for me. I gave up and bought a v2 hub. You’re on the same firmware I had on my ST Link, so it hasn’t been updated, while the hub has seen 4-5 updates since December.

With my v2 hub, I have had zero problems pairing and keeping connections to 8 Xiaomi “original” & Aqara door/window sensors, 1 Aqara leak sensor, 1 Aqara Motion Detector, 1 Aqaba Temp/humidity sensor, and a Xiaomi Mi Cube.

Hi,

Can we ad the Xiaomi Aqara square switch ?
WXKG03LM

I have posted some of my experience in this thread. You can find it here. This gist was the ST Link works with official devices just fine, but I, along with others, have the same problem of keeping a connection with Xiaomi and Aqara devices. I borrowed an actual v2 hub and had no more issues.
So the Link is nice but does function in the exact same was as the hub does, which is a shame.

I just received one of these yesterday in the mail.

Unfortunately, due to the limitation I explained a few posts up, SmartThings does not provide the information we need to know which button is pressed.

If I press the left button, the right button, or both buttons, the exact same event is sent to the device handler: “on/off: 1”.

So, if you’ve already bought one, I’m sorry to say that for right now, it can only act as one button with SmartThings. You can use the Aqara Button device handler for that purpose. Also note: it doesn’t pair easily, and the catchall method has to be used.

Again, I encourage people to email SmartThings support to ask that ZigBee endpoint information is passed on by the SmartThings event parser. That will open up some possibilities in getting Xiaomi devices to play better with SmartThings.

EDIT: The switch I was referring to is actually the WXKG02LM, which is the wall-surface-mounted ZigBee 2-button switch, not the mains-powered 2-button switch (WXKG03LM). I was confused by the link to the WXKG02LM on GearBest in your post. My apologies for the confusion.

I don’t have the mains powered switch, but the Aqara button device handler definitely won’t work with it, because it’s a different type of device (can receive control commands in addition to sending control commands). To create a device driver for it, someone would need to have one to do a good amount of testing. I’m sorry to say since I’m in the US with 110-120V/60Hz power, I have no plans to buy one of these mains-powered switches.

Thanks @veeceeoh and @rottentinkerton…looks like I’m going to need to find a v2 hub if I want the Xiaomi sensors to work. Atleast I only spent $15 on the Link, and should be able to sell it fairly easy as they can’t be bought directly in canada from what I remember

Is there a way so that I can use the button with both single and dubble click?

But it does work. And a single switch option would be fine.

Can we still get a handler added to this git hub so we have them all in one place.

At this time, there’s no need to add a new handler for the WXKG03LM (sorry - meant the WXKG02LM) Aqara wall-mounted two-button switch.

Just use the already existing Aqara Button device handler. It works fine with my WXKG03LM WXKG02LM, and even reads the battery correctly.

In future, if things change with how SmartThings parses events on ZigBee devices so that we have access to the different button press events, you can be sure that I will update the handler to work with that (since I really want to make use of both buttons on my switch!)

If you have any troubles with pairing, let me know, and I can walk you through it.

EDIT: The switch I was referring to is actually the WXKG02LM, which is the wall-surface-mounted ZigBee 2-button switch, not the mains-powered 2-button switch (WXKG03LM). I was confused by the link to the WXKG02LM on GearBest in your post. My apologies for the confusion.

I’d like to get some feedback from any users of both kinds of Xiaomi Temperature & Humidity sensors.

I’ve done some fairly major reworking of the code for the device handler, and changed the method for parsing temperature and humidity reports to the one that is used by SmartThings’ officially published device handlers.

However, that official method supplies the temperature (in C or F) as an integer, so without tenths of a degree in the reading. Instead of 34.7 C you’ll see 35, for example.

I have checked Xiaomi’s specifications for the temperature accuracy, and they claim it is + / - 0.3 degrees Celcius, which is a 0.6 degree spread and not extremely accurate.

However, I know some people may still like to see tenths of a degree displayed, so here’s a poll, please choose your preference.

  • Display temperature as an integer
  • Display temperature with tenths of a degree
  • Add a setting to choose display as integer or with tenths of a degree

0 voters

After we’ve heard from a fair number of people, then we’ll know how to proceed.

Mine is the wired with neutral.

But yeah gues we wait in ST to sort stuff. Anyone requested it???

Oh shoot, I’m sorry. I got confused. I saw the link in @babbahotep’s post:

… and I didn’t notice he was asking about a different switch, the main-powered WXKG03LM.

That is a completely different type of device and the Aqara Button device handler actually won’t work with it.

It would be incredibly difficult to create a new device handler without having the switch itself to do testing.

My apologies for the confusion.

Hi All,

With the temp sensors DH I was just wondering why it was decided to place the last checkin as the multi attribute tiles Secondary control rather than the Humidity? I prefer the look of the humidity as demoed in the docs, I have been modifying the DH to swap the checkin and humidity around, but just wondering if I am missing something.

Thanks,
Wob

Not sure, but we’re currently testing code that does this:

It would be pretty trivial to add in the current humidity reading, perhaps to the left of the High / Low temperatures. I should be able to add an icon so it’s clear that percentage refers to humidity.

I’d probably shorten the text to something like this:

xiaomi-humidity-icn-OLD 54% Today’s High: 78 | Low: 49

with some space between % and “Today’s…”

Looks good, Also worth mentioning you can make that entry multiline, you just need a “\n” in the line.

I am working on a DH for my solar and found someones example with multiline, looks like this.

Well, it looks like I won’t need to do two lines:

IMG_0137

The humidity value in the main tile is sometimes out of sync when there’s a lot of changes, so I’m looking at that. The daily high / low temperatures will reset on the first report event from the sensor after midnight local time, which would be within the first 50-60 minutes after 00:00.

Otherwise, based on my poll above, I’m going to add a preference setting to chose between the temperature displayed as integer or with tenths of a degree precision.

Then hopefully this can all be done to the device handler for the “original” Xiaomi Temp/Humidity sensor, and then I think they’ll be available for everyone!

1 Like

Hi,

I understand that it is really good to implement some new features, but please test your code, and check that you are doing it correctly.

I can see this in my live loggingÉ
7:56:05 AM: error physicalgraph.scheduling.CronExpressionException: Invalid cron expression found ‘60 0 0 * * ?’

This is an incorrect cron expression.

 schedule("60 0 0 * * ?", tempReset) //reset within 60 seconds of midnight

http://docs.smartthings.com/en/latest/smartapp-developers-guide/scheduling.html

Field Allowed Values Required Allowed Wildcards
Seconds 0-59 Yes *
Minutes 0-59 Yes , - * /
Hours 0-23 Yes , - * /
Day of Month 1-31 Yes , - * ? / L W
Month 1-12 or JAN-DEC Yes , - * /
Day of Week 1-7 or SUN-SAT Yes , - * ? / L
Year empty, 1970-2099 No , - * /

We recommend that you test your cron expression before using it in a SmartApp or Device Handler. The cron expression test tool we use is http://www.cronmaker.com/.

I truly don’t understand what you meant to do. Reset those values 60 seconds after midnight? Or after midnight, but before the first minute? 60 doesn’t exist, maybe 59.

Could you please next time test the code on your hub and DH, and implement it into GitHUB, when verified it is working correctly?

Thanks!