Home Assistant WS Generic Trigger icon

Home Assistant WS Generic Trigger

Starts a Workflow on a Generic Home Assistant Event

Overview

This node is a generic WebSocket trigger for Home Assistant events. It listens to any specified Home Assistant event type and triggers the workflow whenever such an event occurs. This is useful for automating workflows based on real-time changes or actions within a Home Assistant environment, such as sensor updates, device state changes, or custom events.

Practical examples:

  • Trigger a workflow when a specific sensor value changes.
  • Start automation when a particular device turns on or off.
  • React to custom Home Assistant events for advanced integrations.

Properties

Name Meaning
Type The type of Home Assistant event to listen for.
Has Parameters Whether the event subscription requires additional parameters.
Specify Body How to specify the body parameters if Has Parameters is true: either using explicit key-value pairs (Using Fields Below) or a JSON object (Using JSON).
Body Parameters A collection of key-value pairs representing parameters to send with the event subscription (only shown if Has Parameters is true and Specify Body is Using Fields Below).
JSON A JSON object specifying parameters for the event subscription (only shown if Has Parameters is true and Specify Body is Using JSON).

Output

The node outputs data in JSON format representing the Home Assistant event received. Each output item corresponds to one event and contains all event details as provided by Home Assistant.

No binary data output is produced by this node.

Dependencies

  • Requires connection credentials to a Home Assistant instance via WebSocket API, including host and an API key.
  • Uses an internal Home Assistant client library to manage WebSocket connections and event subscriptions.
  • Requires proper configuration of the Home Assistant API credentials in n8n.

Troubleshooting

  • Missing or invalid "Type" property: The node will throw an error if the event type is not specified. Ensure the "Type" field is filled correctly.
  • Connection errors: If the WebSocket connection to Home Assistant fails or closes unexpectedly, the node emits an error. Verify network connectivity and that the API key and host are correct.
  • Parameter issues: When specifying parameters, ensure they are valid according to the Home Assistant event requirements. Invalid parameters may cause subscription failures.
  • Unexpected connection closure: The node reports an error if the connection closes unexpectedly. Restarting the node or workflow may be necessary.

Links and References

Discussion