custom_components/keymaster/__init__.py
async def homeassistant_started_listener(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    locks_to_watch: List[KeymasterLock],
    evt: Event = None,
):
    """Start tracking state changes after HomeAssistant has started."""
    # Listen to lock state changes so we can fire an event
    hass.data[DOMAIN][config_entry.entry_id][UNSUB_LISTENERS].append(
        async_track_state_change(
            hass,
            [lock.lock_entity_id for lock in locks_to_watch],
            functools.partial(handle_state_change, hass, config_entry),
            from_state=[STATE_LOCKED, STATE_UNLOCKED],
            to_state=[STATE_LOCKED, STATE_UNLOCKED],
        )
    )
Start tracking state changes after HomeAssistant has started.
Start tracking state changes after HomeAssistant has started.
Start tracking state changes after HomeAssistant has started .
async def homeassistant_started_listener(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    locks_to_watch: List[KeymasterLock],
    evt: Event = None,
):
    hass.data[DOMAIN][config_entry.entry_id][UNSUB_LISTENERS].append(
        async_track_state_change(
            hass,
            [lock.lock_entity_id for lock in locks_to_watch],
            functools.partial(handle_state_change, hass, config_entry),
            from_state=[STATE_LOCKED, STATE_UNLOCKED],
            to_state=[STATE_LOCKED, STATE_UNLOCKED],
        )
    )
async def homeassistant_started_listener ( hass : HomeAssistant , config_entry : ConfigEntry , locks_to_watch : List [ KeymasterLock ] , evt : Event = None , ) : hass . data [ DOMAIN ] [ config_entry . entry_id ] [ UNSUB_LISTENERS ] . append ( async_track_state_change ( hass , [ lock . lock_entity_id for lock in locks_to_watch ] , functools . partial ( handle_state_change , hass , config_entry ) , from_state = [ STATE_LOCKED , STATE_UNLOCKED ] , to_state = [ STATE_LOCKED , STATE_UNLOCKED ] , ) )
Start tracking state changes after HomeAssistant has started.
Start tracking state changes after HomeAssistant has started .
"""Start tracking state changes after HomeAssistant has started.""" # Listen to lock state changes so we can fire an event
hass
HomeAssistant
config_entry
ConfigEntry
locks_to_watch
List[KeymasterLock]
evt
Event