Activity
Activity 集成会以不同的视角呈现您家庭的历史记录:它会按时间倒序显示家中发生的所有变化。
它依赖 recorder 集成来存储数据。这意味着如果 recorder 集成已配置为使用 MySQL 或 PostgreSQL 等数据存储,那么 activity 集成也不会使用默认的 SQLite 数据库存储数据。
此集成默认启用,除非您在 configuration.yaml 文件中禁用了或删除了 default_config: 这一行。如果是这种情况,您可以像下面这样手动启用此集成:
配置过滤器
默认情况下,Activity 会使用与 recorder 相同的过滤器。要限制哪些实体会显示到 Logbook 中,您可以使用 include 和 exclude 参数。
Filters are applied as follows:
- No filter
- All entities included
- Only includes
- Entity listed in entities include: include
- Otherwise, entity matches domain include: include
- Otherwise, entity matches glob include: include
- Otherwise: exclude
- Only excludes
- Entity listed in exclude: exclude
- Otherwise, entity matches domain exclude: exclude
- Otherwise, entity matches glob exclude: exclude
- Otherwise: include
- 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
- 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
- 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
常见过滤示例
如果您想从活动跟踪中排除某些实体或域的消息,只需像下面这样添加 exclude 参数:
如果您只想查看某些特定实体或域的消息,请使用 include 配置:
您也可以使用 include 列表,再通过 exclude 列表过滤掉某些实体或域。通常,这种做法适合在 include 侧按域进行定义,再排除其中某些特定实体。
排除事件
如果您使用 sensor.date 在 UI 中显示当前日期,但不希望每天都为该传感器记录活动,则可以将其排除。
要排除这些实体,只需将它们添加到活动跟踪配置中的 exclude > entities 列表中。
要排除整个域中的所有事件,请将其添加到 exclude > domain 列表中。例如,如果您使用 sun 域只是为了根据 azimuth 属性触发自动化,那么您可能并不关心日出和日落的活动记录。
被排除的实体仍会占用数据库空间,因此也许更适合直接在 recorder 中将其排除。
自定义条目
您可以通过脚本集成触发事件,从而向活动跟踪中添加自定义条目。
:::important
调用 logbook.log 操作时,如果未提供 domain 或 entity_id,条目会以 logbook 域添加。如果您希望这些条目显示在 Activity 面板中,请确保 logbook 域未被过滤掉。
:::
:::note
已分配单位的传感器实体(例如带有 unit_of_measurement 属性)会被视为频繁变化,因此这些传感器会自动从活动跟踪中排除。
:::

