mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Use shorthand attributes in Openhome (#99629)
This commit is contained in:
parent
582eeea082
commit
d5ad01ffbe
@ -102,26 +102,23 @@ def catch_request_errors() -> (
|
|||||||
class OpenhomeDevice(MediaPlayerEntity):
|
class OpenhomeDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Openhome device."""
|
"""Representation of an Openhome device."""
|
||||||
|
|
||||||
|
_attr_supported_features = SUPPORT_OPENHOME
|
||||||
|
_attr_state = MediaPlayerState.PLAYING
|
||||||
|
_attr_available = True
|
||||||
|
|
||||||
def __init__(self, hass, device):
|
def __init__(self, hass, device):
|
||||||
"""Initialise the Openhome device."""
|
"""Initialise the Openhome device."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self._device = device
|
self._device = device
|
||||||
self._attr_unique_id = device.uuid()
|
self._attr_unique_id = device.uuid()
|
||||||
self._attr_supported_features = SUPPORT_OPENHOME
|
|
||||||
self._source_index = {}
|
self._source_index = {}
|
||||||
self._attr_state = MediaPlayerState.PLAYING
|
self._attr_device_info = DeviceInfo(
|
||||||
self._attr_available = True
|
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self):
|
|
||||||
"""Return a device description for device registry."""
|
|
||||||
return DeviceInfo(
|
|
||||||
identifiers={
|
identifiers={
|
||||||
(DOMAIN, self._device.uuid()),
|
(DOMAIN, device.uuid()),
|
||||||
},
|
},
|
||||||
manufacturer=self._device.manufacturer(),
|
manufacturer=device.manufacturer(),
|
||||||
model=self._device.model_name(),
|
model=device.model_name(),
|
||||||
name=self._device.friendly_name(),
|
name=device.friendly_name(),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_update(self) -> None:
|
async def async_update(self) -> None:
|
||||||
|
@ -54,17 +54,13 @@ class OpenhomeUpdateEntity(UpdateEntity):
|
|||||||
"""Initialize a Linn DS update entity."""
|
"""Initialize a Linn DS update entity."""
|
||||||
self._device = device
|
self._device = device
|
||||||
self._attr_unique_id = f"{device.uuid()}-update"
|
self._attr_unique_id = f"{device.uuid()}-update"
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
@property
|
|
||||||
def device_info(self):
|
|
||||||
"""Return a device description for device registry."""
|
|
||||||
return DeviceInfo(
|
|
||||||
identifiers={
|
identifiers={
|
||||||
(DOMAIN, self._device.uuid()),
|
(DOMAIN, device.uuid()),
|
||||||
},
|
},
|
||||||
manufacturer=self._device.manufacturer(),
|
manufacturer=device.manufacturer(),
|
||||||
model=self._device.model_name(),
|
model=device.model_name(),
|
||||||
name=self._device.friendly_name(),
|
name=device.friendly_name(),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_update(self) -> None:
|
async def async_update(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user