A more elegant logic to infer the manufacturer name.

This commit is contained in:
Fabio Manganiello 2023-03-19 12:54:52 +01:00
parent b568876474
commit 6e9263c4e4
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 1 additions and 3 deletions

View File

@ -236,9 +236,7 @@ def device_to_entity(device: BLEDevice, data: AdvertisementData) -> BluetoothDev
theengs_entity = _parse_advertisement_data(data)
props = (device.details or {}).get('props', {})
manufacturer = theengs_entity.manufacturer or company.get(
list(device.metadata['manufacturer_data'].keys())[0]
if device.metadata.get('manufacturer_data', {})
else None
next(iter(key for key in device.metadata['manufacturer_data']), 0xFFFF)
)
parent_entity = BluetoothDevice(