mirror of
https://github.com/home-assistant/core.git
synced 2026-08-07 22:05:35 +01:00
Adapt bang_olufsen to new device registry API (#176937)
This commit is contained in:
@@ -21,10 +21,12 @@ from .const import (
|
||||
)
|
||||
|
||||
|
||||
def get_device(hass: HomeAssistant, unique_id: str) -> DeviceEntry:
|
||||
def get_device(hass: HomeAssistant, unique_id: str, entry_id: str) -> DeviceEntry:
|
||||
"""Get the device."""
|
||||
device_registry = dr.async_get(hass)
|
||||
device = device_registry.async_get_device({(DOMAIN, unique_id)})
|
||||
device = device_registry.async_get_device_by_identifier(
|
||||
(DOMAIN, unique_id), entry_id
|
||||
)
|
||||
assert device
|
||||
|
||||
return device
|
||||
|
||||
@@ -50,7 +50,7 @@ class BeoWebsocket(BeoBase):
|
||||
BeoBase.__init__(self, entry, client)
|
||||
|
||||
self.hass = hass
|
||||
self._device = get_device(hass, self._unique_id)
|
||||
self._device = get_device(hass, self._unique_id, self.entry.entry_id)
|
||||
|
||||
# WebSocket callbacks
|
||||
self._client.get_notification_notifications(self.on_notification_notification)
|
||||
|
||||
Reference in New Issue
Block a user