[DEPRECATED] Xiaomi Mijia Smart Light Sensor (moved to ST's Edge driver)

One other thing I did: I have my lights on constant from 45 minutes before sunset until midnight. So I used two automations: one using the lux sensor from between sunrise and sunset-45 minutes, and then just turn on the light at sunset-45 minutes.

Thanks for the tip! Ill be using, no motion, to turn it off, so that’s going to be fine for now.

But that’s great, start at 10 lux and tune it from there. I had no idea where to start, so that helps a lot… Now to just wait for the ebay delivery from China lol:(

Hi John, Im having some troubles after updating to this Last version. Im still having battery status shown In smartthings app as main. Also historyttab shows only NaNLux ?

The new app is buggy in how it shows devices. I have 2 of these in the same room, and in the new app one shows battery % and the other shows lux on the device tile. I tried renaming it and changing the type (as suggested by John here) and it I still couldn’t get it to display correctly.

@jlv and @tontze Did both of you update to the latest release where I added a new VID?

I did.

Yay, then the new app is changing behavior once again. Not much I can do about that.

2 Likes

I took it from github :

https://raw.githubusercontent.com/jsconstantelos/SmartThings/master/devicetypes/jsconstantelos/my-xiaomi-mijia-smart-light-sensor.src/my-xiaomi-mijia-smart-light-sensor.groovy

Problem is also that history is just showing NaNlux

Ok, that’s the current release with the new VID to have LUX be on the main tile.

It sounds like the device didn’t get properly configured when it joined, so you can remove it and rejoin, and/or force a configuration. Before starting a config, bring up Live Logging, and then begin a configuration push. To do that in the new app, tap on the three dots in the upper right had corner and tap Settings. Toggle the slider, press the button on the sensor, and then tap on “< Settings” to exit out. That will initiate a config.

Watch your live logging to see what errors and info is being sent from the sensor. I highly recommend removing the comments ("\") from line 65 to get even more logging which trying to get this device to work properly. If fact, you should do that until the sensor reports lux correctly.

These are very finicky devices, and mine too more than one attempt to join, and I still had to perform a forced configuration on at least 1 of them.

When this finally works for you, history will populate with previous luv values, the device will update ST immediately, and the main tile should (should) show lux.

1 Like

Forcing config does not seem to help, i can see in api that it is reporting LUX like it should :

kuva

I was wondering, when it says NaNlux in history, maybe it reports “13 lux” to history, when it should report “13” ?

Im really not a coder, so that assumption might sound silly lol :smiley:

Everything seems to work well, except history, and that it is showing battery main tile …

Line65 // removed i get :

8ec57b27-8aac-4d2f-bf37-6032dfde45b5 22.41.45: debug Incoming data from device : illuminance: 10414

8ec57b27-8aac-4d2f-bf37-6032dfde45b5 22.41.27: debug Desc Map : [raw:0104 0003 01 FF 0000 02 F2EC 01 00 0000 01 00, profileId:0104, clusterId:0003, sourceEndpoint:01, destinationEndpoint:FF, options:0000, messageType:02, dni:F2EC, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:01, direction:00, data:, clusterInt:3, commandInt:1]

8ec57b27-8aac-4d2f-bf37-6032dfde45b5 22.41.27: debug Incoming data from device : catchall: 0104 0003 01 FF 0000 02 F2EC 01 00 0000 01 00

8ec57b27-8aac-4d2f-bf37-6032dfde45b5 22.41.26: debug Desc Map : [raw:0104 0000 01 01 0000 00 F2EC 00 00 0000 0A 01 050042126C756D692E73656E5F696C6C2E6D676C3031, profileId:0104, clusterId:0000, sourceEndpoint:01, destinationEndpoint:01, options:0000, messageType:00, dni:F2EC, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:0A, direction:01, attrId:0005, encoding:42, value:31306c676d2e6c6c695f6e65732e696d756c, isValidForDataType:true, data:[05, 00, 42, 12, 6C, 75, 6D, 69, 2E, 73, 65, 6E, 5F, 69, 6C, 6C, 2E, 6D, 67, 6C, 30, 31], clusterInt:0, attrInt:5, commandInt:10]

8ec57b27-8aac-4d2f-bf37-6032dfde45b5 22.41.26: debug Incoming data from device : catchall: 0104 0000 01 01 0000 00 F2EC 00 00 0000 0A 01 050042126C756D692E73656E5F696C6C2E6D676C3031

8ec57b27-8aac-4d2f-bf37-6032dfde45b5 22.41.26: debug Desc Map : [raw:0104 0000 01 01 0000 00 F2EC 00 00 0000 0A 01 050042126C756D692E73656E5F696C6C2E6D676C3031, profileId:0104, clusterId:0000, sourceEndpoint:01, destinationEndpoint:01, options:0000, messageType:00, dni:F2EC, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:0A, direction:01, attrId:0005, encoding:42, value:31306c676d2e6c6c695f6e65732e696d756c, isValidForDataType:true, data:[05, 00, 42, 12, 6C, 75, 6D, 69, 2E, 73, 65, 6E, 5F, 69, 6C, 6C, 2E, 6D, 67, 6C, 30, 31], clusterInt:0, attrInt:5, commandInt:10]

8ec57b27-8aac-4d2f-bf37-6032dfde45b5 22.41.26: debug Incoming data from device : catchall: 0104 0000 01 01 0000 00 F2EC 00 00 0000 0A 01 050042126C756D692E73656E5F696C6C2E6D676C3031

Ok, i found the problem. My phones language was Finnish, and so was smartthings app … I changed language to english and now history seems fine :slight_smile: Main tile is still battery tho …

Maybe this is bug in smartthings app, not working on finnish language

1 Like

Can I change the reporting interval?

No unfortunately you can’t. The cluster and attribute are there that should allow us to be able to adjust the reporting interval, but the device is not honoring that part of the Zigbee spec.

I actually ran into this as well and what I did was simply change the device type in the IDE. Think I changed it to Unknown or something similar, saved, changed it back and everything worked including the lux reading on the tile. Not sure if that’s useful to others but it meant I didnt need to change/redo any automations.

Got this today, took 5 mins to set up and works great so far. Need to dial in the lex values a little with a bright day. But thanks so much for creating this!

2 Likes

Main tile has changed to LUX on some point :slight_smile:

1 Like

Do these Xiaomi Sensors work ‘out of the box’ with ST hub?

What do you mean by out of the box? If you mean by just joining it to the hub without the DTH posted in this discussion, then no because the device’s fingerprint isn’t already part of a stock DTH.

@johnconstantelo I just wanted to say thank you!!!

1 Like

Thanks @JZst!