Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Notes for setting up Switchmate on Linux with python3

Switchmate Notes

node-switchmate

Status: working Adapter: ASUS BLE4.0

$ sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev

Ran npm install --unsafe-perm -g node-switchmate for it to install properly

$ sudo ./toggle.switchmate cf7065c94bd8 identify "xfAASw=="
$ sudo ./toggle.switchmate cf7065c94bd8 on "xfAASw=="
$ sudo ./toggle.switchmate cf7065c94bd8 off "xfAASw=="

switchmate.py

This one was a little bit more involved.

$ sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev libperl-dev libglib2.0-dev
$ git clone git://github.com/brianpeiris/switchmate.git
$ cd switchmate
$ sudo -H pip3 install bluepy==1.0.5
$ sudo -H pip3 install docopt==0.6.2
$ python3 switchmate.py scan
$ cd /usr/local/lib/python3.5/dist-packages/bluepy
$ sudo make
$ cd -

Going to try auth code that I got from node-switchmate

$ sudo python3 switchmate.py scan
Scanning...
Found Switchmates:
cf:70:65:c9:4b:d8
$ sudo python3 switchmate.py status
Looking for switchmate status...
cf:70:65:c9:4b:d8 on
$ sudo python3 switchmate.py status cf:70:65:c9:4b:d8
Looking for switchmate status...
cf:70:65:c9:4b:d8 on
$ python3 switchmate.py cf:70:65:c9:4b:d8 auth
$ python3 switchmate.py cf:70:65:c9:4b:d8 b'C5F0004B' switch off
$ python3 switchmate.py cf:70:65:c9:4b:d8 C5F0004B switch off
@parisbutterfield

This comment has been minimized.

Copy link

@parisbutterfield parisbutterfield commented Dec 27, 2017

There's an issue with Python 3's hexlify/unhexlify function. The command to do auth works fine in Python 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment