mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Improve generic event typing [device_tracker] (#114730)
This commit is contained in:
parent
7898bdcd4e
commit
289700dcf5
@ -18,7 +18,10 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import Event, HomeAssistant, callback
|
from homeassistant.core import Event, HomeAssistant, callback
|
||||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
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.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
@ -101,7 +104,7 @@ def _async_register_mac(
|
|||||||
data = hass.data[data_key] = {mac: (domain, unique_id)}
|
data = hass.data[data_key] = {mac: (domain, unique_id)}
|
||||||
|
|
||||||
@callback
|
@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."""
|
"""Enable the online status entity for the mac of a newly created device."""
|
||||||
# Only for new devices
|
# Only for new devices
|
||||||
if ev.data["action"] != "create":
|
if ev.data["action"] != "create":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user