From 41420c3af35ca24c418f6d336d2a15e042486f8d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 30 Jan 2023 13:34:35 -0600 Subject: [PATCH] Restore default hours to show on map card to 0 (#15220) * Restore default hours to show on map card to 0 fixes #15216 * tweak * always clear this._subscribed right away on unsub * adjust * merge from #15217 * merge from #15217 --- src/panels/lovelace/cards/hui-map-card.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/cards/hui-map-card.ts b/src/panels/lovelace/cards/hui-map-card.ts index 917b53e276..ad8ec6cc1d 100644 --- a/src/panels/lovelace/cards/hui-map-card.ts +++ b/src/panels/lovelace/cards/hui-map-card.ts @@ -40,7 +40,7 @@ import { formatTimeWeekday, } from "../../../common/datetime/format_time"; -const DEFAULT_HOURS_TO_SHOW = 24; +const DEFAULT_HOURS_TO_SHOW = 0; @customElement("hui-map-card") class HuiMapCard extends LitElement implements LovelaceCard { @property({ attribute: false }) public hass!: HomeAssistant; @@ -213,7 +213,7 @@ class HuiMapCard extends LitElement implements LovelaceCard { } this._stateHistory = combinedHistory; }, - this._config!.hours_to_show! || DEFAULT_HOURS_TO_SHOW, + this._config!.hours_to_show! ?? DEFAULT_HOURS_TO_SHOW, this._configEntities!, false, false @@ -341,7 +341,7 @@ class HuiMapCard extends LitElement implements LovelaceCard { const p = {} as HaMapPathPoint; p.point = [latitude, longitude] as LatLngTuple; const t = new Date(entityState.lu * 1000); - if (config.hours_to_show! || DEFAULT_HOURS_TO_SHOW > 144) { + if (config.hours_to_show! ?? DEFAULT_HOURS_TO_SHOW > 144) { // if showing > 6 days in the history trail, show the full // date and time p.tooltip = formatDateTime(t, this.hass.locale);