3

I've just got a smart led bulb from Zengge and want to control it from my Linux machine with Bluetooth 4.0. I've installed latest bluez 5.x package, so I have a gatttool available. I am able to connect to my bulb and list it's services. But I have no ideas how to control it. Maybe someone have already done that (I was unable to Google for ready solution)? Or have some developments in this area? Or maybe someone have the specs?

madhead
  • 31,729
  • 16
  • 153
  • 201

2 Answers2

4

For those who are interested, here are my findings about the bulb protocol.

madhead
  • 31,729
  • 16
  • 153
  • 201
  • 1
    Great stuff! I've reverse engineered the basics with good old 'trial-and-error', but that didn't get me further then simply setting R,G,B & W (there is a characteristic for each one). Your research will really help me with some more advanced features. For those who are interested: I'm writing a Node.js application that can monitor Jenkins build jobs and set the color of the lightbulbs accordingly. Source here: https://github.com/fguchelaar/jenkins-lightson – fguchelaar Apr 14 '16 at 17:07
3

1) Check if your bluetooth device is up: hcitool dev
2) If device is down: hciconfig hci0 up
3) Scan for bluetooth le devices: hcitool lescan
4) Turn on device: gatttool -b YOUR:LE:DEVICE:MAC:ADDRESS --char-write-req -a 0x001a -n 04
5) Turn off device: gatttool -b YOUR:LE:DEVICE:MAC:ADDRESS --char-write-req -a 0x001a -n 63
6) Dim warm light: gatttool -b YOUR:LE:DEVICE:MAC:ADDRESS --char-write-req -a 0x0013 -n 56000000ff0faa where ff is the hex code for the intensity.
7) Colored light: gatttool -b YOUR:LE:DEVICE:MAC:ADDRESS --char-write-req -a 0x0013 -n 56e92fff99f9aa where e9 is hex red intensity, 2f is hex green intensity, 2f is hex blue intensity

(I'v got the codes by turning on the Bluetooth HCI-snoop-log in Android wile using the Magic Light app and analysing it with Wireshark)

  • Thank you, Jan-Willem, for your answer! I'm surprised to hear I'm not the only one who is interested )). Actually, I've already managed to reverse engineer some part of a protocol and posted my findings [in this article (russian)](http://habrahabr.ru/post/249289/) just a few days ago! And I'm working on the documentation which I want to post somewhere on GitHub, so others can use it. BTW, how did you managed to sniff the traffic? I tried to use Wireshark from laptop with no luck (it does not work with hci0). What application did you used? If you are interested we can communicate by email.. – madhead Feb 03 '15 at 21:51
  • Oh, [just googled](http://www.androidcentral.com/all-about-your-phones-developer-options). I guess you've turned on `Enable Bluetooth HCI snoop log` setting on your phone? If only I had a phone with BLE I would have saved so much time :(. Maybe you've sniffed the codes for custom modes and timer settings (shedule). Can you share it? – madhead Feb 03 '15 at 21:58
  • Hi madhead, I have managed to connect the led bulbs to my Raspberry Pi, so that my family can set the lights with a simple web interface (I'm the only one in the family with a BLE enabled phone). I haven't been looking into custom mode and timer, because these functions will be shifted towards the Raspberry Pi. Maybe I will get into it later on and send you the snoop log. – Jan-Willem Dubbeldam Feb 08 '15 at 06:51