brianpeiris / switchmate

A python-based command line utility for controlling Switchmate switches
MIT License
35 stars 12 forks source link

can't get auth key #4

Closed pallazola closed 7 years ago

pallazola commented 7 years ago

Had to reset the switchman a few times to get it show up during a switchmate.py scan, but it finally did show up during a scan! I tried to get the auth key and I got the following error:

$:~/switchmate$ sudo ./switchmate.py xx:xx:xx:xx:xx:xx auth Traceback (most recent call last): File "./switchmate.py", line 157, in device.writeCharacteristic(AUTH_NOTIFY_HANDLE, NOTIFY_VALUE, True) File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 459, in writeCharacteristic return self._getResp('wr') File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 334, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 290, in _waitResp raise BTLEException(BTLEException.DISCONNECTED, "Device disconnected") bluepy.btle.BTLEException: Device disconnected

Questions: -you say: "you cannot use this script and the Switchmate app simultaneously." does that mean I can't have the switch paired with the app at all to use the python script? -is it required to have a bluetooth 4.0 interface to use this? (currently running this on a older Mac mini running ubuntu server) Thanks for your work! -Mike

brianpeiris commented 7 years ago

I'm afraid I won't be able to help you diagnose your particular hardware issues. There are too many variations of bluetooth hardware out there to support. I would suggest trying to find a popular USB bluetooth adapter and use that.

does that mean I can't have the switch paired with the app at all to use the python script?

When the official Switchmate app pairs with a Switchmate switch, it generates a new auth key. You might be able to use the app and this script simultaneously if you were able to use the same auth key but it's not easy to retrieve or intercept that auth key from the app

is it required to have a Bluetooth 4.0 interface to use this?

Yes, as far as I know switchmate devices only support the Bluetooth Low Energy (a.k.a BTLE, BLE) protocol. This protocol was introduced in Bluetooth 4.0