Improve generic event typing [device_tracker] (#114730)

This commit is contained in:
Marc Mueller 2024-04-06 14:01:05 +02:00 committed by GitHub
parent 7898bdcd4e
commit 289700dcf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,7 +18,10 @@ from homeassistant.const import (
)
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.device_registry import (
DeviceInfo,
EventDeviceRegistryUpdatedData,
)
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
@ -101,7 +104,7 @@ def _async_register_mac(
data = hass.data[data_key] = {mac: (domain, unique_id)}
@callback
def handle_device_event(ev: Event) -> None:
def handle_device_event(ev: Event[EventDeviceRegistryUpdatedData]) -> None:
"""Enable the online status entity for the mac of a newly created device."""
# Only for new devices
if ev.data["action"] != "create":