From c76b2fb357fa97e8def1841af52de5048bcb8b33 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 21 Aug 2023 13:22:01 +0200 Subject: [PATCH] Fix reselecting forecast type in weather forecast card editor (#17652) Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com> Co-authored-by: Bram Kragten --- .../config-elements/hui-weather-forecast-card-editor.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts index 0f48a3b1dc..a8b9442e19 100644 --- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts @@ -58,6 +58,7 @@ export class HuiWeatherForecastCardEditor } if ( !config.forecast_type || + (config.forecast_type === "legacy" && this._modernForecastSupported()) || !this._forecastSupported(config.forecast_type) ) { let forecastType: string | undefined; @@ -114,6 +115,14 @@ export class HuiWeatherForecastCardEditor return false; } + private _modernForecastSupported(): boolean { + return ( + this._forecastSupported("daily") || + this._forecastSupported("hourly") || + this._forecastSupported("twice_daily") + ); + } + private _schema = memoizeOne( ( localize: LocalizeFunc,