Improve devialet coordinator typing (#104707)

pull/104720/head
Marc Mueller 2023-11-29 14:17:15 +01:00 committed by GitHub
parent 953a212dd6
commit 0a13968209
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -14,7 +14,7 @@ _LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(seconds=5)
class DevialetCoordinator(DataUpdateCoordinator):
class DevialetCoordinator(DataUpdateCoordinator[None]):
"""Devialet update coordinator."""
def __init__(self, hass: HomeAssistant, client: DevialetApi) -> None:
@ -27,6 +27,6 @@ class DevialetCoordinator(DataUpdateCoordinator):
)
self.client = client
async def _async_update_data(self):
async def _async_update_data(self) -> None:
"""Fetch data from API endpoint."""
await self.client.async_update()

View File

@ -46,13 +46,15 @@ async def async_setup_entry(
async_add_entities([DevialetMediaPlayerEntity(coordinator, entry)])
class DevialetMediaPlayerEntity(CoordinatorEntity, MediaPlayerEntity):
class DevialetMediaPlayerEntity(
CoordinatorEntity[DevialetCoordinator], MediaPlayerEntity
):
"""Devialet media player."""
_attr_has_entity_name = True
_attr_name = None
def __init__(self, coordinator, entry: ConfigEntry) -> None:
def __init__(self, coordinator: DevialetCoordinator, entry: ConfigEntry) -> None:
"""Initialize the Devialet device."""
self.coordinator = coordinator
super().__init__(coordinator)