forked from platypush/platypush
Only scan for the configured Bluetooth service UUIDs.
This commit is contained in:
parent
d8c429f4a8
commit
dcab766cef
2 changed files with 4 additions and 4 deletions
|
@ -496,7 +496,7 @@ class BluetoothBlePlugin(AsyncRunnablePlugin, EntityManager):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
await self._scan_enabled.wait()
|
await self._scan_enabled.wait()
|
||||||
entities = await self._scan()
|
entities = await self._scan(uuids=self._uuids)
|
||||||
|
|
||||||
new_device_addresses = {e.external_id for e in entities}
|
new_device_addresses = {e.external_id for e in entities}
|
||||||
missing_device_addresses = device_addresses - new_device_addresses
|
missing_device_addresses = device_addresses - new_device_addresses
|
||||||
|
|
|
@ -48,19 +48,19 @@ class SwitchbotBluetoothPlugin(BluetoothBlePlugin, EnumSwitchEntityManager):
|
||||||
|
|
||||||
# Static list of Bluetooth service UUIDs commonly exposed by SwitchBot
|
# Static list of Bluetooth service UUIDs commonly exposed by SwitchBot
|
||||||
# devices.
|
# devices.
|
||||||
_uuids = {
|
_service_uuids = {
|
||||||
service: UUID(f'cba20{prefix}-224d-11e6-9fb8-0002a5d5c51b')
|
service: UUID(f'cba20{prefix}-224d-11e6-9fb8-0002a5d5c51b')
|
||||||
for service, prefix in _uuid_prefixes.items()
|
for service, prefix in _uuid_prefixes.items()
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, characteristics=self._uuids.values(), **kwargs)
|
super().__init__(*args, uuids=self._service_uuids.values(), **kwargs)
|
||||||
|
|
||||||
async def _run(
|
async def _run(
|
||||||
self,
|
self,
|
||||||
device: str,
|
device: str,
|
||||||
command: Command,
|
command: Command,
|
||||||
service_uuid: UUIDType = _uuids['tx'],
|
service_uuid: UUIDType = _service_uuids['tx'],
|
||||||
):
|
):
|
||||||
await self._write(device, command.value, service_uuid)
|
await self._write(device, command.value, service_uuid)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue