Update recorder.markdown for purge_entities service change (#32376)

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
karwosts 2024-04-22 11:11:00 -07:00 committed by GitHub
parent 6b3e55ae64
commit 0bd0eeef95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -216,17 +216,15 @@ Note that purging will not immediately decrease disk space usage but it will sig
### Service `purge_entities`
Call the service `recorder.purge_entities` to start a task that purges events and states from the recorder database that match any of the specified `entity_id`, `domains` and `entity_globs` fields. Leaving all three parameters empty will result in all entities being selected for purging.
Call the service `recorder.purge_entities` to start a task that purges events and states from the recorder database that match any of the specified `entity_id`, `domains`, and `entity_globs` fields. At least one of the three selection criteria fields must be provided.
| Service data attribute | Optional | Description |
| ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `entity_id` | yes<sup>*</sup> | A list of entity_ids that should be purged from the recorder database. |
| `domains` | yes | A list of domains that should be purged from the recorder database. |
| `entity_id` | yes | A list of entity_ids that should be purged from the recorder database. |
| `domains` | yes | A list of domains that should be purged from the recorder database. |
| `entity_globs` | yes | A list of regular expressions that identify entities to purge from the recorder database. |
| `keep_days` | yes | Number of history days to keep in the database of matching rows. The default of 0 days will remove all matching rows. |
Note: The `entity_id` is only optional when used in `automations.yaml` or `scripts.yaml`. When using the UI to call this service then it is mandatory to specify at least one `entity_id` using the Target Picker or via YAML mode.
#### Example automation to remove data rows for specific entities
The below automation will remove history for `sensor.power_sensor_0` older than 5 days at `04:15:00` every day.
@ -240,7 +238,6 @@ action:
- service: recorder.purge_entities
data:
keep_days: 5
target:
entity_id: sensor.power_sensor_0
mode: single
```