Activity

The activity integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides a different perspective on the history of your house by showing all the changes that happened to your house in reverse chronological order. It depends on the recorder integration for storing the data. This means that if the recorder integration is set up to use e.g., MySQL or PostgreSQL as data store, the activity integration does not use the default SQLite database to store data.

This integration is by default enabled, unless you’ve disabled or removed the default_config: line from your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file. If that is the case, the following example shows you how to enable this integration manually, by adding it to your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file:

# Example configuration.yaml entry
logbook:

Configuration Variables

exclude map (Optional)

Configure which integrations should not should not track activity. (Configure Filter)

entities list (Optional)

The list of entity ids to be excluded from tracking activity.

entity_globs list (Optional)

Exclude all entities matching a listed pattern from tracking activity (e.g., sensor.weather_*).

domains list (Optional)

The list of domains to be excluded from tracking activity.

include map (Optional)

Configure which integrations should tracking activity. (Configure Filter)

entities list (Optional)

The list of entity ids to be included when tracking activity.

entity_globs list (Optional)

Include all entities matching a listed pattern when tracking activity (e.g., sensor.weather_*).

domains list (Optional)

The list of domains to be included when tracking activity.

Configure filter

By default, the activity will use the same filter as the recorder. To limit which entities are being exposed to Logbook, you can use the include and exclude parameters.

# Example filter to include specified domains and exclude specified entities
logbook:
  include:
    domains:
      - alarm_control_panel
      - light
    entity_globs:
      - binary_sensor.*_occupancy
  exclude:
    entities:
      - light.kitchen_light

Filters are applied as follows:

  1. No filter
    • All entities included
  2. Only includes
    • Entity listed in entities include: include
    • Otherwise, entity matches domain include: include
    • Otherwise, entity matches glob include: include
    • Otherwise: exclude
  3. Only excludes
    • Entity listed in exclude: exclude
    • Otherwise, entity matches domain exclude: exclude
    • Otherwise, entity matches glob exclude: exclude
    • Otherwise: include
  4. Domain and/or glob includes (may also have excludes)
    • Entity listed in entities include: include
    • Otherwise, entity listed in entities exclude: exclude
    • Otherwise, entity matches glob include: include
    • Otherwise, entity matches glob exclude: exclude
    • Otherwise, entity matches domain include: include
    • Otherwise: exclude
  5. Domain and/or glob excludes (no domain and/or glob includes)
    • Entity listed in entities include: include
    • Otherwise, entity listed in exclude: exclude
    • Otherwise, entity matches glob exclude: exclude
    • Otherwise, entity matches domain exclude: exclude
    • Otherwise: include
  6. No Domain and/or glob includes or excludes
    • Entity listed in entities include: include
    • Otherwise: exclude

The following characters can be used in entity globs:

* - The asterisk represents zero, one, or multiple characters ? - The question mark represents zero or one character

Common filtering examples

If you want to exclude messages of some entities or domains from activity tracking, just add the exclude parameter like:

# Example of excluding domains and entities from activity tracking (formerly called logbook)
logbook:
  exclude:
    entities:
      - sensor.last_boot
      - sensor.date
    entity_globs:
      - sensor.weather_*
    domains:
      - sun

In case you just want to see messages from some specific entities or domains, use the include configuration:

# Example to show how to only track the activity of the listed domains and entities
logbook:
  include:
    domains:
      - sensor
      - switch
      - media_player

You can also use the include list and filter out some entities or domains with an exclude list. Usually, this makes sense if you define domains on the include side and filter out some specific entities.

# Example of combining include and exclude configurations for activity tracking
logbook:
  include:
    domains:
      - sensor
      - switch
      - media_player
  exclude:
    entities:
      - sensor.last_boot
      - sensor.date
    entity_globs:
      - sensor.weather_*

Exclude events

If you have sensor.date to show the current date in the UI, but you do not want activity tracking for that sensor every day, it can be excluded. To exclude these entities, just add them to the exclude > entities list in the configuration of the activity tracking.

To exclude all events from a whole domain, add it to the exclude > domain list. For instance, if you use the sun domain only to trigger automations on the azimuth attribute, then you are possibly not interested in activity tracking for sun rise and sun set.

Excluded entities still take up space in the database. It may be advisable to exclude them in recorder instead.

Custom entries

It is possible to add custom entries to activity tracking by using the script integration to fire an event.

# Example configuration.yaml entry
script:
  add_logbook_entry:
    alias: "Add activity"
    sequence:
      - action: logbook.log
        data:
          name: Kitchen
          message: is being used
          # Optional
          entity_id: light.kitchen
          domain: light

Important

When calling the logbook.log action without a domain or entity_id, entries will be added with the logbook domain. Ensure that the logbook domain is not filtered away if you want these entries to appear in your Activity panel.

Note

Sensor entities that have been assigned units (for example, have a unit_of_measurement attribute) are assumed to change frequently and those sensors are automatically excluded from activity tracking.