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 False
|
||||||
return True
|
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."""
|
"""Handle when entity registry updated."""
|
||||||
if not self.enabled or not self._cloud.is_logged_in:
|
if not self.enabled or not self._cloud.is_logged_in:
|
||||||
return
|
return
|
||||||
@ -527,15 +529,14 @@ class CloudAlexaConfig(alexa_config.AbstractConfig):
|
|||||||
if not self.should_expose(entity_id):
|
if not self.should_expose(entity_id):
|
||||||
return
|
return
|
||||||
|
|
||||||
action = event.data["action"]
|
to_update: list[str] = []
|
||||||
to_update = []
|
to_remove: list[str] = []
|
||||||
to_remove = []
|
|
||||||
|
|
||||||
if action == "create":
|
if event.data["action"] == "create":
|
||||||
to_update.append(entity_id)
|
to_update.append(entity_id)
|
||||||
elif action == "remove":
|
elif event.data["action"] == "remove":
|
||||||
to_remove.append(entity_id)
|
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
|
set(event.data["changes"]) & er.ENTITY_DESCRIBING_ATTRIBUTES
|
||||||
):
|
):
|
||||||
to_update.append(entity_id)
|
to_update.append(entity_id)
|
||||||
|
@ -453,7 +453,9 @@ class CloudGoogleConfig(AbstractConfig):
|
|||||||
self.async_schedule_google_sync_all()
|
self.async_schedule_google_sync_all()
|
||||||
|
|
||||||
@callback
|
@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."""
|
"""Handle when entity registry updated."""
|
||||||
if (
|
if (
|
||||||
not self.enabled
|
not self.enabled
|
||||||
@ -476,7 +478,9 @@ class CloudGoogleConfig(AbstractConfig):
|
|||||||
self.async_schedule_google_sync_all()
|
self.async_schedule_google_sync_all()
|
||||||
|
|
||||||
@callback
|
@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."""
|
"""Handle when device registry updated."""
|
||||||
if (
|
if (
|
||||||
not self.enabled
|
not self.enabled
|
||||||
|
Loading…
x
Reference in New Issue
Block a user