New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended map to support geo location entities #2337
Conversation
Hold on, I just realised that |
We have a map card. Why would you not at least add this source to the existing rather than copy all its code to a new file to add it? |
Sure, happy to do that as well. I'm just wondering how to untangle which config parameters are then required and which ones are optional: The default map requires How about: If |
…on entities vs defined entities
Alright, I merged the geo location code into the existing map. Sorry, accidentally closed the PR, reopened straight away... |
Geo location sources should probably be an array? |
Good point, because that would be the only way to join entities from different geo location platforms into one map. |
@@ -205,7 +222,24 @@ class HuiMapCard extends PolymerElement { | |||
} | |||
const mapItems = (this._mapItems = []); | |||
|
|||
this._configEntities.forEach((entity) => { | |||
var allEntities = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing use var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will replace with let
@@ -111,7 +111,24 @@ class HuiMapCard extends PolymerElement { | |||
throw new Error("Error in card configuration."); | |||
} | |||
|
|||
this._configEntities = processConfigEntities(config.entities); | |||
this._configGeoLocationSources = config.geo_location_sources; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't assign before raising errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, moving code around.
Do you want to submit a PR to add this functionality to a map demo ? |
Sure. I'll take a look at that now... |
Just a note @exxamalte, |
@exxamalte I cannot find any documentation for this. Do you have something prepared, or should I add it when I'm documenting #2489 ? |
@thomasloven The documentation for this PR can be found here: home-assistant/home-assistant.io#7880 |
This is an extension to the lovelace map card that can not only display manually configured entities, but allows for configuring a
geo_location_sources
array; each geo location platform defines its source. All current geo location entities with that source will be displayed on the map automatically.Either
entities
orgeo_location_sources
is required; ifgeo_location_sources
is defined, thenentities
is optional.Sample card configuration:
Pull request in home-assistant.io: home-assistant/home-assistant.io#7880