-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support for Yeelight bulbs #38
Comments
I had confirmed this python can control and set the color w/ pi3 https://github.com/fayep/bolt. Also there is a PDF that documents BLE profiles of the yeelink lights floating around. |
Hi @arosboro, thanks for that. I'll be working on this once I've received a new bulb. |
Hey @arosboro, I've got now a Yeelight bulb... but it looks like it does not support Bluetooth at all. They either sent me a wrong item or I ordered a wrong item. Can you please point me where I can get a Bluetooth enabled Yeelight bulb? |
Hi @vkolotov I've been using these bulbs Misfit Bolt They are $20 on amazon, and have a Misfit home app which supports light scenes with I think a list of 10 color presets that alternate. Also supported is wake up timer. |
But this is not a Yeeligh bulb, right? If so, pls create a ticket for your bulb. I'll close this one as afaik Yeelight bulbs are discontinued. |
I think this is a re-branded yeelight. It responds to the same bluetooth profiles and afaik may also be discontinued as Misfit was acquired by fossil. I cannot tell if there is surplus or if these are being manufactured still as they are easy to find on ebay and amazon. |
I'll try to help you with it (with your help), but I won't be able to buy it as they are discontinued indeed. |
Thanks, I can program, but I haven't touched C++ or Java since 2009. I currently have this set up with PIR to turn on and off connected to a raspberry pi without open hab. |
That repo on github is a bit crappy, hard to understand the protocol and what characteristics are used (UUIDs). I'll need to get a list of services and characteristics UUIDs. Please use gatttool or bluetoothctl (this one preferable as it also gives handler IDs) to get a list of UUIDs for me. |
Device C4:BE:84:XX:XX:XX |
Cool, thanks. Try to connect to that device via bluetoothctl, it will give you a full list of characteristics etc. The one you've provided is a list of services. |
I think this is what you need: [MFBOLT]# info F4:B8:5E:ED:73:9F Do you have the yeelight pdf documentation as well? |
Cool, that would be enough. I do not have any pdf for Yeelight, do you? |
Yes I found this in a openhab discussion from the author of the python script. |
Yeah, I think it would be a good idea to actually use that new feature to create binary channel in the binding. You will be able to control your bulb by using a binary channel even now. So please try. When you've added your bulb in OH, please enable "connection control" channel. Wait until it established a connection to your bulb, then refresh PaperUI tab in your browser, then you should be able to see all binary channels. Please take a screenshot of it. |
Great, that PDF is a gold. |
WOW... a button? :) Looks like we've got a conflicting characteristic... This will add a bit more complexity. Are you sure you've enabled "All as Binary" option? I can't see any binary channels there. Please remove that thing from OH, Enable that feature and add your bulb again. |
Ah yeah, looks like you are running the previous version. Just uninstall the binding via MarketPlace plugin and install it back again. Unfortunately the MarketPlace plugin does not automatically update bindings... |
I'm using TinyB and when I went to uninstall they were showing up as not installed. I removed the IoT market place and re-installed everything and I'm currently seeing market:binding-3694484 - 1.0 but it looks like the binding is not what you are showing in your screenshot. |
You might have been installed it manually? By putting jar files in the addons folder? If so, remove them from |
Ah yeah, forgot to say that the "marketplace" plugin sometimes does not refresh its registry, so you have to restart OH to make it to refresh its registry of all bindings. |
When you've reinstalled everything, please make sure you see these version numbers in the karaf console:
Binding: 1.1.4 Note: if you are not using BlueGiga, then you don't need to install it. |
Ok I'm almost caught up. I'm getting: openhab> bundle:list | grep bluetooth And the UI shows as yours does. I'm just waiting for a reboot to refresh Paper UI. |
Ok, have you enabled "connection control"? Has it been connected? |
OpenHab2 Bluetooth MFBOLT.pdf |
Very cool. Now... In PaperUI: Control -> Bluetooth Devices -> find your bulb there -> find 0000fff1 channel. Click on the value (if exists) to the right of the label. Enter [ff, ff, ff, ff]. This should light up your bulb. Or [00, 00, 00, 00] should turn off your bulb. Try and let me know how it goes :) |
This is from the PDF:
So just change any of those 4 bytes to get different color. E.g. [FF, 00, 00, FF] should give you RED color. |
Ah right, according to the pdf, the very last byte can take only 100 (in decimal), so this should be 64 in hex, e.g. [ff, ff, ff, 64] or [FF, 00, 00, 64]. |
Yes it should be R,G,B,Brightness (0-255,0-255,0-255,0-100) |
Nah... the format in the input field is HEX. So all those decimals should be converted to hex. |
yes, just agreeing w/ you as I'm used to thinking in decimal when working with RGB values. |
Is this working for you? If so, I'll show how to create GATT descriptors so that you will get channels in a human-readable format. |
Oh... a lot of numbers there... I wonder why. Looks like that PDF may not be correct. |
Yeah, anyway, try to send [ff, 00, 00, 64] and see what's happening. |
Here is another good article on that: http://jacksonbaker.net/reverse-engineering-the-misfit-bolt-btle-protocol/ |
Right... I see now, those "2c" bytes translate to "," ASCII. What a stupid protocol :) Using a commas in a binary array... oh dear. |
Yeh, I'm guessing [35, 30, 2c, 32, 35, 35, 2c, 30, 2c, 35, 30, 2c, 2c, 2c, 2c, 2c, 2c] would turn the light green. Trying to confirm now. |
So yeah, you literally need to convert "255,0,0,100,,,,,,," ASCII string to hex bytes, omg. |
I guess that's what happens you follow the specifications literally The devices It seems to disconnect and come back with the initial value without changing when I attempt to fill out a new string value and click the checkmark icon. Is there a special way to change values w/ control in paper UI? |
You could use this tool to convert it: https://www.branah.com/ascii-converter Enter 0,255,0,100,,,,,,, into "ASCII" window, this will give you: Just replace all "0x" with "," and you will get: use it in the binding :), e.g.: |
This config.yml has some working ASCII strings |
I guess the reason why it disconnects is that we put something "invalid" in that characteristic so the bulb reboots itself. I can see that the number of "," (or "2c") is different to what you get for your device and in the PDF. You might need to play with it a bit. Or even just you know, when you connect to the device and when it shows you initial/current value in that channel, just do not remove anything from there and change something, e.g: [32, 35, 35, 2c, 31, 30, 30, 2c, 30, 2c, 34, 30, 2c, 2c, 2c, 2c, 2c, 2c] to [31, 35, 35, 2c, 31, 30, 30, 2c, 30, 2c, 34, 30, 2c, 2c, 2c, 2c, 2c, 2c] ^^ see I changed 32 to 31 (eg. 255 to 155) |
yeah, the number of "," in the tail of the the initial value is 6 whereas PDF says it should be 7. Try first, 6. Eg: |
I think it is as long as there are remaining characters up to 18 values, fill with 2c ",". I tested the first string w/ 6 commas above and it worked. |
Awesome. Nailed. This will add some extra complexity yeah, but still doable. I'll be working on another bulb this week to extend the binding (gatt parser actually) to enable it to provide human readable channels for RGB and now for your bulb. I'll need some help from you in testing it though. |
Thanks for walking me through it, I'll be happy to test when you have something ready |
Hey @pc-maniac, I am having a similar model YLDP09YL, which features the same charateristics UUIDs. Have you figured out how to controll it? Could you share your info if you have some? Thanks! |
@milkpirate As I understand, this BLE Mesh protocol uses some kind of secret API Key and it is currently unknown. Maybe it will leak from manufacturer at some time. |
@vkolotov, I've regained interest in setting this up with the work you claimed to be needing my assistance in testing. Is there anything I should do? I still have the same setup as last time, give me a few hours and I'll have the latest dependencies for open hab updated and installed on my server. |
No description provided.
The text was updated successfully, but these errors were encountered: