mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Improve devialet coordinator typing (#104707)
This commit is contained in:
parent
953a212dd6
commit
0a13968209
@ -14,7 +14,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
SCAN_INTERVAL = timedelta(seconds=5)
|
SCAN_INTERVAL = timedelta(seconds=5)
|
||||||
|
|
||||||
|
|
||||||
class DevialetCoordinator(DataUpdateCoordinator):
|
class DevialetCoordinator(DataUpdateCoordinator[None]):
|
||||||
"""Devialet update coordinator."""
|
"""Devialet update coordinator."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: DevialetApi) -> None:
|
def __init__(self, hass: HomeAssistant, client: DevialetApi) -> None:
|
||||||
@ -27,6 +27,6 @@ class DevialetCoordinator(DataUpdateCoordinator):
|
|||||||
)
|
)
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
async def _async_update_data(self):
|
async def _async_update_data(self) -> None:
|
||||||
"""Fetch data from API endpoint."""
|
"""Fetch data from API endpoint."""
|
||||||
await self.client.async_update()
|
await self.client.async_update()
|
||||||
|
@ -46,13 +46,15 @@ async def async_setup_entry(
|
|||||||
async_add_entities([DevialetMediaPlayerEntity(coordinator, entry)])
|
async_add_entities([DevialetMediaPlayerEntity(coordinator, entry)])
|
||||||
|
|
||||||
|
|
||||||
class DevialetMediaPlayerEntity(CoordinatorEntity, MediaPlayerEntity):
|
class DevialetMediaPlayerEntity(
|
||||||
|
CoordinatorEntity[DevialetCoordinator], MediaPlayerEntity
|
||||||
|
):
|
||||||
"""Devialet media player."""
|
"""Devialet media player."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
_attr_name = None
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, coordinator, entry: ConfigEntry) -> None:
|
def __init__(self, coordinator: DevialetCoordinator, entry: ConfigEntry) -> None:
|
||||||
"""Initialize the Devialet device."""
|
"""Initialize the Devialet device."""
|
||||||
self.coordinator = coordinator
|
self.coordinator = coordinator
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user