[RELEASE] Xiaomi Drivers with Health Status and Zigbee2MQTT

Hi guys, i'm having problems.
Been trying to get Mi Light Sensor working. Have tried marcus and another persons code but they didn't work. Stumbled upon yours and i'm finally getting a "illuminance" current state but it just says 0.

What i've done:
Installed via HPM 1.8.8.
Clicked configure.
Re-Paired the sensor.
Changed the battery.

It's a GZCGQ01LM.
I only get this info:

Current States

  • illuminance : 0
  • presence : present
  • pushed : 1

State Variables

  • rawLux : 0
  • presenceUpdated : 0

Log file

dev:1722023-03-15 07:00:44.055 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 06:56:40.939 PMtraceLux : Trace Logging : Automatically Disabled
dev:1722023-03-15 06:50:44.022 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 06:40:44.318 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 06:36:40.946 PMtraceLux : Trace Logging : true
dev:1722023-03-15 06:36:40.946 PMdebugLux : Debug Logging : true
dev:1722023-03-15 06:36:40.945 PMinfoLux : Info Logging : true
dev:1722023-03-15 06:36:40.944 PMinfoLux : Preferences updated.
dev:1722023-03-15 06:36:40.852 PMinfoLux : Configuration complete.
dev:1722023-03-15 06:36:40.836 PMtraceLux : sendZigbeeCommands received : [zdo bind 6664 0x01 0x01 0x0000 {04CF8CDF3C819A78} {}, zdo bind 6664 0x01 0x01 0x0001 {04CF8CDF3C819A78} {}, zdo bind 6664 0x01 0x01 0x0003 {04CF8CDF3C819A78} {}, zdo bind 6664 0x01 0x01 0x0400 {04CF8CDF3C819A78} {}, zdo bind 0x6664 0x01 0x01 0x0001 {04CF8CDF3C819A78} {}, delay 2000, he cr 0x6664 0x01 1 32 32 3600 3600 {} {}, delay 2000, zdo bind 0x6664 0x01 0x01 0x0400 {04CF8CDF3C819A78} {}, delay 2000, he cr 0x6664 0x01 1024 0 33 3 3600 {6400} {}, delay 2000]
dev:1722023-03-15 06:36:13.340 PMtraceLux : Trace Logging : true
dev:1722023-03-15 06:36:13.339 PMdebugLux : Debug Logging : true
dev:1722023-03-15 06:36:13.338 PMinfoLux : Info Logging : true
dev:1722023-03-15 06:36:13.337 PMinfoLux : Preferences updated.

Please tell me what obvious thing i'm doing wrong.
If I pair it to my old smartthings hub it works and updates the lux changes very quickly. I've tried 3 other driver codes and now this package but cannot get any form of decent data out of the sensor.

Also on an unrelated note, how do I change my username?

Hi,

You may need to pair the Aqara Light sensor again to the Hubitat hub. Don't delete the device, just pair it again with this driver already assigned.

On the username change - you can send a direct message to @ bobbyD .

Didn't realize you could do that. It's an Xiaomi/Lumi sensor btw.
So I re-paired the sensor without deleting it. The only thing that changed was the presence updated.

State Variables

  • presenceUpdated : 1678878006037

I clicked on configure and it says complete.
This is the log.

dev:1722023-03-15 09:02:29.473 PMinfoLux : Preferences updated.
dev:1722023-03-15 09:02:29.330 PMinfoLux : Configuration complete.
dev:1722023-03-15 09:00:06.045 PMinfoLux : Configuration : Received by device.
dev:1722023-03-15 08:59:59.996 PMtraceLux : Trace Logging : false
dev:1722023-03-15 08:59:59.995 PMdebugLux : Debug Logging : false
dev:1722023-03-15 08:59:59.994 PMinfoLux : Info Logging : true
dev:1722023-03-15 08:59:59.993 PMinfoLux : Preferences updated.
dev:1722023-03-15 08:59:59.915 PMinfoLux : Configuration complete.
This is where I re-paired the device.
dev:1722023-03-15 08:50:44.019 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 08:40:44.020 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 08:30:44.062 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 08:20:44.068 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 08:10:44.024 PMwarnLux : Presence : Waiting for first presence report.
dev:1722023-03-15 08:00:44.061 PMwarnLux : Presence : Waiting for first presence report.

This might be helpful too. I don't know. Pulled from event log when re-pairing.

id: 4022184
Date: 2023-03-15 21:10:20.561
Name: configuration
isStateChange: true
physical: false
digital: false
source: DEVICE
value: received
deviceId: 172

This info is under device details

  • endpointId: 01
  • application: 1B
  • driver: v1.16 (10th March 2023)
  • encoding: Zigbee
  • manufacturer: XIAOMI
  • model: lumi.sen_ill.mgl01

Hmm, odd. I've not got time right now, but I'll try this with my test sensor later on and get back to you. We've both got identical devices. :+1:

1 Like

I'm using THIS driver from for the same sensor which works fine.

Yeah I think I've already used every other driver available on the internet. I spent hours yesterday reading through multiple forums and trying each piece of code but this sensor is putting up a fight.
Here are the driver codes I've tried.
https://www.dropbox.com/sh/268neu5007du7pj/AADn3nH0cqp9BHGC0bAeoK_sa?dl=0

As far as Ive found I'm having the EXACT same issue as AlanB from the forum below. If you want to know what outcomes came from other drivers I got the same results as him.

Here's a question for you, @ShaunTheBaa... which Hubitat hub are you using?

I have the Xiaomi Mija Smart Light Sensor and I've been using the Oh La Labs driver since I first installed it a few years ago, works w/out issue.

Maybe my model is different?
image

Hubitat Elevation C7.
Just tried updating it too.

Currently running version: 2.3.5.102

New version available: 2.3.5.110

Then re-paired but no difference.

Huh, well there goes that theory.

On my C7 I get this:

And on my C8 I get this:

Same driver.

After the configuration "received by device" message is received, nothing else is heard from the device. On the other hub it works perfectly.

Long shot - what channel is your Zigbee radio on, @ShaunTheBaa?

Just tried again, manually installed all driver code on both hubs. Reset device, join C8, no messages received after the "got the config, thanks!" message. Reset device, join C7, "got the config, thanks!", works perfectly. :confused:

There is even one more driver that you can try but seems like the problem is somewhere else, all of the other drivers should work too. Remember, after switching drivers you need to pair the sensor again to HE every time because most of these Xiaomi/Mija/Aqara sensors need specific initialization which works effectively only during the pairing procedure time window.

Are you pairing the sensor close to the hub (at a maximum distance of 1-2 meters) ?

I remember reading somewhere that it's best to use it on 23 or 27?
Heading to work now so there will be some radio silence

There is a new C-8 beta version 2.3.5.112 - can you try it?

There is a beta release w/some fixes that are supposed to help w/Zigbee pairings. I was able to pair to Hue outdoor motion sensors that weren't pairing before. They have stayed connected/reporting for 2-3 hours. So things may be improving.

Okay, that's our first commonality. My working hub is on 25, the non-working hub is on 20. It doesn't feel like the right answer to me, though. Not easy for you to test either.

I've heard all sorts of recommendations, usually 11, 15, 20 or 25 are the ones recommended as they're supposedly in the diminished sidebands of the main Wi-Fi channels 1, 6 and 11. There's a decent write-up on Metageek. Nobody seems to recommend 26, which is the highest channel, as (again, supposedly) some devices don't support it.

Yeah, I don't think this is a driver thing either. Let's see if I can do a quick test.

1 Like

I have 2 such sensors ( * manufacturer: LUMI, * model: lumi.sen_ill.mgl01, * application: 15) connected to my C-8 directly (channel 20), for more than one week now. They stay connected and do not show any sign of problems... go figure!

Pulled out the clean test C7, installed HPM, installed driver, paired light sensor on channel 14. Works. Changed radio to channel 20. Re-paired. Still works.

I've got nothing here to help either of us, I'm afraid. This is essentially the same setup as yours, but it's working. I'll keep the test device on my C8 and try re-pairing with the next update, as I'm definitely seeing that same "no messages" thing there that you are, which points to a platform software issue of some kind.

1 Like

Okay so thanks for all of the replies guys. I fixed it, but I don't know how. Lets go on a journey.
I was originally noting down step by step everything I was trying in case it helped, taking on board the information above. This info is exact too as I was using text to speech saying everything as it happened.

  1. Removed the device using my pc. Hold device button until blue light came on and Re-Paired device within 30cm of hub using hubitat android app on phone. Blue light on device started blinking every 2 seconds.
  2. It paired, device light stays solid for 3 ish seconds then went out.
  3. Hubitat android says found "Xiaomi Mijia Smart Light Sensor GZCGQ01LM".
  4. Device page on pc Shows States: rawLux : 0, presenceUpdated : 1678958971116, illuminance : 0, presence : present.
  5. Clicked configure. States: configuration : complete. Nothing else changed.
  6. Removed the device again using pc and setup my pc to view live zigbee logging while redoing steps 1-3 the same way.
  7. The blue light on the device stayed on for longer this time. Like 8 seconds. I'm the same distance I was and paired it using the same android.
  8. This was the Zigbee Log on my pc. Might help someone.
Lux2023-03-16 19:39:39.371 profileId:0x104, clusterId:0x400, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-67
Lux2023-03-16 19:39:36.351 profileId:0x104, clusterId:0x400, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-67
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:24.276 profileId:0x104, clusterId:0x400, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-58
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:23.268 profileId:0x104, clusterId:0x400, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-69
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:20.551 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-61
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:20.349 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-67
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:18.538 profileId:0x104, clusterId:0x1, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-65
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:18.335 profileId:0x104, clusterId:0x1, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-64
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:17.328 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-66
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:17.025 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-71
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:16.923 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-66
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:16.822 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-68
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:16.720 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-71
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:16.618 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-70
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:16.516 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-69
Xiaomi Mijia Smart Light Sensor GZCGQ01LM2023-03-16 19:39:16.414 profileId:0x0, clusterId:0x8021, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-74
Xiaomi Mijia Smart Light Sensor2023-03-16 19:39:16.111 profileId:0x104, clusterId:0x0, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-71
883D2023-03-16 19:39:16.009 profileId:0x104, clusterId:0x0, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-68
883D2023-03-16 19:39:15.907 profileId:0x104, clusterId:0x0, sourceEndpoint:1, destinationEndpoint:1 , groupId:0, lastHopLqi:255, lastHopRssi:-71
883D2023-03-16 19:39:15.705 profileId:0x0, clusterId:0x8004, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-70
883D2023-03-16 19:39:15.402 profileId:0x0, clusterId:0x8005, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-71
883D2023-03-16 19:39:14.892 profileId:0x0, clusterId:0x13, sourceEndpoint:0, destinationEndpoint:0 , groupId:0, lastHopLqi:255, lastHopRssi:-70
  1. I open the device on my pc and look!

Current States

  • illuminance : 38
  • presence : present

State Variables

  • rawLux : 15911
  • illuminanceDirection : brightening
  • presenceUpdated : 1678959579287

I did nothing else different during the 2 seperate parings other then having the zigbee log open on my computer, and that makes no sense to me either. I didn't even need to click configure.
I would remove the device to provide a zigbee log when it doesn't work but i've been trying to get it to report for almost a week. So I can't help anyone with how it started working.
Thanks to everyone for the help and thanks to @birdslikewires for the device code. :blue_heart:

Edit: Maybe my smartthings hub had something to do with it? The 2 are within 1m of each other. Looking in the ST API my hub is running on channel 14 though.
I'm gonna buy another one, they are on special. Maybe we could get some answers then.

Edit2: something else I noticed is in the device list, everything else has a source of system but the lux sensor has a source of user. Normal?

All very strange, I guess I'll just try the same thing for my C8! :slight_smile:

That's normal, it's just saying that device is using a community driver, rather than one built-in to the system. If you use Hub Mesh to connected devices between hubs you'll get ones that say "Linked" too.

1 Like

Hello all,

I just got one of the Aqara Temperature and Humidity Sensor WSDCGQ11LM's. Paired right up using birdlikeswires' driver on my C7. Thanks for the driver !

All well and good, but the pressures are not particularly intuitive to me in KPa. I added a few lines of code to calculate the pressure in inches of mercury, and can see those in the event logs.

I can't seem to figure out how to add it to the "states" list though. Is that possible, and any hints where to look if so ?

Thanks,

Todd
Dallas, TX, USA.