Add support for August locks to Yale Access Bluetooth (#76625)

pull/76647/head
J. Nick Koston 2022-08-11 15:12:25 -10:00 committed by GitHub
parent 4a5a039984
commit 75ca80428d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -7,5 +7,8 @@
"dependencies": ["bluetooth"], "dependencies": ["bluetooth"],
"codeowners": ["@bdraco"], "codeowners": ["@bdraco"],
"bluetooth": [{ "manufacturer_id": 465 }], "bluetooth": [{ "manufacturer_id": 465 }],
"iot_class": "local_push" "iot_class": "local_push",
"supported_brands": {
"august_ble": "August Bluetooth"
}
} }

View File

@ -1,6 +1,8 @@
"""The yalexs_ble integration models.""" """The yalexs_ble integration models."""
from __future__ import annotations from __future__ import annotations
import platform
from yalexs_ble import local_name_is_unique from yalexs_ble import local_name_is_unique
from homeassistant.components.bluetooth import ( from homeassistant.components.bluetooth import (
@ -23,8 +25,14 @@ def bluetooth_callback_matcher(
local_name: str, address: str local_name: str, address: str
) -> BluetoothCallbackMatcher: ) -> BluetoothCallbackMatcher:
"""Return a BluetoothCallbackMatcher for the given local_name and address.""" """Return a BluetoothCallbackMatcher for the given local_name and address."""
if local_name_is_unique(local_name): # On MacOS, coreblueooth uses UUIDs for addresses so we must
# have a unique local_name to match since the system
# hides the address from us.
if local_name_is_unique(local_name) and platform.system() == "Darwin":
return BluetoothCallbackMatcher({LOCAL_NAME: local_name}) return BluetoothCallbackMatcher({LOCAL_NAME: local_name})
# On every other platform we actually get the mac address
# which is needed for the older August locks that use the
# older version of the underlying protocol.
return BluetoothCallbackMatcher({ADDRESS: address}) return BluetoothCallbackMatcher({ADDRESS: address})

View File

@ -12,5 +12,6 @@ HAS_SUPPORTED_BRANDS = (
"overkiz", "overkiz",
"renault", "renault",
"wemo", "wemo",
"yalexs_ble",
"zwave_js" "zwave_js"
) )