[RELEASE] Xiaomi Aqara Mijia Sensors and Switches Driver

I can can throw together a quick unschedule driver, give me a few minutes…Done

Kill Scheduled Jobs

 /*

 */

@SuppressWarnings('unused')
static String version() {return "0.0.1"}

metadata {
    definition (
        name: "Kill Schedules", 
        namespace: "thebearmay", 
        author: "Jean P. May, Jr.",
        importUrl:"https://raw.githubusercontent.com/thebearmay/hubitat/main/xxxx.groovy"
    ) {
        capability "Actuator"
        command "killSchedules"
        
            
    }   
}

preferences {

}

@SuppressWarnings('unused')
def installed() {

}

def killSchedules () {
    unschedule()
}
1 Like

There is an existing driver named "Clean Device" by @boristhecat
you can download it here

3 Likes

Thanks ... I'll check it out when I return. If that doesn't work, I'll just uninstall/reinstall. Appreciate the help!

Is there a way to reset motion active timeout?

The default is 1 minute by the looks of it

Correct. There is a hardware hack to decrease the time.

2 Likes

I just installed your driver for WXKG11LM Mini Switch. I was using [Deprecated] Xiaomi / Aqara / Opple Drivers with Presence! but saw it was no longer supported. When I used that driver the log registered the button press, but the button did not trigger in my WebCore piston. I switched to yours and the logs are not registering the button presses.

@chirpy
Started getting these errors in the log. Possibly from the last update?
It's on my original Xiaomi button.
v:12222021-08-14 23:00:59.332 errorjava.lang.NullPointerException: null (method parse)

dev:12222021-08-14 23:00:28.652 errorjava.lang.NullPointerException: null (method parse)

dev:12222021-08-13 23:00:12.890 errorjava.lang.NullPointerException: null (method parse)

dev:12222021-08-13 22:59:18.397 errorjava.lang.NullPointerException: null (method parse)

dev:12222021-08-12 23:08:04.709 errorjava.lang.NullPointerException: null on line 369 (method parse)

dev:12222021-08-11 23:21:42.439 errorjava.lang.NullPointerException: null (method parse)

--- Show more... ---

Is it the Xiaomi Mijia Wireless Switch : WXKG01LM (the round one)? I'll try it out on my button and get back

I'm not seeing any errors on mine. You could try enabling the debug option in the driver to see if there's more relevant information, but I need to know definitively which device model it is.

Yes the round original.
Just did a button push today and no error :frowning:
Could it be generated from the piston perhaps? No WebCore log entries.

dev:12222021-08-16 16:36:48.224 infoMaster Bedroom Button presense check in 12 hours

dev:12222021-08-16 16:36:48.221 infoMaster Bedroom Button was pushed

dev:12222021-08-16 16:36:48.219 infoMaster Bedroom Button contact changed to open

dev:12222021-08-16 16:36:48.217 debugProcessing Xigbee data (cluster:0006, attrId:0000)

dev:12222021-08-16 16:36:48.214 debugIncoming data from device : read attr - raw: 041D0100060800001001, dni: 041D, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, command: 0A, value: 01

dev:12222021-08-16 16:36:48.212 infoMaster Bedroom Button presense check in 12 hours

dev:12222021-08-16 16:36:48.210 infoMaster Bedroom Button contact changed to closed

dev:12222021-08-16 16:36:48.207 debugProcessing Xigbee data (cluster:0006, attrId:0000)

dev:12222021-08-16 16:36:48.180 debugIncoming data from device : read attr - raw: 041D0100060800001000, dni: 041D, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, command: 0A, value: 00

Three of my Xiaomi buttons have been working perfectly since switching to this DTH, but one of them has never worked and Ive only just had the time to work out why. It looks like the model number of one device is null and I cant seem to fix that (all the others correctly detect Model: lumi.sensor_switch):

Ive tried configure and refresh, Ive tried pairing it again - without fully removing it - and it always gets detected fine, but the model: information never seems to populate.... As a result it doesnt work as a button just an 'open/close' type sensor as that is the only parameter which updated. Any pointers for what to try next would be much appreciated.

Thanks!

This is what appears in live logging when adding the device

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:54.421 [debug](http://192.168.1.201/device/edit/224)Processing Xigbee data (cluster:0006, attrId:0000)

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:54.418 [debug](http://192.168.1.201/device/edit/224)Incoming data from device : read attr - raw: 41450100060800001001, dni: 4145, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, command: 0A, value: 01

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.360 [info](http://192.168.1.201/device/edit/224)Button4 presense check in 12 hours

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.358 [info](http://192.168.1.201/device/edit/224)Button4 voltage changed to 3.09 volts

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.355 [info](http://192.168.1.201/device/edit/224)Button4 battery changed to 100%

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.353 [debug](http://192.168.1.201/device/edit/224)Processing Xiaomi data (cluster:0000, attrId:FF02)

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.350 [debug](http://192.168.1.201/device/edit/224)Incoming data from device : read attr - raw: 41450100003002FF4C0600100021140C21A8012400000000002139022055, dni: 4145, endpoint: 01, cluster: 0000, size: 30, attrId: FF02, encoding: 4C, command: 0A, value: 0600100021140C21A8012400000000002139022055

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.330 [debug](http://192.168.1.201/device/edit/224)Processing Xigbee data (cluster:0000, attrId:0001)

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.328 [debug](http://192.168.1.201/device/edit/224)Processing Xiaomi data (cluster:0000, attrId:0005, encoding:42)

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.325 [debug](http://192.168.1.201/device/edit/224)Incoming data from device : read attr - raw: 41450100002C050042126C756D692E73656E736F725F737769746368, dni: 4145, endpoint: 01, cluster: 0000, size: 2C, attrId: 0005, encoding: 42, command: 0A, value: 126C756D692E73656E736F725F737769746368

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.322 [debug](http://192.168.1.201/device/edit/224)Incoming data from device : read attr - raw: 4145010000080100200A, dni: 4145, endpoint: 01, cluster: 0000, size: 08, attrId: 0001, encoding: 20, command: 0A, value: 0A

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.306 [info](http://192.168.1.201/device/edit/224)Button4 presense check in 12 hours

[dev:224](http://192.168.1.201/logs#dev224)2021-08-29 11:25:49.271 [debug](http://192.168.1.201/device/edit/224)Incoming data from device : catchall: 0000 0013 00 00 0040 00 4145 00 00 0000 00 00 10454172D7A501008D150080

Ive hacked a bit and created a command as follows which seems to have forced the device to choose the right model number, but I have no idea why it didnt auto detect the device model and just showed null, despite many many many pairing attempts and the other devices all being fine:

def ForceDevice() {
    updateDataValue("model", "lumi.sensor_switch")
}

Model is usually requested from the device at pairing, but as @cjcharles notes can be added manually later.

The LUMI WEATHER sensor is very rarely updates itself. Can something be done to update more frequently?
Thank You

Has anyone had luck getting the Aqara contact sensors that keep dropping to finally stick? I have in the neighborhood of 21 of these and have about 50 plus % dropping. I've had them on ST and now HE, some are rock solid and others meh.... Getting close to dumping them.

I must lead a charmed life (when it comes to Xiaomi).

I have

2 contact sensors
3 Temperature Humidity Pressure sensors
1 Lux sensor
3 Leak (water sensors)

With absolutely NO issues currently or in the past. I started with a C4 and now have a C7.
I purchased these sensors in dribs and drabs so I can't tell when I've added repeaters but I do recall I had no issues even with only one repeater.

Currently I have been using cc2530 boards for custom Zigbee devices. They act as Zigbee repeaters and I've read they do a good job at that. I now have 4 or these devices scattered throughout my home. These could add to the robustness I'm enjoying.

I would suggest you get a good repeater. I've read the Ikea are good. Place the repeater near some of your worst offenders for dropping off and see if the reliability changes.

BTW I'm using the "Device Activity Check" app to monitor these devices and others. They are checked monitored to notify me if a device does not report something for more than 24 hours.

I have 6 contact sensors, 4 motion sensors, and a water sensor, at first they always dropped, they didn't report me, until I decided to make my mesh stronger, I bought a repeater plug from ikea, at the end of the floor, and At the beginning I put a repeater of yours, for the moment everything is perfect, you have to try to distribute the repeaters on the floor so that the mesh is strong.

1 Like

I always had issues with these dropping until I added a lot of repeaters (IKEA and and Tuya Zigbee 3). Now they very, very rarely drop off the mesh.

2 Likes

Are you guys using these?

I have one of those outlets, but nothing repeats through it. Apparently, it is not a very good repeater.