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 untrusted user: blacklight
GPG key ID: D90FBA7F76362774

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(