Update logbook and history for entity glob matching (#14589)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
J. Nick Koston 2020-09-28 11:17:29 -05:00 committed by GitHub
parent 8e00021912
commit e497c77377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 12 deletions

View File

@ -44,6 +44,10 @@ exclude:
description: The list of entity ids to be excluded from the history.
required: false
type: list
entity_globs:
description: Include all entities matching a listed pattern when creating logbook entries (e.g., `sensor.weather_*`).
required: false
type: list
domains:
description: The list of domains to be excluded from the history.
required: false
@ -57,6 +61,10 @@ include:
description: The list of entity ids to be included in the history.
required: false
type: list
entity_globs:
description: Include all entities matching a listed pattern when creating logbook entries (e.g., `sensor.weather_*`).
required: false
type: list
domains:
description: The list of domains to be included in the history.
required: false
@ -83,6 +91,8 @@ history:
entities:
- sensor.last_boot
- sensor.date
entity_globs:
- binary_sensor.*_occupancy
```
Define domains and entities to display by using the `include` configuration
@ -136,6 +146,18 @@ history:
- light.front_porch
```
Filters are applied as follows:
1. No includes or excludes - pass all entities
2. Includes, no excludes - only include specified entities
3. Excludes, no includes - only exclude specified entities
4. Both includes and excludes - include specified entities and exclude specified entities from the remaining.
The following characters can be used in entity globs:
`*` - The asterisk represents zero, one, or multiple characters
`.` - The period represents a single character
#### Implementation details
The history is stored in a SQLite database `home-assistant_v2.db` within your

View File

@ -88,18 +88,12 @@ Filters are applied as follows:
1. No includes or excludes - pass all entities
2. Includes, no excludes - only include specified entities
3. Excludes, no includes - only exclude specified entities
4. Both includes and excludes:
- Include domain and/or glob patterns specified
- If domain is included, and entity not excluded or match exclude glob pattern, pass
- If entity matches include glob pattern, and entity does not match any exclude criteria (domain, glob pattern or listed), pass
- If domain is not included, glob pattern does not match, and entity not included, fail
- Exclude domain and/or glob patterns specified and include does not list domains or glob patterns
- If domain is excluded and entity not included, fail
- If entity matches exclude glob pattern and entity not included, fail
- If entity does not match any exclude criteria (domain, glob pattern or listed), pass
- Neither include or exclude specifies domains or glob patterns
- If entity is included, pass (as #2 above)
- If entity include and exclude, the entity exclude is ignored
4. Both includes and excludes - include specified entities and exclude specified entities from the remaining.
The following characters can be used in entity globs:
- `*` - The asterisk represents zero, one, or multiple characters
- `.` - The period represents a single character
### Common filtering examples