mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Move available property to entity.py for Squeezebox (#146531)
This commit is contained in:
parent
724c349194
commit
ba69301dda
@ -153,11 +153,6 @@ class SqueezeboxButtonEntity(SqueezeboxEntity, ButtonEntity):
|
||||
f"{format_mac(self._player.player_id)}_{entity_description.key}"
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return self.coordinator.available and super().available
|
||||
|
||||
async def async_press(self) -> None:
|
||||
"""Execute the button action."""
|
||||
await self._player.async_query("button", self.entity_description.press_action)
|
||||
|
@ -33,6 +33,13 @@ class SqueezeboxEntity(CoordinatorEntity[SqueezeBoxPlayerUpdateCoordinator]):
|
||||
manufacturer=self._player.creator,
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
# super().available refers to CoordinatorEntity.available (self.coordinator.last_update_success)
|
||||
# self.coordinator.available is the custom availability flag from SqueezeBoxPlayerUpdateCoordinator
|
||||
return self.coordinator.available and super().available
|
||||
|
||||
|
||||
class LMSStatusEntity(CoordinatorEntity[LMSStatusDataUpdateCoordinator]):
|
||||
"""Defines a base status sensor entity."""
|
||||
|
@ -246,11 +246,6 @@ class SqueezeBoxMediaPlayerEntity(SqueezeboxEntity, MediaPlayerEntity):
|
||||
CONF_BROWSE_LIMIT, DEFAULT_BROWSE_LIMIT
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return self.coordinator.available and super().available
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return device-specific attributes."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user