Betree / magicblue

💡 Unofficial Python API to control Magic Blue bulbs over Bluetooth
MIT License
100 stars 23 forks source link

Issues using magic blue #45

Closed sigma343 closed 6 years ago

sigma343 commented 6 years ago

Hi there

I was able to successfully install magic blue, however when I try to use it on the command line I get the following error -

any idea what the below means and if there is a fix for it? I did install bluepy on pip3 before installing magicblue.

sudo magicblueshell -c 'set_color blue' -m c1:ea:56:7a:35:9d

Traceback (most recent call last): File "/usr/bin/magicblueshell", line 11, in load_entry_point('magicblue==0.6.0', 'console_scripts', 'magicblueshell')() File "/usr/lib/python3.6/site-packages/magicblue/magicblueshell.py", line 335, in main shell.cmd_connect([params.mac_address]) File "/usr/lib/python3.6/site-packages/magicblue/magicblueshell.py", line 173, in cmd_connect magic_blue.connect(self.bluetooth_adapter) File "/usr/lib/python3.6/site-packages/magicblue/magicbluelib.py", line 139, in connect bluetooth_adapter_nr) File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 353, in init self._connect(deviceAddr, addrType, iface) File "/usr/lib/python3.6/site-packages/bluepy/btle.py", line 402, in _connect "Failed to connect to peripheral %s, addr type: %s" % (addr, addrType)) bluepy.btle.BTLEException: Failed to connect to peripheral c1:ea:56:7a:35:9d,random, addr type: random

Betree commented 6 years ago

Hello @sigma343. Can you try to specify your bulb's version with -b ? It may help if your bulb is a v6 / v9 / v10.

sudo magicblueshell -c 'set_color blue' -m c1:ea:56:7a:35:9d -b 9
sigma343 commented 6 years ago

thanks very much! also noticed its needed for the v8 bulb.

i now have another issue. is there a way to change the brightness of the bulb when you choose a colour (i.e. not the warm light command which has brightness built into the option)?

also, whats the format for hexadecimal colours in the command?

Betree commented 6 years ago

Magic Blue bulb doesn't support brightness parameter for colors. The way to achieve that is to set stronger color intensities (ex: #FF0000 will be brighter than #990000).

Regular hexadecimal color format should be ok here. We use webcolors