Skip to content

get-key.py no longer works on firmware 6.4 #3

Description

@wenoptics

Hi, thanks for the endeavor on this project!

I recently bought a Decora BLE switch, which comes with a firmware version of 6.4.

Sadly, the get_key.py script seems to be failed on 6.4:

>>> decora_ble.get_decora_ble_key(<mac-address>)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/temp/pydecora_ble/decora_ble/__init__.py", line 81, in get_decora_ble_key
    device.write_handle(0x37, bytearray([0x22, 83, 0x00, 0x00, 0x00, 0x00]))
  File "/home/pi/temp/pydecora_ble/decora_ble/__init__.py", line 47, in write_handle
    self.device.writeCharacteristic(handle, packet, withResponse=wait)
  File "/home/pi/temp/pydecora_ble/venv/lib/python3.7/site-packages/bluepy-1.3.0-py3.7.egg/bluepy/btle.py", line 543, in writeCharacteristic
    return self._getResp('wr')
  File "/home/pi/temp/pydecora_ble/venv/lib/python3.7/site-packages/bluepy-1.3.0-py3.7.egg/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/home/pi/temp/pydecora_ble/venv/lib/python3.7/site-packages/bluepy-1.3.0-py3.7.egg/bluepy/btle.py", line 368, in _waitResp
    raise BTLEGattError("Bluetooth command failed", resp)
bluepy.btle.BTLEGattError: Bluetooth command failed (code: 13, error: Attribute value length is invalid)

After tinkering on it's BLE stack traffic for a morning, I found that the key-exchanging process seems to be changed on the new firmware. I documented some basic information here.

The good news is, however, at least to my test, the switch control functionalities still work on the new firmware! All the Characteristic are still valid and dimmer control APIs seem to be fine, As long as you have the key.

I can make a PR for a simple change on the unlock process. Do you expect to continuously maintain this library here? But in any case, thanks for the initial work on this.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions