Closed kaitoxakimoto closed 6 years ago
It use it on a regular basis on a PC with Ubuntu 16.04 and can confirm it works on Fedora too. Actually it should work on any Linux machine that can run python + bluepy.
Can you be more specific on the OS you're using or the error you're facing ?
seems that for some reason i can connect with bluetoothctl but not with gatttools
kaito@Kaito-Notebook:~$ bluetoothctl
[NEW] Controller B8:86:87:47:F7:FC Kaito-Notebook [default]
[NEW] Device E0:2C:B2:AF:49:52 Lenovo K3 Note
[NEW] Device F8:1D:78:60:8E:0F LEDBLE-78608E0F
Agent registered
[LEDBLE-78608E0F]# connect F8:1D:78:60:8E:0F
Attempting to connect to F8:1D:78:60:8E:0F
Connection successful
[LEDBLE-78608E0F]# exit
Agent unregistered
[DEL] Controller B8:86:87:47:F7:FC Kaito-Notebook [default]
kaito@Kaito-Notebook:~$ sudo gatttool -t random -b F8:1D:78:60:8E:0F -I
[sudo] password for kaito:
[F8:1D:78:60:8E:0F][LE]> connect
Attempting to connect to F8:1D:78:60:8E:0F
Error: connect error: Connection refused (111)
[F8:1D:78:60:8E:0F][LE]>
if this is not working then the program will not, i guess
the bulb is v10, btw
Try with:
sudo gatttool -t public -b F8:1D:78:60:8E:0F -I
v10 uses a public address type
Hi! seems that with a public address i can connect with the bulb, but the next steps raises the following error:
kaito@Kaito-Notebook:~$ sudo gatttool -t public -b F8:1D:78:60:8E:0F -I
[F8:1D:78:60:8E:0F][LE]> connect
Attempting to connect to F8:1D:78:60:8E:0F
Connection successful
[F8:1D:78:60:8E:0F][LE]> char-write-req 0x000c BB2603440A150722
Error: Characteristic Write Request failed: Attribute can't be written
and when i try to do it via python i get the following error
kaito@Kaito-Notebook:~$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from magicblue import MagicBlue
>>> bulb_mac_address = 'F8:1D:78:60:8E:0F'
>>> bulb = MagicBlue(bulb_mac_address, 10)
>>> bulb.connect()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/magicblue/magicbluelib.py", line 122, in connect
bluetooth_adapter_nr)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 353, in __init__
self._connect(deviceAddr, addrType, iface)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 388, in _connect
self._startHelper()
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 246, in _startHelper
universal_newlines=True)
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
>>>
Two possible reasons:
glib
not installed: run sudo apt-get install libglib2.0-dev
for debian-like or sudo dnf install glib2-devel
This issue with bluepy, a library we're based on that sometimes doesn't get compiled when downloaded with pip
.
You should be able to fix it like that:
cd /usr/local/lib/python3.5/dist-packages/bluepy/
sudo make
thanks, it was a problem with blupy :(
is there a way to get this work on a pc? :(