Skip to content

Tracking lock state change events

Raman Gupta edited this page Feb 26, 2024 · 2 revisions

The integration will emit a standardized event, regardless of the integration, called lock_code_manager_lock_state_changed. The format of the event data is as follows:

notification_source: event  # Can be event, state, or None
entity_id: lock_entity_id  # Entity ID of the lock that changed state
state: locked  # Current state of the lock
action_text: User code 2 unlock  # Optional text that the lock integration can provide that gives more context about what triggered the event
code_slot: 1  # Code slot that was used to affect the state of the lock. Can be 0 if there is no code slot to provide.
code_slot_name: my_name  # If a name was configured for a particular slot, it will be included here
from: unlocked  # previous state
to: locked  # new state
extra_data: ...  # If the event was triggered from a state change, the state object will be included here. If the event was triggered by an event in the lock's integration, the event data will be included here.
Clone this wiki locally