[RELEASE] Xiaomi Aqara Mijia Sensors and Switches Driver

FYI-These aqara sensors destroyed my zigbee mesh, and with using only reported compatible repeaters. When they eventually fall off the mesh, they can do damage on the way out.
That was my experience and saw others comment the same.
I pulled them all off, except the Zigbee 3.0 Opple 6 button, which works great

I've released a new version with a fix for the temperature issue.

I've also put in a PR for HPM to make things easier.


They both work perfect now.
Good work!

Thanks very much for this driver. :+1:

I have replaced 4 individual drivers with just this one and all seems good so far.

1 Like

Hi @chirpy
Firstly, thanks for a great combined driver.
I've been trying it for the past 2 days with motion sensors and from today, contact sensors just to see how it performs.
So far everything is good and working as expected.
I've just noticed this error though on a Xiaomi Motion Sensor.
It is working fine but thought I should report it to you.

dev:70102021-01-13 18:06:25.112 errorjava.lang.StringIndexOutOfBoundsException: String index out of range: -2 on line 89 (parse)

EDIT: Same error has just come in for another Xiaomi Motion Sensor and for a Xiaomi Contact sensor.

1 Like

Update. I've just tried switching an Original (non Aqara) Motion Sensor RTCGQ01LM across to this driver and that seems to be working fine too, so that's 5 drivers it's now replaced so far.

Are you using the latest v0.04? I ask because line 89 is an else statement on that version.

Missed that there was an update.
Oops again. :blush:

NP. If it still happens it would help to enable debug logging to trap the full data coming in before the error.

Still getting it but showing now as line 90.
I've just turned text and debug logging on and will post when it happens again.

Hi @chirpy

OK. This is what has just come in.
dev:70102021-01-13 19:01:26.465 errorjava.lang.StringIndexOutOfBoundsException: String index out of range: -2 on line 90 (parse)

dev:70102021-01-13 19:01:26.441 debugIncoming data from device : read attr - raw: 1CB90100003002FF4C0600100121D10B21A813240100000000214B01205C, dni: 1CB9, endpoint: 01, cluster: 0000, size: 30, attrId: FF02, encoding: 4C, command: 0A, value: 0600100121D10B21A813240100000000214B01205C

Is there any other bits of information I can give you?
Device is a Xiaomi Motion Sensor.
No motion was being detected at the time.
This is the current states and state variable info.

Current States

  • battery : 88
  • motion : inactive

State Variables

That's what I needed, thanks. Is this a RTCGQ11LM or is it a different model on the bottom of the device?

I'm afraid the sensors are mounted using double sided tape so I cannot get to the bottom to see the number.
All the ones that are erroring are Xiaomi and not Aqara that I can see so far anyway.
The contact sensor is also a Xiaomi device. The one that is more round at the ends as opposed to the Aqara one which is more rectangular shaped. (If this makes sense).
If you really need the info I could possibly pair a spare Xiaomi device and see if this errors.

No need. I'm putting in a workaround for the Xiaomi oddness. Can you tell me the info on the device page in the Device Details for the Data section?

Here it is.

  • endpointId: 01
  • application:
  • driver: v1.0.1.1123
  • model: lumi.sensor_motion
  • manufacturer:

The driver is from when it was using Markus's driver.

My RTCGQ01LM is giving the same error in the logs as @bobbles if that's any help identifying the version.

1 Like

It is. I just id'd it as the RTCGQ01LM which I do not have. I'll release a new version in a few minutes that will prevent the error as it's data we don't currently need as long as the devices are actually working with the driver otherwise.

My 2 are both working fine so far. I only checked the logs after seeing the post about it.

I've pushed a new version (v0.05) which should address this device and possibly others out there in the Xiaomi family.

EDIT: Don't forget to turn off debug logging :wink:

Looks like the change is working.

dev:56682021-01-13 22:24:33.974 debugIgnoring this data structure: encoding: 4C

dev:56682021-01-13 22:24:33.969 debugIncoming data from device : read attr - raw: 1E1C0100003002FF4C0600100021D10B21A81324010000000021F2042069, dni: 1E1C, endpoint: 01, cluster: 0000, size: 30, attrId: FF02, encoding: 4C, command: 0A, value: 0600100021D10B21A81324010000000021F2042069


1 Like

Download the Hubitat app