-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Yeelight Candela Light (BLE, Bluetooth Low Energy) #202
Comments
I know that some bluetooth devices also support the miot protocol, so in theory it should be possible. On the other hand i have absolutely no experience with bluetooth so it would require a lot of investigation for me, and i would also need a miot capable bluetooth device. The point is, i am not sure if investing time in that makes sense, since most of the bluetooth devices are battery based where frequent polling would just kill the battery so special handling would be needed... |
It would be amazing! I’m waiting for yeelight candela control since 2018 |
@merdok I understand your concern, in any case, it's up to you to decide. But I must say that these devices can be connected to Xiaomi Bluetooth Gateway, for obvious reasons, to poll climate data, so the battery life should not be an issue. I may be wrong here, but isn't the BLE protocol made specifically to save power and thus replaces polling with the broadcast? Candela light, for example, in my case is always connected via USB, since I use it as a daily night lamp or ambiance lamp when watching movies, and compared to the BLE energy consumption, the LED consumption is significantly higher, so even with frequent polling, the difference should be negligible. And you always may place a warning, so users will know that connecting such devices will reduce their longevity a bit, so that will be a choice to make. |
Let see, maybe at some point i will have a look it... |
Thanks so much! |
I have a couple of lemesh.light.wy0c02 BLE Mesh Light running on the Xiaomi IoT Module-MHCB07P. These are very popular in china and no supported plugin has been found for Homebridge. Hope to see it available. |
Well this is currently not my priority due to my goal to improve and stabilize the current wifi devices as much as possible so it might take a while till i can have a look at that (and because of the lack of such bluetooth devices). |
There are increasing number of Xiaomi smart devices using Bluetooth. I have 4 units of It would be really wonderful if this plugin could be expanded to manage the connection to the Bluetooth devices. |
Still missing such a device to even have a look what the device is sending and if it would be possible to map that to the miot protocol... |
Below is the Json file of {"type":"urn:miot-spec-v2:device:outlet:0000A002:qmi-psv3:1:0000C816","description":"Single Control Outlet","services":[{"iid":1,"type":"urn:miot-spec-v2:service:device-information:00007801:qmi-psv3:1:0000C816","description":"","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:manufacturer:00000001:qmi-psv3:1:0000C816","description":"Device Manufacturer","format":"string","access":["read"]},{"iid":2,"type":"urn:miot-spec-v2:property:model:00000002:qmi-psv3:1:0000C816","description":"Device Model","format":"string","access":["read"]},{"iid":3,"type":"urn:miot-spec-v2:property:serial-number:00000003:qmi-psv3:1:0000C816","description":"Device Serial Number","format":"string","access":["read"]},{"iid":4,"type":"urn:miot-spec-v2:property:firmware-revision:00000005:qmi-psv3:1:0000C816","description":"Current Firmware Version","format":"string","access":["read"]}]},{"iid":2,"type":"urn:miot-spec-v2:service:switch:0000780C:qmi-psv3:1:0000C816","description":"Switch","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:on:00000006:qmi-psv3:1:0000C816","description":"Switch Status","format":"bool","access":["read","write","notify"]},{"iid":2,"type":"urn:miot-spec-v2:property:mode:00000008:qmi-psv3:1","description":"Mode","format":"int8","access":["read","write","notify"],"value-range":[0,1,1]},{"iid":3,"type":"urn:miot-spec-v2:property:temperature:00000020:qmi-psv3:1","description":"Temperature","format":"float","access":["read","notify"],"unit":"celsius","value-range":[-30,125,0.1]},{"iid":4,"type":"urn:miot-spec-v2:property:working-time:00000079:qmi-psv3:1","description":"Working Time","format":"uint32","access":["read","notify"],"unit":"minutes","value-range":[0,1440,1]}],"actions":[{"iid":1,"type":"urn:miot-spec-v2:action:toggle:00002811:qmi-psv3:1","description":"Toggle","in":[],"out":[]}]},{"iid":3,"type":"urn:miot-spec-v2:service:power-consumption:0000780E:qmi-psv3:1","description":"Power Consumption","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:power-consumption:0000002F:qmi-psv3:1","description":"Power Consumption","format":"float","access":["read","notify"],"value-range":[0,20000000,0.01]},{"iid":2,"type":"urn:miot-spec-v2:property:electric-power:00000066:qmi-psv3:1","description":"Electric Power","format":"float","access":["read","notify"],"unit":"watt","value-range":[0,10000,0.0001]},{"iid":3,"type":"urn:miot-spec-v2:property:voltage:00000031:qmi-psv3:1","description":"Voltage","format":"uint32","access":["read","notify"],"value-range":[0,500000,1]},{"iid":4,"type":"urn:miot-spec-v2:property:electric-current:00000030:qmi-psv3:1","description":"Electric Current","format":"uint32","access":["read","notify"],"value-range":[0,100000,1]}]},{"iid":4,"type":"urn:qmi-spec:service:relay-count-down:00007801:qmi-psv3:1","description":"relay-count-down","properties":[{"iid":1,"type":"urn:qmi-spec:property:count-down-time:00000001:qmi-psv3:1","description":"count-down-time","format":"int32","access":["read","notify","write"],"unit":"seconds","value-range":[1,86400,1]},{"iid":2,"type":"urn:qmi-spec:property:remain-time:00000002:qmi-psv3:1","description":"remain-time","format":"int32","access":["read","notify"],"unit":"seconds","value-range":[0,86400,1]},{"iid":3,"type":"urn:qmi-spec:property:enable-count-down:00000003:qmi-psv3:1","description":"enable-count-down","format":"bool","access":["read","notify","write"]}]},{"iid":5,"type":"urn:qmi-spec:service:relay-loop-task:00007802:qmi-psv3:1","description":"relay-loop-task","properties":[{"iid":1,"type":"urn:qmi-spec:property:open-time:00000001:qmi-psv3:1","description":"open-time","format":"int32","access":["read","notify","write"],"unit":"seconds","value-range":[0,86400,1]},{"iid":2,"type":"urn:qmi-spec:property:close-time:00000002:qmi-psv3:1","description":"close-time","format":"int32","access":["read","notify","write"],"unit":"seconds","value-range":[0,86400,1]},{"iid":3,"type":"urn:qmi-spec:property:enable:00000003:qmi-psv3:1","description":"enable","format":"bool","access":["read","notify","write"]}]},{"iid":6,"type":"urn:qmi-spec:service:system:00007803:qmi-psv3:1","description":"system","properties":[{"iid":1,"type":"urn:qmi-spec:property:enable-led:00000001:qmi-psv3:1","description":"enable-led","format":"bool","access":["read","notify","write"]},{"iid":2,"type":"urn:qmi-spec:property:enable-buzzer:00000002:qmi-psv3:1","description":"enable-buzzer","format":"bool","access":["read","notify","write"]},{"iid":3,"type":"urn:qmi-spec:property:status:00000003:qmi-psv3:1","description":"status","format":"uint8","access":[],"value-list":[{"value":0,"description":"Normal"},{"value":1,"description":"Protected-OverCurrent"},{"value":2,"description":"Protected-OverTemperature"},{"value":4,"description":"Alarm-OverCurrent"},{"value":8,"description":"Alarm-OverTemperature"}]},{"iid":4,"type":"urn:qmi-spec:property:keep-relay:00000004:qmi-psv3:1","description":"keep-relay","format":"bool","access":["read","notify","write"]},{"iid":5,"type":"urn:qmi-spec:property:update-power:00000005:qmi-psv3:1","description":"update-power","format":"bool","access":["read","notify","write"]}],"events":[{"iid":1,"type":"urn:qmi-spec:event:alarm:00005001:qmi-psv3:1","description":"alarm","arguments":[3]}]},{"iid":7,"type":"urn:qmi-spec:service:calibration:00007804:qmi-psv3:1","description":"calibration"},{"iid":8,"type":"urn:qmi-spec:service:test-simulation:00007805:qmi-psv3:1","description":"test-simulation","properties":[{"iid":1,"type":"urn:qmi-spec:property:temperature:00000001:qmi-psv3:1","description":"temperature","format":"int8","access":["read","notify","write"],"unit":"celsius","value-range":[-100,100,1]},{"iid":2,"type":"urn:qmi-spec:property:current:00000002:qmi-psv3:1","description":"current","format":"int8","access":["read","notify","write"],"value-range":[0,100,1]}]}]} Hope this helps. |
This is the spec which is publicly available... I need actual device communication logs... |
I'd add the BLE Alarm clocks to the list, the default app can't even automatically update DST through the hub... archaic stuff, a replacement would be lovely. That aside, a Bluetooth HCI dump of certain actions would help? |
I mean sure, you can provide one. |
I found a way to add BLE devices and control it through mi cloud. set device config like this: {
"name": "XXX",
"ip": "0.0.0.0",
"token": "<device token>",
"deviceId": "<device id>",
"model": "<device model>",
....
} and reload homebridge. |
Yeah, I guess the recent changes where I removed the dependency for an ip to be required even when a device is set to a micloud only allows to make it work. |
May i know what did you use as the ip? |
ip can be anything when using micloud, with a local connection you need to specify your bridge ip. |
i got it working with micloud, however i am not able to control the BLE lights on a local connection with the homebridge ip. |
Not homebridge ip, but your xiaomi mi HUB ip where all your devices are connected. |
So it isn't possible to control it without a xiaomi hub? |
No, without a hub not yet. That would require to implement the whole xiaomi Bluetooth miot protocol... |
@merdok why don't you consider generate device class js file automatically when first run and cache it. |
It is being already done. But for it to work the plugin needs the model information, so for Bluetooth mesh devices you need to manually specify the correct model in the config.json. |
hello I followed your steps to add the Xiaomi Door and Windows Sensor 2 (isa.magnet.dw2hl) but I can only see the battery level of the sensor on homebridge, the other properties do not show up. Check the homebrigde log below. [12/15/2022, 7:42:29 PM] [miot] [Door sensor] Initializing device services can you help me with this? |
That is already good news that you got it to work! Unfortunately as you noticed, contact sensors are not supported yet but that should not be a big issue for me to add them. I will try to add them in the next update. For now you could use the |
Thanks for the tip @merdok ! Setting the It's being interpreted by homebridge as a light sensor, and the states changes for 0 to 1 LUX according to the door is opened or closed. |
Glad that you got it working! |
Thanks again!! I reduced the interval to 1 sec and it's working almost instantaneously! Is there any way I can change how Homebridge "views" the device, and change it from a light sensor to a door sensor (ex.: change the icon, the units and device type) |
@pedromcortereal You have to observe if 1 sec will not cause any issues for you. |
Hi, i’ve been reading this thread and I can’t figure out how to add Xiaomi Door and Windows Sensor 2 (isa.magnet.dw2hl). Not a tech-savvy, but I do have this sensor connected to BLE hubs. |
@ahmadnazirafiq you can check in this discussion as somebody else was asking that a couple of days ago: #442 |
Thank you! Managed to finally exposed three BLE-based contact sensors to HomeKit for the first time! |
What did you put in the |
Hi @merdok! Do you think you could help us a little bit regarding how to set the Edit: I tried all kind of combinations, but none of them got it to work. I will post my configuration and some screenshots from my Home app.
|
You are missing the value which you expect. Setting a |
Still not working. Tried with |
The value type is probably not a string, also I see above that the door sensor is a contact sensor so it seems that it is fine, isn’t it? |
When I use the interface from the Plugin tab, it writes the value between apostrophes. Also, it doesn’t work because it will always say it’s closed (it appears in the Home app, but it doesn’t do anything). The value type for this property is bool. |
Yeah the ui unfortunately has always the type set to strong so you need to edit those values manually in the config. |
So, I tried with Regarding the CLI I tried the following:
|
When it is a bool, then value should be either true or false. miot test is for testing the local connection. |
You mean like this?
|
No, it has to be a raw parameter string. |
By the way, I grabbed this debug log:
|
Yeah, there is an error during property sync, that would explain why you do not see the sensor update. |
I found this and from the translation ( |
I also noticed that in the cloud device info from above the sensor is not online. |
Any idea how to do that? |
The ip and token needs to be from your gateway, the deviceid and model needs to from the device connected to the gateway which you want to control. |
Tried it. It doesn't work. |
What does the debug log say in that case? Did you tried to do a test connection using the miot cli? |
Devices
Config
miot cli
Log
|
The ip or token which you provided are most probably incorrect |
What makes you say that? The token is the one provided by |
Because the plugin cannot connect to the device, this is usually caused by an incorrect token or ip address. |
@kikiwora Also wanted to control my Candela lamps, so wrote this plugin https://github.com/vsternbach/homebridge-yeelight-ble and you're welcome to try it. |
Good evening!
As for now, I have only one device that is not connected to HomeKit via this or any other plugin, and that is Yeelight Candela.
This lamp can be controlled via Bluetooth using the Yeelight app, and I know that Homebridge supports Bluetooth devices, since I did successfully connect Hygrothermograph via BLE using Homebridge Mi Hygrothermograph plugin.
But for this lamp, no supported plugin has been found for Homebridge, however, the plugin for Homey Pro exists.
I wonder if someone possibly could implement support for this device in the scope of Homebridge MIOT plugin.
It would be awesome. I'm sure that there're lots of people who bought this lamp and would like to use it via HomeKit
The text was updated successfully, but these errors were encountered: