Google Geocode Custom Component - GPS to Street Address

I just tried it without the api key and it worked first time. This will make a huge improvement to my component. I’m going to test it today and then upload it if it works as expected. Do you know what rate limits it has? How often do you query it with tasker?

I only use it once per day via Tasker for a “what state was I in that day” update to a google doc. (I live in 2 states and work in a 3rd - it’s complicated).

I found a few references to 15k calls for v2 and that it apparently uses cookies.

hi. will you make it as official component of HA? I tried making custom_components/sensor/google_geocode.py. but I get error al my sensors don’t show in front end… HA running on windows.

Is your custom components folder in the same folder as your configuration.yaml?

yes. its in same folder

When trying to integrate this a a new component will it be just that or will you integrate it as an attribute to the exsisting device fracker component?

Can you copy the error message you get from the error log and post it?

It integrates into home assistant as a new sensor. It does not add attributes to the existing device tracker.

Is it in this folder?

C:\Users\admin\AppData\Roaming.homeassistant\custom_components\sensor\google_geocode.py

I run home assistant on a raspberry pi. I would like to know if there is issues on windows.

yes.

C:\Users\admin\AppData\Roaming.homeassistant\custom_components\sensor\google_geocode.py

I’ll install home assistant on windows and test it out and see if I can work out why it’s not working. Has anyone else run into issues using google_geocode on windows?

Thanks for everything you rock.

Hey @michaelmcarthur this is some really great work!
However I have run into an issue. Anyone that is home shows up as expected at home, but I am getting an error for the people away.
2017-07-22 11:55:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.mom_geocode fails Traceback (most recent call last): File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state yield from self.hass.async_add_job(self.update) File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__ yield self # This tells Task to wait for completion. File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup value = future.result() File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result raise self._exception File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run result = self.fn(*self.args, **self.kwargs) File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 303, in wrapper result = method(*args, **kwargs) File "/home/homeassistant/.homeassistant/custom_components/sensor/google_geocode.py", line 112, in update street = decoded['results'][0]['address_components'][1]['long_name'] IndexError: list index out of range

Not sure what the error means but hope it helps make the component better.
Edit: Fixed by adding both to the options.

Hello I just try this and it’s giving me an error

File “/home/homeassistant/.homeassistant/custom_components/sensor/google_geocode.py”, line 92, in update
self._origin_entity_id
File “/home/homeassistant/.homeassistant/custom_components/sensor/google_geocode.py”, line 135, in _get_location_from_entity
_LOGGER.error(“Unable to find entity %s”, entity_id)
NameError: name ‘_LOGGER’ is not defined

Here is yaml config

sensor:

  • platform: yr

  • platform: google_geocode
    name: frank
    api_key: SECRET
    origin: device_tracker.mobile_phone
    options: both

@fvargasfrank Can you check what info your device tracker is showing in its attributes? If you could paste the results and remove the latitude and longitude numbers to protect your location.

removed everything and started from scratch. I succeeded in installing but it shows as unknown on the front end

@333ryan18 I just discovered that issue earlier today. It seams to be that the google response at times does not contain street information where I expect it to be. I’m going to write a function to take care of this tonight.

@ashfaaaa it takes 60 seconds to start the sensor then it changes from unknown to location. Give it 60 seconds then check the sensor and log

it’s been more than 10min still no update.

my config

  - platform: google_geocode
    name: Location
    api_key: xxxxx
    origin: device_tracker.ashu_ashu
    options: both

EDIT
I reached home and now it shows as home.

@ashfaaaa edit, glad you got it working .

I have put aside the next 3 hours to fix issues and add requests from users. Keep the ideas coming and I will see if I can add them.

2 Likes