Use EventType for state changed [core] (#97115)

This commit is contained in:
Marc Mueller 2023-07-24 01:10:03 +02:00 committed by GitHub
parent 051929984d
commit 2618bfc073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 145 additions and 84 deletions

View file

@ -21,11 +21,14 @@ from homeassistant.const import (
STATE_UNAVAILABLE,
STATE_UNKNOWN,
)
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv, entity_registry as er
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.helpers.event import (
EventStateChangedData,
async_track_state_change_event,
)
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, EventType
from . import GroupEntity
@ -114,7 +117,9 @@ class BinarySensorGroup(GroupEntity, BinarySensorEntity):
"""Register callbacks."""
@callback
def async_state_changed_listener(event: Event) -> None:
def async_state_changed_listener(
event: EventType[EventStateChangedData],
) -> None:
"""Handle child updates."""
self.async_set_context(event.context)
self.async_defer_or_update_ha_state()