merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
371 stars 62 forks source link

Support for BLE motion sensor (Mi Motion Activated Night Light 2) #452

Closed romacv closed 1 year ago

romacv commented 1 year ago

Device model yeelink.light.nl1

Device name Mi Motion Activated Night Light 2

Anything special about the device? I tried to add this sensor to my fork https://github.com/merdok/homebridge-miot/blob/e1419b6cd287766879e3050b7fb518f163f7bbc6/lib/modules/contactsensor/devices/yeelink.light.nl1.js and unfortunately it doesn't work

Am i do something wrong? @merdok

Config

IP and Token - BLE gateway
"devices": [
        {
            "name": "Bedroom Night light",
            "ip": "192.168.1.44",
            "token": "6b654a53506972304c35636142765832",
            "deviceId": "blt.1.1d0ps0fkt4k00",
            "model": "yeelink.light.nl1",
            "pollingInterval": 10,
            "deepDebugLog": false,
            "onlyMainService": true,
            "buzzerControl": false,
            "ledControl": false,
            "childLockControl": false,
            "modeControl": false
        }
    ]
merdok commented 1 year ago

That is odd, what exactly does not work? Did you try miot cli to directly try to control the device?

romacv commented 1 year ago

It should recognize as motion sensor, but showing as "not supported"image

merdok commented 1 year ago

When you look at the spec then you will see that this device does not expose any meaningful properties which can be used to control it: http://www.merdok.org/miotspec/

The events are currently not working yet...

romacv commented 1 year ago

Here is Mi Motion Activated Night Light 2 https://www.merdok.org/miotspec/?model=yeelink.light.nl1 And there's Mi Motion Sensor https://www.merdok.org/miotspec/?model=lumi.sensor_motion.v2 Both of them have events "motion-sensor:motion-detected" So Mi Motion Sensor is displayed in room page: IMG_8E0E50BEADD1-1

Is it possible to display here Mi Motion Activated Night Light 2 as well ?

merdok commented 1 year ago

The motion sensor has additionally the motion-sensor:motion-state property which can be used. The night light does not have that property. And as already mentioned events currently does not work.

romacv commented 1 year ago

Got it, thank for your help