[RELEASE] Xiaomi Aqara Mijia Sensors and Switches Driver

OMG, different encodings for the same sensors?
The good news is, this update solved the issue.
Many thanks

1 Like

This is interesting. How do we tell which uses what?

1 Like

Hi everyone, I'm fairly new to Hubitat and have been enjoying tinkering, experimenting and learning. Thank you to all of you that make up this community, especially people like @chirpy that release drivers like this to the community. I bought a bunch of Xiaomi sensors (Aqara water, Xiaomi motion, and Xiaomi door/window). Just for the record, with this driver I had limited success, the devices would pair but disconnect after a day or two. However I have had success in making the devices stick with the drivers @veeceeoh has made.

1 Like

@chirpy Very great work! Any possibility to integrate Xiaomi/Aqara Zigbee Outlet (ZNCZ02LM, ZNCZ12LM & QBCZ11LM) into your driver?

Unfortunately not. The supported devices are all battery powered, whereas the mains powered devices would need a separate driver.

@chirpy
Getting a lot of these for Aqara motion detectors now. Update releated maybe?
2021-04-20 08:11:16.699 errorjava.lang.NullPointerException: Cannot invoke method contains() on null object on line 247 (parse)

dev:112021-04-20 07:15:02.690 errorjava.lang.NullPointerException: Cannot invoke method contains() on null object on line 247 (parse)

dev:112021-04-20 06:20:00.931 errorjava.lang.NullPointerException: Cannot invoke method contains() on null object on line 247 (parse)

Yes, that is from the new code. It's happening when the "model" is not set in the Device Data. I'll see if there's a better way of doing that and update the driver. In the meantime, it shouldn't be detrimental.

Can you tell me what you do have in the Device Details > Data section for this device?

It's sadly blank.
I just checked around and all the other functioning ones seem to be Aqara where this is an original Xiaomi one.

I've just pushed v0.17 which should stop those errors:

  • Check device model is set before interrogating it
2 Likes

Just a quick thanks!! :slight_smile: finally can get lux that doesn't only happen on motion. Cheers.

2 Likes

Are you sure? I thought that its device limitation, not driver.

2 Likes

Maybe he refers to the luminance sensor. Not the motion sensor.

1 Like

I have used these devices for years and it has always been mentioned on ST and here that Lux is only updated on a motion event.
I have checked some of my device logs and Lux (luminance) only gets a new value on an Active event.

2 Likes

Indeed I was, sorry. Noob.

1 Like

I'm finding these a little unreliable with this driver. I have 4 units, and all are reporting different info:

Unit 1:

  • battery : 100
  • humidity : 56.98
  • illuminance : 0
  • presence : present
  • temperature : 0.0
  • voltage : 3.00

Unit 2:

  • humidity : 60.04
  • illuminance : 0
  • presence : present
  • temperature : 0.0

Unit 3:

  • humidity : 65.97
  • illuminance : 0
  • presence : present
  • battery : 100
  • voltage : 3.00
  • temperature : 19.03

Unit 4:

  • battery : 100
  • humidity : 38.45
  • illuminance : 0
  • presence : present
  • temperature : 30.8

I've tried to configure/refresh, but so far no change and Units 1 & 2 won't report temperature.

Without removing the problem devices, try putting HE Zigbee in inclusion mode and then press the buttons on the devices until they rejoin. That can often picks up missing attributes. Accuracy isn't something you can do much about :frowning:

2 Likes

Yeah, I have re-discovered a few times, but some weirdness is going on. I think there must be something happening with the data reported e.g. on one poll temperature is correct, the next it is zero. Still inconsistent across the 4 devices.

humidity 74.08 % DEVICE 2021-05-24 09:04:20.252 AEST
illuminance 0 lux DEVICE 2021-05-24 09:04:20.119 AEST
humidity 0 % DEVICE 2021-05-24 09:04:19.999 AEST
temperature 0.0 °C DEVICE 2021-05-24 09:04:19.896 AEST
humidity 75.33 % DEVICE 2021-05-24 09:02:10.067 AEST
temperature 16.5 °C DEVICE 2021-05-24 09:02:09.974 AEST

I think I needed to be patient. After a day or so of ignoring them, I re-discovered and now they all have 4 attributes and seem to be accurate.

5 Likes

Are you still using these TS0222 devices? I have had 4 fail now - flashing screen on/off and don't appear to reset.