Actions7
Overview
This node interacts with Home Assistant via its WebSocket API, enabling automation workflows to query and manipulate various Home Assistant resources. Specifically, the Logbook - Read operation retrieves logbook entries from Home Assistant within a specified time range and optional filters such as device or entity IDs. This is useful for monitoring events, auditing changes, or triggering actions based on historical data.
Practical examples include:
- Fetching all logbook entries starting from a certain date/time to analyze recent activity.
- Filtering logbook entries by specific devices or entities to track their state changes or events.
- Using context IDs to correlate related logbook entries in complex automations.
Properties
| Name | Meaning |
|---|---|
| Start Time | The start datetime from which to begin retrieving logbook entries. |
| Additional Fields | Optional additional parameters to refine the logbook query: |
| End Time | The end datetime up to which to retrieve logbook entries. |
| Device Names or IDs | Filter logbook entries by one or more device names or IDs. Can be selected from a list or specified dynamically using expressions. |
| Entity Names or IDs | Filter logbook entries by one or more entity names or IDs. Can be selected from a list or specified dynamically using expressions. |
| Context ID | A string to filter logbook entries by a specific context identifier. |
Output
The node outputs an array of JSON objects representing the retrieved logbook entries. Each entry typically contains details such as timestamp, involved entity or device, event type, and other relevant metadata describing the logged event.
If binary data were involved (not applicable here), it would represent associated media or files linked to logbook entries.
Dependencies
- Requires a valid connection to a Home Assistant instance via its WebSocket API.
- Needs an API authentication token or key configured in n8n credentials to authenticate requests.
- Uses dynamic loading methods to populate selectable options for devices and entities.
Troubleshooting
Common issues:
- Incorrect or expired API credentials will cause authentication failures.
- Specifying invalid or non-existent device/entity IDs will result in empty or error responses.
- Date/time formats must be valid ISO strings; otherwise, the query may fail or return no results.
Error messages:
- Authentication errors indicate problems with the API key/token; verify and update credentials.
- "No data found" usually means the filters did not match any logbook entries; try broadening the time range or removing filters.
- Connection timeouts suggest network issues or that the Home Assistant instance is unreachable.