Support for encrypted BLE MiBeacon devices (#75677)
* Support for encrypted devices * Sensor should use bindkey if available * Error message if encryption fails * Let mypy know this is always set by now * Towards supporting encryption in step_user * Add tests for the 4 new happy paths * Add test coverage for failure cases * Add strings * Bump to 0.5.1. Legacy MiBeacon does not use an authentication token, so harder to detect incorrect key * Add _title() helper * Fix test after rebase * Update homeassistant/components/xiaomi_ble/strings.json Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Remove unused lines Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
f94a79b409
commit
e18819c678
9 changed files with 649 additions and 23 deletions
|
@ -158,7 +158,10 @@ async def async_setup_entry(
|
|||
coordinator: PassiveBluetoothProcessorCoordinator = hass.data[DOMAIN][
|
||||
entry.entry_id
|
||||
]
|
||||
data = XiaomiBluetoothDeviceData()
|
||||
kwargs = {}
|
||||
if bindkey := entry.data.get("bindkey"):
|
||||
kwargs["bindkey"] = bytes.fromhex(bindkey)
|
||||
data = XiaomiBluetoothDeviceData(**kwargs)
|
||||
processor = PassiveBluetoothDataProcessor(
|
||||
lambda service_info: sensor_update_to_bluetooth_data_update(
|
||||
data.update(service_info)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue