Integrations

Logbook

Spook adds an action that hands an automation what the logbook shows, like who unlocked the front door in the last hour, with who or what caused each entry.

The logbook integration in Home Assistant keeps a diary of your home: the door unlocked, the lights went on, an automation ran. Where it knows, it says who or what did it: a person, an automation, a script, or an action. You find it under Logbook in the sidebar.

The logbook is for reading, in the logbook panel or in a logbook card. An automation cannot ask it anything. "Who unlocked the front door in the last hour?" is a question the logbook answers on screen, and not in a notification. Spook adds an action that hands an automation the same entries, as a response. An assistant with Spook's tools can read the logbook too, with spook__timeline.

Actions

Spook adds one action to the logbook. You find it wherever you add an action, marked with a 👻.

Get logbook entries

Gets what the logbook shows for one or more entities in a stretch of time, newest first, like the logbook panel lists them. Each entry says when, what happened, and who or what caused it, where the logbook knows.

Think of a notification when the front door is unlocked while you are away, saying who did it. Or a daily summary of how often the garage door opened. The logbook knows, and now your automation does too.

Spook reads the logbook the way the logbook panel does, through the logbook itself, so you get the same entries. It is not an admin action: anyone who can see the logbook panel can use it.

How to use it

  1. Open the automation or script that needs the entries, and select Add action.
  2. Search for logbook entries, and select Logbook: Get logbook entries 👻.
  3. Under Entities, choose the entities to read the logbook of, like the front door lock.
  4. Set Duration to how far back to read, like an hour. Leave it empty for the last day.
  5. Under Response variable, give the entries a name, like logbook. The steps after this one can use it.
  6. Select Save.

Just want to see it work? Try this action opens it in your Home Assistant, ready to run once.

Use cases

What people use this for:

  • Who unlocked the front door, sent along in the notification that it is unlocked.
  • How often the garage door opened today, in an evening summary.
  • Whether an automation turned the heating on, or a person did, before deciding to turn it off again.

Missing something here?

An action, an entity or a repair this integration should have? Say so. Stuck, or found a bug? There is help.