Remove unneeded check for Bang & Olufsen events and device update (#124363)
Remove unneeded check for device and HomeAssistant availabilitypull/123075/head
parent
e56c235424
commit
88b95c1236
|
@ -9,11 +9,8 @@ from homeassistant.helpers.device_registry import DeviceEntry
|
|||
from .const import DOMAIN
|
||||
|
||||
|
||||
def get_device(hass: HomeAssistant | None, unique_id: str) -> DeviceEntry | None:
|
||||
def get_device(hass: HomeAssistant, unique_id: str) -> DeviceEntry:
|
||||
"""Get the device."""
|
||||
if not isinstance(hass, HomeAssistant):
|
||||
return None
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
device = device_registry.async_get_device({(DOMAIN, unique_id)})
|
||||
assert device
|
||||
|
|
|
@ -157,11 +157,6 @@ class BangOlufsenWebsocket(BangOlufsenBase):
|
|||
software_status = await self._client.get_softwareupdate_status()
|
||||
|
||||
# Update the HA device if the sw version does not match
|
||||
if not self._device:
|
||||
self._device = get_device(self.hass, self._unique_id)
|
||||
|
||||
assert self._device
|
||||
|
||||
if software_status.software_version != self._device.sw_version:
|
||||
device_registry = dr.async_get(self.hass)
|
||||
|
||||
|
@ -172,10 +167,6 @@ class BangOlufsenWebsocket(BangOlufsenBase):
|
|||
|
||||
def on_all_notifications_raw(self, notification: dict) -> None:
|
||||
"""Receive all notifications."""
|
||||
if not self._device:
|
||||
self._device = get_device(self.hass, self._unique_id)
|
||||
|
||||
assert self._device
|
||||
|
||||
# Add the device_id and serial_number to the notification
|
||||
notification["device_id"] = self._device.id
|
||||
|
|
Loading…
Reference in New Issue