Turns out the UUID changed between versions. So when I change the line to:
SWITCHMATE_SERVICE = 'abd0f555eb40e7b2ac49ddeb83d32ba2'
…it now comes up in a scan.
So, next steps: getting status, and getting an auth code. Unfortunately, neither are working:
pi@raspberrypi:~/switchmate $ sudo python3 switchmate.py status
Looking for switchmate status...
Traceback (most recent call last):
File "switchmate.py", line 140, in <module>
status(arguments['<mac_address>'])
File "switchmate.py", line 106, in status
scanner.process(20)
File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 621, in process
self.delegate.handleDiscovery(dev, (dev.updateCount <= 1), isNewData)
File "switchmate.py", line 94, in handleDiscovery
print(dev.addr + ' ' + ("off", "on")[(int(data, 16) >> 8) & 1])
TypeError: int() can't convert non-string with explicit base
pi@raspberrypi:~/switchmate $ sudo python3 switchmate.py c0:12:df:cb:b3:23 auth
Traceback (most recent call last):
File "switchmate.py", line 157, in <module>
device.writeCharacteristic(AUTH_NOTIFY_HANDLE, NOTIFY_VALUE, True)
File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 459, in writeCharacteristic
return self._getResp('wr')
File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 334, in _getResp
resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
File "/usr/local/lib/python3.4/dist-packages/bluepy/btle.py", line 296, in _waitResp
raise BTLEException(BTLEException.COMM_ERROR, "Error from Bluetooth stack (%s)" % errcode)
bluepy.btle.BTLEException: Error from Bluetooth stack (comerr)
So I’m stuck again.
EDIT: Some slight progress: I don’t need sudo anymore to get the same errors. So once this gets worked out it will be easier to incorporate into HASS.