Google Geocode Custom Component - GPS to Street Address

hello @michaelmcarthur i use maps distance matrix and already have api.
the api for to use your component is the same?

@Rodolfo_Vieira For ymy component it is not the same. You need to enable google geocoding API. You can do that here.

1 Like

hey guys i have two questions iā€™m using samba on hass.io
firstā€¦ i already have a www folder do i have to make another folder inside www call sensor and put the google_geocode.py inside?
secondā€¦ iā€™m using ios app with location enable do i need to use owntracks too?

I canā€™t answer your other question but homeassistant has a I cloud plugin that can track your iPhone location.

Hello friend.
You need do create other folder on the same place where is WWW not inside.
Create folder with name: custom_components after inside that other folder called sensor after inside that put .py

Soā€¦custom_components/sensor/ā€¦ .py

Yes you need use owntracks too or other tracker i use zanzito its very cool and powerful.

1 Like

that worked thank you

1 Like

I have no idea why I canā€™t get this to work. Iā€™m running hassio on a pi.

I downloaded the .py script and copied into the directory config/custom_components/sensor/google_geocode.py

I had to create the custom components and sensor folders myself. My current config.yaml shows like this:

I donā€™t get any errors. It simply just isnā€™t there. I checked the list of entities so that I can enable it in my default view, but Iā€™m not seeing anything.

There doesnā€™t appear to be an api_key there and it wonā€™t work without one I think?

Ahh OK! For some reason, I thought I read somewhere that an update had done away with the need for API keys. But I can certainly go ahead and get oneā€¦ Iā€™ll give that a shot!

So I enabled all the API components and copied in my API key. But it still isnā€™t showing upā€¦

Interestingly, it seems to stop ALL of my sensors from loading. Any ideas @michaelmcarthur ?

Adding pic:

I think you need a specific api_key for geocode and it will only work with geocode also is the tracker name correct?

I mean, I followed the link on the GitHub page for the api_key. The tracker name is correct, Iā€™m taking it from here:

Spelling error in my directory config ā€¦ rookie mistake :scream: ā€¦ Iā€™ve got it up and running now. The badge is showing, but no cardā€¦ I just added options and hit restart, Iā€™m assuming the card displays options?

OK I take it backā€¦ and apologize for spamming the forum! I have badges (also showing addresses etc.), but there is no card showing up in my default_view.

Glad you got it working. To show it as a card create a group and add the sensor. Most sensors show as badges on default unless you add them to a group.

Awesome. Got that up now! Iā€™m pretty new to HA (moving from ST for more local control). Iā€™m curious, how often does it check and update the address on the card? Is there a way to alter it?

I have built logic to determine when when it should update. If you are in a zone it will update when you enter the zone eg home, work. Then not update again until you leave the zone. Then it will check every 60 seconds if your gps coordonates have changed if they have it will update the sensor. You can force the sensor to update quicker by adding this line into your config. scan_interval: 30 This will update the sensor every 60 seconds. Just watch how quickly you update the sensor as you might hit googles usage limits if you run it too quickly or with multiple sensors.

1 Like

Thanks! This is awesome. Great work :slight_smile:

I wonder if itā€™s possible to also pull from the Google Places API and be able to include a place name if youā€™ve been somewhere for X amount of time, i.e. youā€™ve not moved in 5 minutes, pull from Places, return ā€œMcDonaldā€™sā€.

I have looked into it. It requires the places api to be turned on. My aim for this component is to make it easy to use. Ideally without the need for a api key. The non api basic configuration gives that end use. Iā€™m not ruling it out but I donā€™t have the time to develop the component at the moment. During the testing phase I did create a version on the component that uses openstreetmap. Their place info is very good. I still use it one my personal setup. I have not released it as itā€™s not as polished as the google Geocode component.

Thanks for your idea it might be something I will go back to when I have more time on my hands.

1 Like