SmartThings Community

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

I’m curious as to your use case here. I can’t think of a reason other than you want your lights to go off if your house is on fire??

WebCoRE, for example, is more robust and could handle that type of trigger situation.

If that’s too complex, why not just use the Virtual Thermostat SmartApp by SmartThings? Although it’s designed to switch on/off a heater or air conditioner when the temperature goes above/below a certain value, it can be set up to use any temperature sensor and any number of lights and/or outlets. Select “heat” for the lights/outlets to go on when the temp goes below the threshold or “cool” for them to go on when the temp goes above the threshold.

As for humidity, you could use SmartThings’ SmartHumidifier SmartApp. In this case, though, only one light or smart outlet can be selected, but I believe it’s possible to use another app to set up a group switch.

Only if all the devices in the automation can run locally:

Because all Aqara / Xiaomi devices use custom Device Handlers, and custom Device Handlers only run in the cloud, any Smart Lighting automations with Aqara / Xiaomi devices will have to also run in the cloud. Sorry. :sob:



I think nobody could answer your question because nobody has “lost” their hub location. I’m also not sure I understand what you are saying, because Zigbee devices do not need to be excluded like Z-Wave devices. If a Xiaomi or Aqara device goes offline then it just needs to be paired again, or manually rejoined. Maybe you can copy the explanation from Samsung Support to this thread so it can help people understand?

1 Like

[UPDATE] Xiaomi Smart Plug DTH v1.2

(For Xiaomi’s ZigBee Outlet model ZNCZ02LM)
Xiaomi__Plug
This release fixes an issue with the calculation of kiloWatt/hour energy usage (thanks to a report from @Tiago_Goncalves), adds a Temperature Offset preference setting, and includes a number of other improvements.

The updated DTH code can be copied directly from here.

Please note that I have not been able to test the new code changes because I do not own a Xiaomi Smart Plug myself. Any feedback from Xiaomi Smart Plug users would be greatly appreciated!

Detailed Change List :

  • Fixed incorrect code used to calculate kiloWatt/hour energy usage (thanks for @Tiago_Goncalves for spotting the issue)
  • Added lastCheckinDate attribute for Epoch time/date stamp events that can be used with WebCoRE
  • Added Temperature Offset preference setting
  • Added device name to all debug messages
  • Improved refresh command function
  • Improved text of debug messages for clarity
  • Removed unnecessary / unused code in parse()
  • Minor code reformatting

Screenshot

This new improved device handler code is open source and free .
But if it has helped you, a coffee / beer donation is always very much appreciated!
PayPal: 37544ab59e07a5c90719f07501453cae3ed7b043 Venmo: @KeithPG

I was thinking something like:
Turn on ventilator when temp is above xx degrees.
Turn on bathroom fan for x minutes when humidity rises above xx % :wink:

I know…
The primary reason why i prefer Smart Lighting over WebCore is that you then at least have some automations that continues to work in case of a Internet breakdown.
I haven’t found a scenario that Smart Lighting couldn’t solve for me until now, when looking into temp/humidity controlled automations.
Second - i my head a local automation rule (with/without only locally running devices) should be faster than automations running in the cloud…?

[REMINDER] All Xiaomi / Aqara wireless button users

Hub Firmware 25.26 has been released for SmartThings v2 & v3 Hubs

The new firmware includes changes that “break” some functionality in the previous device handlers, but also allows for much improved functionality.

In order to fix the issues and add improved functionality, I have updated all Xiaomi / Aqara Button device handlers (DTHs). All SmartThings v2 & v3 Hub users are encouraged update to the newest DTHs immediately.

Please see this post for all details and links to the updated DTHs.

The code of these updated and improved device handlers is open source and free.
But if it has helped you, a coffee / beer donation is always very much appreciated!
PayPal: 37544ab59e07a5c90719f07501453cae3ed7b043 Venmo: @KeithPG

1 Like

[UPDATES] Multiple DTHs

  • Aqara Wireless Smart Light Switch DTH v0.9.2
  • Xiaomi Button Old Firmware DTH v1.2.1 (Hub FW 24.x & older)
  • Aqara Button Old Firmware DTH v1.3.6 (Hub FW 24.x & older)

These very minor updates fix an issue with GitHub integration not working correctly. The only change needed was to the Device Type name to follow SmartThings’ requirements.

Please see this post for more details and links to the updated DTHs.



@mikejclark - The above update to the Aqara Wireless Smart Light Switch DTH will fix your issue. If you already manually installed it, please copy and paste in the updated code. After that, GitHub repository can be manually assigned. Here’s how:

  1. Open your hub’s Groovy IDE
  2. Go to the “My Device Handlers” tab
  3. Click on the name of the device handler to view its code
  4. Click the Device Type Settings button:
  5. Select the GitHub Repository: Xiaomi (master)
  6. Click Update at the bottom to update the device handler.
  7. When viewing the “My Device Handlers” tab, now the Xiaomi Aqara Wireless Switch should list bspranger/Xiaomi (master) in the GitHub Repository column. However, the device handler may be listed in blue, indicating the local file has been modified:

    The reason for this has to do with the very last carriage return character in the code text. To fix this, just click the magnifying glass icon to open up a window comparing the GitHub repository and local versions. Then click the Overwrite local version button, and then click “close”.

    Now the Xiaomi Aqara Wireless Switch device handler should be listed in black, indicating the repository and local versions match. If the Status shows “Edited” with a magnifying glass, then the code be published to clear the Status to “Published”.
1 Like

so this looks like the wired version will have dual switch functionality (rather than just recognising a single switch being pressed)… thats exciting!

not sure if this helps - but data from the single wired switch is

Data * application: 12

  • endpointId: 01
  • manufacturer: LUMI
  • model: lumi.ctrl_neutral1
    Raw Description 01 0104 0006 02 06 0000 0003 0001 0002 0019 000A 03 0000 000A 0019

Thank you very much!
But it seems that the Temperature isn’t correct? On my outlet it show 160 degrees. That would melt the outlet if it was in Celcius and True :wink:

1 Like

Hi. I have quite a number of aqara door/windows sensor to add to ST. Prior to firmware update, pairing was flawless. After the recent firmware update, I can’t pair this sensor anymore.

Anyone else having this problem?

You can add support for Alexa to read the temperature of the aqara sensor changing the device type in the DH. Change to ‘smartsense multi sensor 2’. The smartthings app continues reading all parameters and Alexa can read now the temperature.

Thank you so much for your efforts on getting this to work - apologies for the possible misplaced post, but I’m not sure where to post this question.

I’ve just received a QBKG04LM (not currently support if I read correctly) which is registering in ST as

  • application: 16
  • endpointId: 01
  • manufacturer: LUMI
  • model: lumi.ctrl_neutral2

NB: I am using the latest SmartThings firmware on a v2 Hub 000.025.00026

The signals are being sent through to ST, but the buttons seem to be registering incorrectly, and specifically recording as 2 presses on each button. See the logs below:
I pressed the LEFT button, paused a few secs and then the RIGHT button.
It seems to be registering
(Button 5 pushed) then ((Button 3) pushed for LEFT as well as a ‘BOTH’ signal
(Button 4 pushed) then ((Button 2) pushed for RIGHT

Is there anything I can do about this, or can I possibly help in providing feedback to update the DH if this unit isn’t yet supported? Happy to do whatever I can to move this forward as it’s a great unit for the UK.

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: debug Thomas wall switch: Creating event [name:button, value:pushed, data:[buttonNumber:5], descriptionText:null pushed (Button 5 pushed), isStateChange:true]

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: info Thomas wall switch: null pushed (Button 5 pushed)

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: debug Thomas wall switch: Setting Last Pressed to current date/time

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: debug Thomas wall switch: Parsing ‘read attr - raw: B80B050006100000100000001001, dni: B80B, endpoint: 05, cluster: 0006, size: 16, attrId: 0000, result: success, encoding: 10, value: 0110000000’

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: debug Thomas wall switch: Creating event [name:button, value:pushed, data:[buttonNumber:3], descriptionText:Both buttons were pushed (Button 3 pushed), isStateChange:true]

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: info Thomas wall switch: Both buttons were pushed (Button 3 pushed)

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: debug Thomas wall switch: Setting Last Pressed to current date/time

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:25 AM: debug Thomas wall switch: Parsing ‘read attr - raw: B80B030006160000100000F023000BB803, dni: B80B, endpoint: 03, cluster: 0006, size: 22, attrId: 0000, result: success, encoding: 10, value: 03b80b0023f00000’

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:11 AM: debug Thomas wall switch: Creating event [name:battery, value:100, unit:%, isStateChange:true, descriptionText:Thomas wall switch Battery at 100% (3.3 Volts)]

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:11 AM: info Thomas wall switch: Battery at 100% (3.3 Volts)

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 9:00:11 AM: debug Thomas wall switch: Parsing ‘catchall: 0104 0000 01 01 0000 00 B80B 00 01 115F 0A 01 01FF42296410006510016E20006F20020121E40C03281705210700082116260A2100009923000000009B210000’

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: debug Thomas wall switch: Creating event [name:button, value:pushed, data:[buttonNumber:4], descriptionText:null pushed (Button 4 pushed), isStateChange:true]

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: info Thomas wall switch: null pushed (Button 4 pushed)

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: debug Thomas wall switch: Setting Last Pressed to current date/time

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: debug Thomas wall switch: Parsing ‘read attr - raw: B80B040006100000100000001001, dni: B80B, endpoint: 04, cluster: 0006, size: 16, attrId: 0000, result: success, encoding: 10, value: 0110000000’

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: debug Thomas wall switch: Creating event [name:button, value:pushed, data:[buttonNumber:2], descriptionText:Right button was pushed (Button 2 pushed), isStateChange:true]

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: info Thomas wall switch: Right button was pushed (Button 2 pushed)

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: debug Thomas wall switch: Setting Last Pressed to current date/time

1c9650b7-c58d-42cb-a4cb-41ce569a7b97 8:59:57 AM: debug Thomas wall switch: Parsing ‘read attr - raw: B80B020006160000100000F023000BB803, dni: B80B, endpoint: 02, cluster: 0006, size: 22, attrId: 0000, result: success, encoding: 10, value: 03b80b0023f00000’

Can you please send me a PM with some log output showing some debug log messages for the Smart Plug when the temperature reports are received? With that information I should be able to troubleshoot the incorrect readings, thanks.



There is a known issue with custom device handlers (DTHs) going “stale”, which leads to difficulty in pairing devices using that custom DTH. It’s not an issue that started with the newest firmware, but I have seen it happen to me more often recently.

The way to “fix” it is to view the custom DTHs in your hub’s IDE and (re) publish them.

I have also seen a related issue where the pairing doesn’t complete, the device never shows up in the device list, but the live logging window shows that it’s paired. I call this the “ghost device” issue, and the only way to get the device to show up on the hub’s device list is to look for it’s Device Network ID (DNI) which would be found in the Hub’s events list (not device events, but hub events), similar to the “catchall” method some people need to use to get Xiaomi / Aqara devices paired.

Here’s more information on the “stale” DTH issue:



Temperature and Humidity reports may work with the ‘smartsense multi sensor 2’ device handler, but atmospheric pressure and battery level reports will not work.

I will investigate how to get Alexa compatibility for the Xiaomi / Aqara Temp-Humidity device handler when the device is linked through the SmartThings Alexa Skill.



Thanks for all the information and log entries.

Because I don’t have any of the Aqara Wired Smart Wall Switches, it is quite difficult to create a device handler (or modify the existing one for the Wireless switches).

Although the device handler for the Aqara Wireless might seem like it should work, it is not actually designed for use with the Wired switches.

I’m looking into it, but it will take time. I will post here when I have something worth testing.

1 Like

This would be great!

I have discovered that this can be done changing the device type as I said before or adding a new line : capability “Contact Sensor” and Alexa can detect it and read the temperature, like it does with the original Samsung smartsense multi sensor that I have.

Congratulations for your amazing work!!!

1 Like

This is the only solution I found as well.

Before changing the device handler to include that line in the code, I just want to make sure that adding the Contact Sensor capability won’t cause any issues, because the temp-humidity sensor doesn’t actually have that capability.

After some help. I have sensor a few round the house all working fine. I had a spare one that I just added to SmartThings, found it added all ok. But when I open the sensor it doesn’t detect it’s open. And if I force it open it’s fine, but when I put them back together it still says it closed unless I force it close.
I have removed them a few times and re-Installed it and still same issue.

Anyone got any advise on how I can get it to work correctly. Don’t understand why it’s being like this!?

Hi @veeceeoh, thanks for your great work. I have a WXKG11LM button (aq2 version), using your latest DTH (1.42b) on V2 hub (25.26 FW). When i press the button the action doesn’t show in the tile, instead, shows in the last event section. Am i doing something wrong?

Hi guys, are there any known Device Handlers for the Xiaomi Aqara Air Conditioning Companion ?
https://www.gearbest.com/living-appliances/pp_416094.html

I have Smartthings Hub v1, and have 30 odd Xiaomi devices added to this setup using the a4refillpad DTH - they all work great. I am now trying to add two additional Aqara Motion Sensors to the setup but i cannot for the life of me get them connected. I have followed all the helps topics, hold for 3 seconds, wait press again - replaced batteries, but still nothing showing up in CatchAll.

Would you know how i could troubleshoot this?