Wait for a HA trigger to fire
ws_subscribe_triggerWait for a Home Assistant trigger condition to fire once, avoiding polling. Blocks up to a specified timeout, returning the event context or None if it doesn't fire.
Instructions
Passively wait for a Home Assistant trigger definition to fire once.
Sends subscribe_trigger with the given trigger and waits up to
timeout seconds for the matching event.
Use when: waiting for a specific trigger condition (state, time, numeric
state, ...) rather than polling.
Not for: raw state_changed events on one entity — use
ws_listen_state_changes.
Returns: the trigger's event context dict when it fires, or None if
timeout elapses first.
Errors: raises RuntimeError when the WebSocket handshake does not
complete within timeout.
Limits: blocks for up to timeout seconds, including the initial
handshake.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | Maximum seconds to wait for the trigger to fire before returning None; must be between 1 and 300. | |
| trigger | Yes | HA trigger definition dict, e.g. {'platform': 'state', 'entity_id': 'binary_sensor.motion', 'to': 'on'}. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |