Skip to content

Commit

Permalink
chore (typing): Tighter typing for event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
agittins committed May 9, 2024
1 parent e77f28c commit 8258b9a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/bermuda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from homeassistant.const import STATE_UNAVAILABLE
from homeassistant.core import Config
from homeassistant.core import Event
from homeassistant.core import EventStateChangedData
from homeassistant.core import HomeAssistant
from homeassistant.core import SupportsResponse
from homeassistant.core import callback
Expand All @@ -32,6 +33,7 @@
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.device_registry import EVENT_DEVICE_REGISTRY_UPDATED
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.device_registry import EventDeviceRegistryUpdatedData
from homeassistant.helpers.device_registry import format_mac
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
Expand Down Expand Up @@ -763,7 +765,7 @@ def __init__(
self.metadevices: dict[str, BermudaDevice] = {}

@callback
def handle_state_changes(ev: Event):
def handle_state_changes(ev: Event[EventStateChangedData]):
"""Watch for new mac addresses on private ble devices and act."""
if ev.event_type == EVENT_STATE_CHANGED:
event_entity = ev.data.get("entity_id", "invalid_event_entity")
Expand Down Expand Up @@ -809,7 +811,7 @@ def handle_state_changes(ev: Event):
self._do_private_device_init = True

@callback
def handle_devreg_changes(ev: Event):
def handle_devreg_changes(ev: Event[EventDeviceRegistryUpdatedData]):
"""Update our scanner list if the device registry is changed.
This catches area changes (on scanners) and any new/changed
Expand Down

0 comments on commit 8258b9a

Please sign in to comment.