Use shorthand attributes in Openhome (#99629)

This commit is contained in:
Joost Lekkerkerker 2023-09-05 14:57:26 +02:00 committed by GitHub
parent 582eeea082
commit d5ad01ffbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 21 deletions

View file

@ -102,26 +102,23 @@ def catch_request_errors() -> (
class OpenhomeDevice(MediaPlayerEntity):
"""Representation of an Openhome device."""
_attr_supported_features = SUPPORT_OPENHOME
_attr_state = MediaPlayerState.PLAYING
_attr_available = True
def __init__(self, hass, device):
"""Initialise the Openhome device."""
self.hass = hass
self._device = device
self._attr_unique_id = device.uuid()
self._attr_supported_features = SUPPORT_OPENHOME
self._source_index = {}
self._attr_state = MediaPlayerState.PLAYING
self._attr_available = True
@property
def device_info(self):
"""Return a device description for device registry."""
return DeviceInfo(
self._attr_device_info = DeviceInfo(
identifiers={
(DOMAIN, self._device.uuid()),
(DOMAIN, device.uuid()),
},
manufacturer=self._device.manufacturer(),
model=self._device.model_name(),
name=self._device.friendly_name(),
manufacturer=device.manufacturer(),
model=device.model_name(),
name=device.friendly_name(),
)
async def async_update(self) -> None:

View file

@ -54,17 +54,13 @@ class OpenhomeUpdateEntity(UpdateEntity):
"""Initialize a Linn DS update entity."""
self._device = device
self._attr_unique_id = f"{device.uuid()}-update"
@property
def device_info(self):
"""Return a device description for device registry."""
return DeviceInfo(
self._attr_device_info = DeviceInfo(
identifiers={
(DOMAIN, self._device.uuid()),
(DOMAIN, device.uuid()),
},
manufacturer=self._device.manufacturer(),
model=self._device.model_name(),
name=self._device.friendly_name(),
manufacturer=device.manufacturer(),
model=device.model_name(),
name=device.friendly_name(),
)
async def async_update(self) -> None: