From dac1d76bd236559bd3e13e8ba43f13423fa595ea Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 2 Aug 2022 13:12:05 +0200 Subject: [PATCH] Offer to remove statistics for entities with unsupported state class (#13325) --- .../statistics/developer-tools-statistics.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/panels/developer-tools/statistics/developer-tools-statistics.ts b/src/panels/developer-tools/statistics/developer-tools-statistics.ts index c4f8651ac7..2578afc377 100644 --- a/src/panels/developer-tools/statistics/developer-tools-statistics.ts +++ b/src/panels/developer-tools/statistics/developer-tools-statistics.ts @@ -281,7 +281,7 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { }); break; case "unsupported_state_class": - showAlertDialog(this, { + showConfirmationDialog(this, { title: "Unsupported state class", text: html`The state class of this entity, ${issue.data.state_class} is not supported.
Statistics can not be generated until this @@ -296,7 +296,15 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { rel="noreferrer noopener" > developer documentation.`, + >. If the state class has permanently changed, you may want to + remove the long term statistics of it from your database.

Do + you want to permanently remove the long term statistics of + ${issue.data.statistic_id} from your database?`, + confirmText: this.hass.localize("ui.common.remove"), + confirm: async () => { + await clearStatistics(this.hass, [issue.data.statistic_id]); + this._validateStatistics(); + }, }); break; case "unsupported_unit_metadata":