From f86ef7006cdc639cdad55b249325bc326c4969b6 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 26 Sep 2024 17:06:56 +0200 Subject: [PATCH 1/2] Add statistic id to fix messages --- .../statistics/dialog-statistics-fix-units-changed.ts | 1 + .../developer-tools/statistics/fix-statistics.ts | 7 ++++++- src/translations/en.json | 11 ++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts b/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts index e2bb70720898..15263541db19 100644 --- a/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts +++ b/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts @@ -61,6 +61,7 @@ export class DialogStatisticsFixUnitsChanged extends LitElement { this._params.issue.data.statistic_id, undefined ), + statistic_id: this._params.issue.data.statistic_id, current_unit: this._params.issue.data.state_unit, previous_unit: this._params.issue.data.metadata_unit, } diff --git a/src/panels/developer-tools/statistics/fix-statistics.ts b/src/panels/developer-tools/statistics/fix-statistics.ts index 6b2d6a7affca..2046f32c5124 100644 --- a/src/panels/developer-tools/statistics/fix-statistics.ts +++ b/src/panels/developer-tools/statistics/fix-statistics.ts @@ -29,6 +29,7 @@ export const fixStatisticsIssue = async ( "ui.panel.developer-tools.tabs.statistics.fix_issue.no_state.info_text_1", { name: getStatisticLabel(hass, issue.data.statistic_id, undefined), + statistic_id: issue.data.statistic_id, } )}

${localize( "ui.panel.developer-tools.tabs.statistics.fix_issue.no_state.info_text_2", @@ -75,6 +76,7 @@ export const fixStatisticsIssue = async ( "ui.panel.developer-tools.tabs.statistics.fix_issue.entity_no_longer_recorded.info_text_1", { name: getStatisticLabel(hass, issue.data.statistic_id, undefined), + statistic_id: issue.data.statistic_id, } )} ${localize( @@ -107,9 +109,12 @@ export const fixStatisticsIssue = async ( "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.title" ), text: html`${localize( - "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.info_text_1", + issue.data.state_class + ? "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.info_text_1" + : "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.info_text_1_no_state_class", { name: getStatisticLabel(hass, issue.data.statistic_id, undefined), + statistic_id: issue.data.statistic_id, state_class: issue.data.state_class, } )}

diff --git a/src/translations/en.json b/src/translations/en.json index b380e31eee48..11cb0a89d7c7 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -6961,25 +6961,26 @@ }, "no_state": { "title": "Entity has no state", - "info_text_1": "{name} has no state at the moment, if this is an orphaned entity, you may want to delete the long term statistics of it from your database.", + "info_text_1": "''{name}'' ({statistic_id}) has no state at the moment, if this is an orphaned entity, you may want to delete the long term statistics of it from your database.", "info_text_2": "Do you want to permanently delete the long term statistics of {statistic_id} from your database?" }, "entity_not_recorded": { "title": "Entity is not recorded", - "info_text_1": "State changes of {name} are not recorded, therefore, we cannot track long term statistics for it.", + "info_text_1": "State changes of ''{name}'' ({statistic_id}) are not recorded, therefore, we cannot track long term statistics for it.", "info_text_2": "You probably excluded this entity, or have just included some entities.", "info_text_3_link": "See the recorder documentation for more information." }, "entity_no_longer_recorded": { "title": "Entity is no longer recorded", - "info_text_1": "We have generated statistics for {name} in the past, but state changes of this entity are no longer recorded, therefore, we cannot track long term statistics for it anymore.", + "info_text_1": "We have generated statistics for ''{name}'' ({statistic_id}) in the past, but state changes of this entity are no longer recorded, therefore, we cannot track long term statistics for it anymore.", "info_text_2": "You probably excluded this entity, or have just included some entities.", "info_text_3_link": "See the recorder documentation for more information.", "info_text_4": "If you no longer wish to keep the long term statistics recorded in the past, you may delete them now." }, "unsupported_state_class": { "title": "Unsupported state class", - "info_text_1": "The state class of {name}, ''{state_class}'', is not supported.", + "info_text_1": "The state class of ''{name}'' ({statistic_id}), ''{state_class}'', is not supported.", + "info_text_1_no_state_class": "''{name}'' ({statistic_id}), has no state class.", "info_text_2": "Statistics cannot be generated until this entity has a supported state class.", "info_text_3": "If this state class was provided by an integration, this is a bug. Please report an issue.", "info_text_4": "If you have set this state class yourself, please correct it.", @@ -6992,7 +6993,7 @@ "update": "Update the unit of the historic statistic values from ''{metadata_unit}'' to ''{state_unit}'', without converting.", "clear": "Delete all old statistic data for this entity", "how_to_fix": "How do you want to fix this issue?", - "info_text_1": "The unit of {name} changed to ''{current_unit}'' which can't be converted to the previously stored unit, ''{previous_unit}''.", + "info_text_1": "The unit of ''{name}'' ({statistic_id}) changed to ''{current_unit}'' which can't be converted to the previously stored unit, ''{previous_unit}''.", "info_text_2": "If the historic statistic values have a wrong unit, you can update the units of the old values. The values will not be updated.", "info_text_3": "Otherwise you can choose to delete all historic statistic values, and start over." }, From a478c4b34a4a40c786434d3b107cf181851932c6 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 26 Sep 2024 17:21:23 +0200 Subject: [PATCH 2/2] revert state class check, as it will be solved in another way --- src/panels/developer-tools/statistics/fix-statistics.ts | 4 +--- src/translations/en.json | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/panels/developer-tools/statistics/fix-statistics.ts b/src/panels/developer-tools/statistics/fix-statistics.ts index 2046f32c5124..8dd140e718d7 100644 --- a/src/panels/developer-tools/statistics/fix-statistics.ts +++ b/src/panels/developer-tools/statistics/fix-statistics.ts @@ -109,9 +109,7 @@ export const fixStatisticsIssue = async ( "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.title" ), text: html`${localize( - issue.data.state_class - ? "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.info_text_1" - : "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.info_text_1_no_state_class", + "ui.panel.developer-tools.tabs.statistics.fix_issue.unsupported_state_class.info_text_1", { name: getStatisticLabel(hass, issue.data.statistic_id, undefined), statistic_id: issue.data.statistic_id, diff --git a/src/translations/en.json b/src/translations/en.json index 11cb0a89d7c7..a98734fc3e57 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -6980,7 +6980,6 @@ "unsupported_state_class": { "title": "Unsupported state class", "info_text_1": "The state class of ''{name}'' ({statistic_id}), ''{state_class}'', is not supported.", - "info_text_1_no_state_class": "''{name}'' ({statistic_id}), has no state class.", "info_text_2": "Statistics cannot be generated until this entity has a supported state class.", "info_text_3": "If this state class was provided by an integration, this is a bug. Please report an issue.", "info_text_4": "If you have set this state class yourself, please correct it.",