Lovelace map card not displaying geocoded entities

Hi all,

I decided to do a fresh install of home-assistant. Prior to this I had the Lovelace map card showing geocoded entities and history with no issues.

Now on my fresh install I can’t.

I have:

  • Remote control activated (Nabu Casa account)
  • Both the Android and iPhone companion apps installed and geocoding my location
  • Double checked the geocoding in the States tool
  • The mobile_app listed in configuration.yaml (using config: not default_config:)

The map card config is:

default_zoom: 15
entities:
  - entity: sensor.hilite_geocoded_location
  - entity: zone.home
geo_location_sources: []
hours_to_show: 24
title: My location
type: map

In my haste I guess I have missed something, but if anyone has any thoughts I’d like to hear them.

Thanks team.


Roland Hill

1 Like

Did you fix this?
I am having issues displaying geo locations also

1 Like

Any luck?, I have the same issue. Phone is sending location OK, but I can’t display it on map.

map needs entities with latitude and longitude attributes

Hi Petro, I’m using the sensor from Home Assistant app, I did enable it to send my geo location and when I look into that sensor data in Attributes there is Longitude and Latitude.

that’s interesting, my geocode location sensors do not have a latitude and longitude attribute. Can you post a screenshot of yours in the dev tools → states page? I’d be willing to bet that they do not have these attributes. The attribute needs to be exactly latitude and longitude and both has to have a value. It cannot be the location attribute with a comma separated list.

I had to redact some info :slight_smile: but the numbers are there
Capture

and is Latitude the same as latitude?

Well technically no, but how can I change it ? Seems to be hard coded on app side

You’ll have to make a template sensor from that using those attributes.

template:
- sensor:
  - name: xyz
    state: "{{ states('sensor.my_geocoded_location') }}"
    attributes:
      latitude: "{{ state_attr('sensor.my_geocoded_location', 'Latitude') }}"
      longitude: "{{ state_attr('sensor.my_geocoded_location', 'Longitude') }}"

then use that on your map

4 Likes

Thats fantastic, thanks 100x

no problem

I’m very new to HA and I’m having issue making a template sensor.

Do I put this in sensor.yaml?

template:

  • sensor:
    • name: xyz
      state: “{{ states(‘sensor.moto_g_power_geocoded_location’) }}”
      attributes:
      latitude:"{{ state_attr(‘sensor.moto_g_power_geocoded_location’, ‘Latitude’) }}"
      longitude:"{{ state_attr(‘sensor.moto_g_power_geocoded_location’, ‘Longitude’) }}"

Then, do I do with configuration.yaml?

Thanks for your help.

it goes in configuration.yaml, and it will only work if your geocoded entities have those attributes. For example, my geocoded entities have different attributes.

I’m sorry, I don’t quite understand what you said.
This is what shows up when I use the template under developer.

I think you should spend some more time learning what each keyword I said means. These are basic fundamentals of home assistant.

If you take the code I produced above, copy and paste them into configuration.yaml, then put your entity_id in the correct spots in the code, it should work. But this will only work if your geocoded entity has the attributes that are used in the code.

Basics fundamentals of home assistant is a cliff dive for some of us without the in depth programing background. I know the basics of C++ but I feel like I’m on a tricycle trying to learn the control of a SpaceX rocket.

Any further assistance or direction would be much appreciated.

1 Like

This is the result I get when I try to restart with above configuration.yaml

That’s not the code I posted, you altered it. Check my code against yours.

Sorry, here it is.