How to configure a Raspberry 3 with a MagicBulb

First, we need to download the official rapsberry image (raspbian Pixel version):

wget http://vx2-downloads.raspberrypi.org/raspbian/images/raspbian-2017-01-10/2017-01-11-raspbian-jessie.zip

Now, we need mount the image in a microSD. You can use etcher to automatize the entire proccess:

wget https://resin-production-downloads.s3.amazonaws.com/etcher/1.0.0-beta.18/Etcher-1.0.0-beta.18-linux-x64.zip
unzip -e Etcher-1.0.0-beta.18-linux-x64.zip
./Etcher-1.0.0-beta.18-linux-x64.AppImage






















Before placing the microSD in the raspberry, you need enable ssh service. To do this, just create a file called ssh in the boot partition.

cd /media/PI_BOOT
touch ssh

where PI_BOOT is the boot raspberry partition.
Use pi as user and raspberry as password to access it throught ssh.
Now, we need to install dependencies for magicblue:

sudo apt-get install libglib2.0-dev libbluetooth-dev
git clone https://github.com/IanHarvey/bluepy.git
cd bluepy
sudo python setup.py install 
cd ..
sudo pip3 install setuptools bluepy webcolors
git clone https://github.com/Betree/magicblue.git
cd magicblue
sudo python3 setup.py install 
Traceback (most recent call last):
  File "setup.py", line 7, in <module>
    sys.setdefaultencoding('utf8')
AttributeError: 'module' object has no attribute 'setdefaultencoding'

if you try with the previous magicblue version you will get the following error:

wget https://github.com/Betree/magicblue/archive/0.2.tar.gz
tar xvf 0.2.tar.gz
cd magicblue-0.2
python3 setup.py install
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    long_description=open('README.md').read(),
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 207: ordinal not in range(128)

To fix it, as you see, the problem is the README.md file. Just remove it or backup it and create an empy README.md

mv README.md README.md.bak
touch README.md

Now, you can install magicblue without problems and control 




















Enjoy it!

Comments

Popular posts from this blog

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04

How to install a WhatsApp bot based on Python