From 0c8554753fe687d44408d8dfb1b7af7a8fa0efb8 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 10:03:51 +0200 Subject: [PATCH 1/2] Migrate recorder services to support translations --- .../components/recorder/services.yaml | 21 --------- .../components/recorder/strings.json | 46 +++++++++++++++++++ 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/homeassistant/components/recorder/services.yaml b/homeassistant/components/recorder/services.yaml index f099cede9f21b1..b74dcc2a4946e2 100644 --- a/homeassistant/components/recorder/services.yaml +++ b/homeassistant/components/recorder/services.yaml @@ -1,12 +1,8 @@ # Describes the format for available recorder services purge: - name: Purge - description: Start purge task - to clean up old data from your database. fields: keep_days: - name: Days to keep - description: Number of history days to keep in database after purge. selector: number: min: 0 @@ -14,28 +10,20 @@ purge: unit_of_measurement: days repack: - name: Repack - description: Attempt to save disk space by rewriting the entire database file. default: false selector: boolean: apply_filter: - name: Apply filter - description: Apply entity_id and event_type filter in addition to time based purge. default: false selector: boolean: purge_entities: - name: Purge Entities - description: Start purge task to remove specific entities from your database. target: entity: {} fields: domains: - name: Domains to remove - description: List the domains that need to be removed from the recorder database. example: "sun" required: false default: [] @@ -43,8 +31,6 @@ purge_entities: object: entity_globs: - name: Entity Globs to remove - description: List the glob patterns to select entities for removal from the recorder database. example: "domain*.object_id*" required: false default: [] @@ -52,8 +38,6 @@ purge_entities: object: keep_days: - name: Days to keep - description: Number of history days to keep in database of matching rows. The default of 0 days will remove all matching rows. default: 0 selector: number: @@ -62,9 +46,4 @@ purge_entities: unit_of_measurement: days disable: - name: Disable - description: Stop the recording of events and state changes - enable: - name: Enable - description: Start the recording of events and state changes diff --git a/homeassistant/components/recorder/strings.json b/homeassistant/components/recorder/strings.json index 7af67f10e25656..84036dd544181b 100644 --- a/homeassistant/components/recorder/strings.json +++ b/homeassistant/components/recorder/strings.json @@ -13,5 +13,51 @@ "title": "Update MariaDB to {min_version} or later resolve a significant performance issue", "description": "Older versions of MariaDB suffer from a significant performance regression when retrieving history data or purging the database. Update to MariaDB version {min_version} or later and restart Home Assistant. If you are using the MariaDB core add-on, make sure to update it to the latest version." } + }, + "services": { + "purge": { + "name": "Purge", + "description": "Starts purge task - to clean up old data from your database.", + "fields": { + "keep_days": { + "name": "Days to keep", + "description": "Number of history days to keep in database after purge." + }, + "repack": { + "name": "Repack", + "description": "Attempt to save disk space by rewriting the entire database file." + }, + "apply_filter": { + "name": "Apply filter", + "description": "Apply `entity_id` and `event_type` filters in addition to time based purge." + } + } + }, + "purge_entities": { + "name": "Purge entities", + "description": "Starts a purge task to remove specific entities from your database.", + "fields": { + "domains": { + "name": "Domains to remove", + "description": "List the domains that need to be removed from the recorder database." + }, + "entity_globs": { + "name": "Entity globs to remove", + "description": "List the glob patterns to select entities for removal from the recorder database." + }, + "keep_days": { + "name": "Days to keep", + "description": "Number of history days to keep in database of matching rows. The default of 0 days will remove all matching rows." + } + } + }, + "disable": { + "name": "Disable", + "description": "Stops the recording of events and state changes." + }, + "enable": { + "name": "Enable", + "description": "Starts the recording of events and state changes." + } } } From 4d0d9f691b09177dd7fb862be99193d3a51be54c Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 15:04:32 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- homeassistant/components/recorder/strings.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/recorder/strings.json b/homeassistant/components/recorder/strings.json index 84036dd544181b..a55f13b27c4f73 100644 --- a/homeassistant/components/recorder/strings.json +++ b/homeassistant/components/recorder/strings.json @@ -21,7 +21,7 @@ "fields": { "keep_days": { "name": "Days to keep", - "description": "Number of history days to keep in database after purge." + "description": "Number of days to keep the data in the database. Starting today, counting backward. A value of `7` means that everything older than a week will be purged." }, "repack": { "name": "Repack", @@ -29,25 +29,25 @@ }, "apply_filter": { "name": "Apply filter", - "description": "Apply `entity_id` and `event_type` filters in addition to time based purge." + "description": "Applys `entity_id` and `event_type` filters in addition to time-based purge." } } }, "purge_entities": { "name": "Purge entities", - "description": "Starts a purge task to remove specific entities from your database.", + "description": "Starts a purge task to remove the data related to specific entities from your database.", "fields": { "domains": { "name": "Domains to remove", - "description": "List the domains that need to be removed from the recorder database." + "description": "List of domains for which the data needs to be removed from the recorder database." }, "entity_globs": { "name": "Entity globs to remove", - "description": "List the glob patterns to select entities for removal from the recorder database." + "description": "List of glob patterns used to select the entities for which the data is to be removed from the recorder database." }, "keep_days": { "name": "Days to keep", - "description": "Number of history days to keep in database of matching rows. The default of 0 days will remove all matching rows." + "description": "Number of days to keep the data for rows matching the filter. Starting today, counting backward. A value of `7` means that everything older than a week will be purged. The default of 0 days will remove all matching rows immediately." } } },