From f7a67af71b626902ca35e6f986f38d62a2bb4b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Wed, 16 Jan 2019 23:01:49 +0100 Subject: [PATCH] Put geo_events on a map instead of an entities card. (#2489) --- src/panels/lovelace/cards/hui-map-card.js | 5 ++++- .../lovelace/common/generate-lovelace-config.ts | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/panels/lovelace/cards/hui-map-card.js b/src/panels/lovelace/cards/hui-map-card.js index a77a0afc01..a64eadd606 100644 --- a/src/panels/lovelace/cards/hui-map-card.js +++ b/src/panels/lovelace/cards/hui-map-card.js @@ -247,7 +247,10 @@ class HuiMapCard extends PolymerElement { const stateObj = this.hass.states[entityId]; if ( computeStateDomain(stateObj) === "geo_location" && - this._configGeoLocationSources.includes(stateObj.attributes.source) + (this._configGeoLocationSources.includes( + stateObj.attributes.source + ) || + this._configGeoLocationSources.includes("all")) ) { allEntities.push(entityId); } diff --git a/src/panels/lovelace/common/generate-lovelace-config.ts b/src/panels/lovelace/common/generate-lovelace-config.ts index dfc7989042..0ec77548ae 100644 --- a/src/panels/lovelace/common/generate-lovelace-config.ts +++ b/src/panels/lovelace/common/generate-lovelace-config.ts @@ -25,7 +25,11 @@ const DOMAINS_BADGES = [ "sun", "timer", ]; -const HIDE_DOMAIN = new Set(["persistent_notification", "configurator"]); +const HIDE_DOMAIN = new Set([ + "persistent_notification", + "configurator", + "geo_location", +]); const computeCards = ( states: Array<[string, HassEntity]>, @@ -243,6 +247,16 @@ export const generateLovelaceConfig = ( ) ); + // Add map of geo locations to default view if loaded + if (hass.config.components.includes("geo_location")) { + if (views[0] && views[0].cards) { + views[0].cards.push({ + type: "map", + geo_location_sources: ["all"], + }); + } + } + // Make sure we don't have Home as title and first tab. if (views.length > 1 && title === "Home") { title = "Home Assistant";