mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Improve generic event typing [cloud] (#114728)
This commit is contained in:
parent
082af6e0ae
commit
d24cf9e4ec
@ -517,7 +517,9 @@ class CloudAlexaConfig(alexa_config.AbstractConfig):
|
||||
return False
|
||||
return True
|
||||
|
||||
async def _handle_entity_registry_updated(self, event: Event) -> None:
|
||||
async def _handle_entity_registry_updated(
|
||||
self, event: Event[er.EventEntityRegistryUpdatedData]
|
||||
) -> None:
|
||||
"""Handle when entity registry updated."""
|
||||
if not self.enabled or not self._cloud.is_logged_in:
|
||||
return
|
||||
@ -527,15 +529,14 @@ class CloudAlexaConfig(alexa_config.AbstractConfig):
|
||||
if not self.should_expose(entity_id):
|
||||
return
|
||||
|
||||
action = event.data["action"]
|
||||
to_update = []
|
||||
to_remove = []
|
||||
to_update: list[str] = []
|
||||
to_remove: list[str] = []
|
||||
|
||||
if action == "create":
|
||||
if event.data["action"] == "create":
|
||||
to_update.append(entity_id)
|
||||
elif action == "remove":
|
||||
elif event.data["action"] == "remove":
|
||||
to_remove.append(entity_id)
|
||||
elif action == "update" and bool(
|
||||
elif event.data["action"] == "update" and bool(
|
||||
set(event.data["changes"]) & er.ENTITY_DESCRIBING_ATTRIBUTES
|
||||
):
|
||||
to_update.append(entity_id)
|
||||
|
@ -453,7 +453,9 @@ class CloudGoogleConfig(AbstractConfig):
|
||||
self.async_schedule_google_sync_all()
|
||||
|
||||
@callback
|
||||
def _handle_entity_registry_updated(self, event: Event) -> None:
|
||||
def _handle_entity_registry_updated(
|
||||
self, event: Event[er.EventEntityRegistryUpdatedData]
|
||||
) -> None:
|
||||
"""Handle when entity registry updated."""
|
||||
if (
|
||||
not self.enabled
|
||||
@ -476,7 +478,9 @@ class CloudGoogleConfig(AbstractConfig):
|
||||
self.async_schedule_google_sync_all()
|
||||
|
||||
@callback
|
||||
async def _handle_device_registry_updated(self, event: Event) -> None:
|
||||
async def _handle_device_registry_updated(
|
||||
self, event: Event[dr.EventDeviceRegistryUpdatedData]
|
||||
) -> None:
|
||||
"""Handle when device registry updated."""
|
||||
if (
|
||||
not self.enabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user