Google Geocode Custom Component - GPS to Street Address

question…

could you put groups into the sensor component? I put my device trackers in a group and when it updates, the group state updates to the current location. Will it take the group as an origin like this?

- platform: openstreetmap_geocode
  name: Stac using Group
  # api_key: !secret GOOGLE_API_STAC_ACCT
  origin: group.stac
  display_zone: show
  options: place

My component is a sensor which home assistant does not handle group state changes as it does a group of device trackers. It’s an issue how home assistant deals with groups.

ok thank you! this is a great component!

Hi, thanks for putting this together, was exactly what I was looking for.

but I am having an issue, all my sensors say;

This IP, site or mobile application is not authorized to use this API key. Request received from IP address xxx.xxx.xxx.xx, with empty referer

I have setup the key, and not put any restrictions on it, any idea why this is happening???

Thanks

It’s the first time I have seen that error. Thanks for pointing it out. Have a look at what services your Api key is authorised to use. This can be done in the google developer website. Make sure Geocoding API is turned on.

Ah, I took the other instructions too literally and only enabled the directions API!

Have enabled the geocoding api now, and it is working, though the address is a little off.

Thanks!

Thanks you so much for this component and the time you and other here put in it.

I have 2 device trackers that i added but for some reason only one shows the address for some reason.
I thought that one is not working always staying on awaiting update but after a restart i so that now that states reversed second one is displaying awaiting update an first one works fine.
I tried with one api and another without and i reversed and remained the same one will work another not.

Any suggestion is much appreciated
Thanks

It might be something to do with the device tracker. Can you check that the tracker has a lattitude and longitude value? This can be done by checking developer tools > states > click on device tracker.

1 Like

Hi Michael
Great work on developing this component. Hope it gets integrated into HA. Can one api key be used to track more than one device. If yes, would like an example on how to setup. What I setup is not working for all devices, works for one device.
Here is what is I did for one device and then copied for other device with their device tracker names. Device 1 updates with slight error showing my device is about 3-4 houses down the road. It is probably on how GPS is reading it, not a big deal. Other device just sits with “Awaiting Update”. My other nmap tracker, owntracks etc show all the devices with appropriate coordinates.

Device 1:

  • platform: google_geocode
    name: Device 1
    origin: device_tracker.device1
    options: street_number, street, city, state
    display_zone: hide
    api_key: xxxxxxxxxx

  • platform: google_geocode
    name: Device 2
    origin: device_tracker.device2
    options: street_number, street, city, state
    display_zone: hide
    api_key: xxxxxxxxxx

Suggestions?

What you are doing is correct. You can have two ore more sensors. You mentioned nmap device trackers. Nmap won’t work as it’s a router based tracker. What type of device tracker is the one that does not work?

I am using these trackers - Owntracks, nmap, homeassistant location updates to update the location. Dont know if anything else is available that is more reliable.

I use owntracks and find it very reliable. The home assistant tracker should also work.

I just found this and so far it’s been great! Only took a few minutes to add and get up and running, I am still testing but this it’s working great!

edit: one thing I’ve noticed is if you have to restart your HASS sometimes I get an error message that shows you’ve reached the free api limit but after a few restarts this error message goes away and works as it should.

Thanks!

1 Like

Thanks for sharing! Works for me!

I configured all following the guide on github, but after restarting HASS all my sensors disappeared from the frontend and also from the device tab…
I was forced to delete the platform adn restart HASS to have again all the sensors.
What happened?

It will be something to do with the format of the sensor.yaml. Double check how you have added the component to your yaml. Have a look at your error log it will give you a clue how to find the issue.

Sorry but it doesn’t work for me…
This is my entry in sensors.yaml:

- platform: google_geocode
  origin: device_tracker.xxxxxxxx
  name: Fha

And after 15 minutes i still have awaiting update

EDIT:

I tried also openstreetmap in this way:

- platform: openstreetmap_geocode
  origin: device_tracker.xxxxxxxxx
  name: Fha OS
  options: place

But with the same result…

Everything looks good. Stick with the google_geocode as the openstreetmap has not been fully tested. What kind of device tracker are you using? Also check if the device tracker has updated with new lat lon coordinates as if it has not updated Geocode won’t update.

I am using right now openstreetmap as config says my api key is invalid and really don’t know how to get one working. As device tracker i am using nmap. Still not having the sensors working…

And this is the screenshot of the sensors (i am using both the geocode ways)

nmap is a static device tracker it only shows when someone is in one location. You need to use owntracks or similar that updates location from a mobile device.