From b0984c0a0936c67434ec7c16df23cd321a4d6907 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 30 Sep 2022 08:54:38 +0000 Subject: [PATCH] Fire danger fix --- src/platinum-weather-card.ts | 8 ++++---- src/types.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platinum-weather-card.ts b/src/platinum-weather-card.ts index 246bc00..73c8f1e 100644 --- a/src/platinum-weather-card.ts +++ b/src/platinum-weather-card.ts @@ -778,7 +778,7 @@ export class PlatinumWeatherCard extends LitElement { start = this._config.entity_fire_danger_1 ? this._config.entity_fire_danger_1.match(/(\d+)(?!.*\d)/g) : false; var fireDanger: TemplateResult = html``; const fireDangerEntity = start && this._config.entity_fire_danger_1 ? this._config.entity_fire_danger_1.replace(/(\d+)(?!.*\d)/g, String(Number(start) + i)) : undefined; - if (start) { + if ((start) && (fireDangerEntity)) { var fireStyle = this._config.option_daily_color_fire_danger !== false && this.hass.states[fireDangerEntity].attributes.color_fill ? `background-color:${this.hass.states[fireDangerEntity].attributes.color_fill}; color:${this.hass.states[fireDangerEntity].attributes.color_text};` : ""; if (this._config.option_daily_color_fire_danger === false) { fireDanger = start && this.hass.states[fireDangerEntity].state !== 'unknown' ? html` @@ -1008,7 +1008,7 @@ export class PlatinumWeatherCard extends LitElement { case 'temp_maximums': return this.slotTempMaximums; case 'temp_minimums': return this.slotTempMinimums; case 'uv_summary': return this.slotUvSummary; - case 'fire_summary': return this.slotFireSummary; + case 'fire_danger': return this.slotFireDanger; case 'wind': return this.slotWind; case 'wind_kt': return this.slotWindKt; case 'visibility': return this.slotVisibility; @@ -1035,7 +1035,7 @@ export class PlatinumWeatherCard extends LitElement { case 'r1': return this.slotPopForecast; case 'r2': return this.slotHumidity; case 'r3': return this.slotUvSummary; - case 'r4': return this.slotFireSummary; + case 'r4': return this.slotFireDanger; case 'r5': return this.slotSunFollowing; case 'r6': return this.slotRemove; case 'r7': return this.slotRemove; @@ -1362,7 +1362,7 @@ export class PlatinumWeatherCard extends LitElement { `; } - get slotFireSummary(): TemplateResult { + get slotFireDanger(): TemplateResult { const entity = this._config.entity_fire_danger; const fire = entity ? this.hass.states[entity].state !== 'unknown' ? this._config.option_color_fire_danger === false ? this.hass.states[entity].state : this.hass.states[entity].state.toLocaleUpperCase() : "Not Applicable" : "---"; var fireStyle = entity && this._config.option_color_fire_danger !== false && this.hass.states[entity].attributes.color_fill ? `background-color:${this.hass.states[entity].attributes.color_fill}; color:${this.hass.states[entity].attributes.color_text};` : ""; diff --git a/src/types.ts b/src/types.ts index 5ff4b14..8291b92 100644 --- a/src/types.ts +++ b/src/types.ts @@ -75,7 +75,6 @@ export interface WeatherCardConfig extends LovelaceCardConfig { entity_observed_max?: string; entity_observed_min?: string; entity_fire_danger?: string; - entity_fire_danger_summary?: string; entity_pop?: string; entity_pos?: string; entity_sun?: string; @@ -104,6 +103,7 @@ export interface WeatherCardConfig extends LovelaceCardConfig { entity_forecast_min_1?: string; entity_forecast_max_1?: string; entity_extended_1?: string; + entity_fire_danger_1?: string; daily_forecast_layout?: layoutOrientation; daily_forecast_days?: layoutDays;