Add bluetooth address to august (#103177)

This commit is contained in:
J. Nick Koston
2023-11-01 10:47:56 -05:00
committed by GitHub
parent ebee51a794
commit 12c5aec5e6

View File

@@ -2,10 +2,12 @@
from abc import abstractmethod from abc import abstractmethod
from yalexs.doorbell import Doorbell from yalexs.doorbell import Doorbell
from yalexs.lock import Lock from yalexs.lock import Lock, LockDetail
from yalexs.util import get_configuration_url from yalexs.util import get_configuration_url
from homeassistant.const import ATTR_CONNECTIONS
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
@@ -26,15 +28,18 @@ class AugustEntityMixin(Entity):
super().__init__() super().__init__()
self._data = data self._data = data
self._device = device self._device = device
detail = self._detail
self._attr_device_info = DeviceInfo( self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, self._device_id)}, identifiers={(DOMAIN, self._device_id)},
manufacturer=MANUFACTURER, manufacturer=MANUFACTURER,
model=self._detail.model, model=detail.model,
name=device.device_name, name=device.device_name,
sw_version=self._detail.firmware_version, sw_version=detail.firmware_version,
suggested_area=_remove_device_types(device.device_name, DEVICE_TYPES), suggested_area=_remove_device_types(device.device_name, DEVICE_TYPES),
configuration_url=get_configuration_url(data.brand), configuration_url=get_configuration_url(data.brand),
) )
if isinstance(detail, LockDetail) and (mac := detail.mac_address):
self._attr_device_info[ATTR_CONNECTIONS] = {(dr.CONNECTION_BLUETOOTH, mac)}
@property @property
def _device_id(self): def _device_id(self):