mic92 / hue-ble-ctl Goto Github PK
View Code? Open in Web Editor NEWControl your Phillips Hue light bulb over bluetooth
License: MIT License
Control your Phillips Hue light bulb over bluetooth
License: MIT License
Hello everyone,
I can't make the project work. I have done countless resets of the Phlips Hue lamp, but still: I always get the error "Could not read characteristic".
The BLE protocol says that there is an "insufficient encryption".
--> The underlying error could be gatttool: How can I get an encrypted connection to the Philips hue lamp with gatttool? I tried all three security levels (low, medium, high) but nothing works.
Thanks for your help!
The software running on the Philips Hue I have has version 1.65_9_hB3217DF4
.
If I run something like gatttool -l low -t random -b f6:4a:25:26:22:91 --characteristics
it looks that I've the same characteristics as you do.
handle = 0x0002, char properties = 0x20, char value handle = 0x0003, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x0005, char properties = 0x02, char value handle = 0x0006, uuid = 00002b2a-0000-1000-8000-00805f9b34fb
handle = 0x0007, char properties = 0x0a, char value handle = 0x0008, uuid = 00002b29-0000-1000-8000-00805f9b34fb
handle = 0x000a, char properties = 0x02, char value handle = 0x000b, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x000c, char properties = 0x02, char value handle = 0x000d, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x02, char value handle = 0x0010, uuid = 00002a29-0000-1000-8000-00805f9b34fb
handle = 0x0011, char properties = 0x02, char value handle = 0x0012, uuid = 00002a24-0000-1000-8000-00805f9b34fb
handle = 0x0013, char properties = 0x02, char value handle = 0x0014, uuid = 00002a28-0000-1000-8000-00805f9b34fb
handle = 0x0016, char properties = 0x02, char value handle = 0x0017, uuid = 97fe6561-0001-4f62-86e9-b71ee2da3d22
handle = 0x0018, char properties = 0x0e, char value handle = 0x0019, uuid = 97fe6561-0003-4f62-86e9-b71ee2da3d22
handle = 0x001a, char properties = 0x0c, char value handle = 0x001b, uuid = 97fe6561-0004-4f62-86e9-b71ee2da3d22
handle = 0x001c, char properties = 0x2c, char value handle = 0x001d, uuid = 97fe6561-0008-4f62-86e9-b71ee2da3d22
handle = 0x001f, char properties = 0x2e, char value handle = 0x0020, uuid = 97fe6561-1001-4f62-86e9-b71ee2da3d22
handle = 0x0022, char properties = 0x0e, char value handle = 0x0023, uuid = 97fe6561-2001-4f62-86e9-b71ee2da3d22
handle = 0x0024, char properties = 0x0c, char value handle = 0x0025, uuid = 97fe6561-2002-4f62-86e9-b71ee2da3d22
handle = 0x0026, char properties = 0x0c, char value handle = 0x0027, uuid = 97fe6561-2004-4f62-86e9-b71ee2da3d22
handle = 0x0028, char properties = 0x0c, char value handle = 0x0029, uuid = 97fe6561-a001-4f62-86e9-b71ee2da3d22
handle = 0x002b, char properties = 0x02, char value handle = 0x002c, uuid = 932c32bd-0001-47a2-835a-a8d455b859dd
handle = 0x002d, char properties = 0x1e, char value handle = 0x002e, uuid = 932c32bd-0002-47a2-835a-a8d455b859dd
handle = 0x0030, char properties = 0x1e, char value handle = 0x0031, uuid = 932c32bd-0003-47a2-835a-a8d455b859dd
handle = 0x0039, char properties = 0x0c, char value handle = 0x003a, uuid = 932c32bd-0006-47a2-835a-a8d455b859dd
handle = 0x003b, char properties = 0x1e, char value handle = 0x003c, uuid = 932c32bd-0007-47a2-835a-a8d455b859dd
handle = 0x003e, char properties = 0x0e, char value handle = 0x003f, uuid = 932c32bd-1005-47a2-835a-a8d455b859dd
handle = 0x0041, char properties = 0x02, char value handle = 0x0042, uuid = b8843add-0001-4aa1-8794-c3f462030bda
handle = 0x0043, char properties = 0x2c, char value handle = 0x0044, uuid = b8843add-0002-4aa1-8794-c3f462030bda
handle = 0x0046, char properties = 0x0c, char value handle = 0x0047, uuid = b8843add-0003-4aa1-8794-c3f462030bda
handle = 0x0048, char properties = 0x02, char value handle = 0x0049, uuid = b8843add-0004-4aa1-8794-c3f462030bda
handle = 0x004b, char properties = 0x1c, char value handle = 0x004c, uuid = 9da2ddf1-0001-44d0-909c-3f3d3cb34a7b
If I run your script in both situations I get only None
on the introspection. It does connect, although that's also a bit flaky.
The on/off characteristic seems indeed similar.
handle = 0x002d, char properties = 0x1e, char value handle = 0x002e, uuid = 932c32bd-0002-47a2-835a-a8d455b859dd
Writing to the char value handle 0x002e
gatttool -l low -t random -b f6:4a:25:26:22:91 -I
[f6:4a:25:26:22:91][LE]> connect
Attempting to connect to f6:4a:25:26:22:91
Connection successful
[f6:4a:25:26:22:91][LE]> char-write-cmd 0x002e 01
No result... Neither with char-write-req
.
Ah, the result of your script. It didn't matter for me if it is the above MAC address or the address after clicking Reset in the Philips Hue app (see below):
./hue-ble-ctl.py introspect 'E3:14:BB:58:AC:E7'
connect to E3:14:BB:58:AC:E7...
found brightness characteristics
found light characteristics
service: 9da2ddf1-0000-44d0-909c-3f3d3cb34a7b
characteristic: 9da2ddf1-0001-44d0-909c-3f3d3cb34a7b: None
service: b8843add-0000-4aa1-8794-c3f462030bda
characteristic: b8843add-0004-4aa1-8794-c3f462030bda:
characteristic: b8843add-0003-4aa1-8794-c3f462030bda: None
characteristic: b8843add-0002-4aa1-8794-c3f462030bda: None
characteristic: b8843add-0001-4aa1-8794-c3f462030bda: None
service: 932c32bd-0000-47a2-835a-a8d455b859dd
characteristic: 932c32bd-1005-47a2-835a-a8d455b859dd: None
characteristic: 932c32bd-0007-47a2-835a-a8d455b859dd: None
characteristic: 932c32bd-0006-47a2-835a-a8d455b859dd: None
characteristic: 932c32bd-0003-47a2-835a-a8d455b859dd: None
characteristic: 932c32bd-0002-47a2-835a-a8d455b859dd: None
characteristic: 932c32bd-0001-47a2-835a-a8d455b859dd: None
service: 0000fe0f-0000-1000-8000-00805f9b34fb
characteristic: 97fe6561-a001-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-2004-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-2002-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-2001-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-1001-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-0008-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-0004-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-0003-4f62-86e9-b71ee2da3d22: None
characteristic: 97fe6561-0001-4f62-86e9-b71ee2da3d22: None
service: 0000180a-0000-1000-8000-00805f9b34fb
characteristic: 00002a28-0000-1000-8000-00805f9b34fb: None
characteristic: 00002a24-0000-1000-8000-00805f9b34fb: None
characteristic: 00002a29-0000-1000-8000-00805f9b34fb: None
service: 00001801-0000-1000-8000-00805f9b34fb
characteristic: 00002b29-0000-1000-8000-00805f9b34fb: None
characteristic: 00002b2a-0000-1000-8000-00805f9b34fb: None
characteristic: 00002a05-0000-1000-8000-00805f9b34fb: None
ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 230, in maybe_handle_message
self._handler(*args, **kwargs)
File "/home/anne/.local/lib/python3.6/site-packages/gatt/gatt_linux.py", line 398, in properties_changed
self.services_resolved()
File "./hue-ble-ctl.py", line 73, in services_resolved
sys.exit(0)
SystemExit: 0
^CTraceback (most recent call last):
File "./hue-ble-ctl.py", line 95, in <module>
main()
File "./hue-ble-ctl.py", line 91, in main
manager.run()
File "/home/anne/.local/lib/python3.6/site-packages/gatt/gatt_linux.py", line 91, in run
self._main_loop.run()
File "/usr/lib/python3/dist-packages/gi/overrides/GLib.py", line 588, in run
raise KeyboardInterrupt
KeyboardInterrupt
Or is there a more thorough factory reset possible?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.