Skip to content

Instantly share code, notes, and snippets.

@dale3h
Created August 24, 2017 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dale3h/826fb9954ffa763e27df230261e16c0c to your computer and use it in GitHub Desktop.
Save dale3h/826fb9954ffa763e27df230261e16c0c to your computer and use it in GitHub Desktop.
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
Copy link

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