Put geo_events on a map instead of an entities card. (#2489)

This commit is contained in:
Thomas Lovén 2019-01-16 23:01:49 +01:00 committed by Paulus Schoutsen
parent 41554ab14d
commit f7a67af71b
2 changed files with 19 additions and 2 deletions

View File

@ -247,7 +247,10 @@ class HuiMapCard extends PolymerElement {
const stateObj = this.hass.states[entityId]; const stateObj = this.hass.states[entityId];
if ( if (
computeStateDomain(stateObj) === "geo_location" && computeStateDomain(stateObj) === "geo_location" &&
this._configGeoLocationSources.includes(stateObj.attributes.source) (this._configGeoLocationSources.includes(
stateObj.attributes.source
) ||
this._configGeoLocationSources.includes("all"))
) { ) {
allEntities.push(entityId); allEntities.push(entityId);
} }

View File

@ -25,7 +25,11 @@ const DOMAINS_BADGES = [
"sun", "sun",
"timer", "timer",
]; ];
const HIDE_DOMAIN = new Set(["persistent_notification", "configurator"]); const HIDE_DOMAIN = new Set([
"persistent_notification",
"configurator",
"geo_location",
]);
const computeCards = ( const computeCards = (
states: Array<[string, HassEntity]>, 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. // Make sure we don't have Home as title and first tab.
if (views.length > 1 && title === "Home") { if (views.length > 1 && title === "Home") {
title = "Home Assistant"; title = "Home Assistant";