Skip to content

Commit bed6c0e

Browse files
[bluetooth.govee] Enable accessing Govee devices with updated firmware requiring encrypted communication
Newer firmwares for Govee devices encrypt the communication for the command channel. Every communication on the PROTOCOL_CHAR_UUID characteristic for these devices is expected to be encrypted and if that does not hold, the device will immediately disconnect. The communication is protected by a session key, that is determined by doing a handshake with the auth service on the device. That in turn is authenticated with a pre shared key, that other projects communicating with the devices already determined. The general communication scheme is: - connect to device - do encryption handshake to determine session key - communicate with PROTOCOL_CHAR_UUID using session key - disconnect While working on the implementation the asynchronous implementation allowing multiple threads access to the device simultaniously was found to be problematic. Changes: - ConnectedBluetoothHandler was dropped as superclass and replaced by BeaconBluetoothHandler as the core functionality (reporting the current measurements) is provided by the advertisement data and the connection is only needed to update the configuration. - The socket like implementation (gattserial) was removed and replaced by direct invocation of BluetoothDevice#writeCharacteristic and event listeners for onCharacteristicUpdate. From that infrastructure the implemented commands were retained as they provide the required encoding. - A helper to handle the encryption was added. This helper also provides a NOOP implementation if the device does not have an auth service and thus does not need encryption. Signed-off-by: Matthias Bläsing <mblaesing@doppel-helix.eu>
1 parent 18f81cf commit bed6c0e

15 files changed

Lines changed: 586 additions & 510 deletions

File tree

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/GattMessage.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/GattSocket.java

Lines changed: 0 additions & 118 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/MessageHandler.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/MessageServicer.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/MessageSupplier.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/SimpleGattSocket.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/SimpleMessage.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/SimpleMessageHandler.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

bundles/org.openhab.binding.bluetooth.govee/src/main/java/org/openhab/binding/bluetooth/gattserial/SimpleMessageServicer.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)