Log activity

Use this action to write a custom entry to the Activity panel. This is useful when you want to record a meaningful event in your home’s activity history that Home Assistant would not log automatically. For example, use it to record a custom script completing a task, a manual override being triggered, or a note about a condition worth tracking over time.

Using this action from the user interface

If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.

To add a custom entry to the Activity panel from an automation or a script:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation or script, or select Create automation > Create new automation.
  3. If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
  4. In the Then do section, select Add action.
  5. Search for and select Activity: Log activity.
  6. Enter a Name and a Message for the entry.
  7. Optionally, select an Entity to associate the entry with a specific entity, and enter a Domain to assign an integration icon to the entry.
  8. Select Save.

Options in the UI

Name (Required)

The name shown as the subject of the activity entry.

Message (Required)

The message shown as the body of the activity entry.

Entity (Optional)

The entity to associate with the activity entry. When set, the entry appears when filtering the Activity panel by that entity.

Domain (Optional)

The integration domain to associate with the entry. Controls the icon shown next to the entry in the Activity panel. For example, light shows a light bulb icon.

Using this action in YAML

If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.

In YAML, refer to this action as logbook.log. A basic example looks like this:

ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
action: logbook.log
data:
  name: Kitchen
  message: is being used

This writes an entry with the subject “Kitchen” and the message “is being used” to the Activity panel.

Options in YAML

name string Required

The name shown as the subject of the activity entry.

message string Required

The message shown as the body of the activity entry.

entity_id string

The entity to associate with the activity entry. When set, the entry appears when filtering the Activity panel by that entity.

domain string

The integration domain to associate with the entry. Controls the icon shown next to the entry in the Activity panel. For example, light shows a light bulb icon, climate shows a thermostat icon.

Good to know

  • The Entity and Domain fields are independent, meaning you can fill in one without the other. Setting Entity links the entry to that entity so it appears when you filter the Activity panel by that entity. Setting Domain only controls the icon shown next to the entry without linking it to a specific entity.
  • Entries added using this action appear in the Activity panel alongside automatically recorded state changes. They follow the same retention settings as any other activity entry. If your recorder is set to keep 10 days of history, custom entries are also removed after 10 days.
  • If you leave Entity and Domain empty, the entry appears under the logbook domain. Make sure the logbook domain is not excluded in your Activity filter configuration, or the entry will not appear in the panel.

Try it yourself

Ready to test this? Open Settings > Tools > Actions, search for this action, fill in the fields, and select Perform action. You see what happens on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] without writing a line of YAML.

More examples

Real scenarios where this action shows up in automations and scripts. Copy any example and adapt it to your setup.

Tip

You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.

Automation: log when the irrigation valve has been running too long

When a garden irrigation valve has been open for more than 30 minutes, close it and write a custom entry to the Activity panel recording the event. This gives you a permanent, searchable record in the Activity panel of every time the safety cutoff fired, which is useful for spotting patterns such as a valve that repeatedly fails to close on schedule.

  • Trigger: State
    • Entity: Garden irrigation (valve.garden_irrigation)
    • To: Open
    • For: 0:30:00
  • Action: Close valve
    • Target: Garden irrigation
  • Action: Activity: Log activity
    • Name: Garden irrigation valve
    • Message: Closed automatically after staying open for 30 minutes.
    • Entity: Garden irrigation (valve.garden_irrigation)
    • Domain: valve
YAML example for logging an automatic irrigation cutoff
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Close irrigation valve and log if open too long"
triggers:
  - trigger: state
    entity_id: valve.garden_irrigation
    to: "open"
    for:
      minutes: 30
actions:
  - action: valve.close_valve
    target:
      entity_id: valve.garden_irrigation
  - action: logbook.log
    data:
      name: Garden irrigation valve
      message: >-
        Closed automatically after staying open for 30 minutes.
      entity_id: valve.garden_irrigation
      domain: valve

Still stuck?

The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.

Tip

AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.