Google Maps location sharing

You are using an older version of the library. You need to update the version in your component to the latest one which is currently 1.2.2

Apologies, I just realized that I hadn’t uploaded the latest version because I was waiting feedback on the 2fa feature and was hoping to merge that to this version. I just uploaded 1.2.2 that should fix some error issues in the logs while I am waiting feedback on 2fa from people.

Are you saying the app password method worked or didn’t work?

Do I have to turn on Allow less secure apps in my home assistant’s google account under Apps with account access if I’m not using 2FA?

I´m going to ask a very basic/silly question: If I´m using an installed version (not git clone one), how do I get to update only the component through git pull?

Sorry for my newbysness

You can clone that branch anywhere and use the cli.py to get the cookies file. Effectively you don’t have to update the component, you just need to have access to that branch so you can use the latest code to create the cookies. I hope that makes sense, if not let’s try to figure out what is confusing.

I’m able to hit https://www.google.com/maps/preview/locationsharing/read?authuser=0&hl=en&gl=en&pb=!1m7!8m6!1m3!1i14!2i8413!3i5385!2i6!3x4095!2m3!1e0!2sm!3i407105169!3m7!2sen!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e1!5m4!1e4!8m2!1e0!1e1!6m9!1e12!2i2!26m1!4b1!30m1!1f1.3953487873077393!39b1!44e1!50e0!23i4111425 locally and it downloads the file just fine.

I’ve disabled the owntracks device tracker and I have ddwrt and google_maps enabled. I’m no longer getting error messages with version 1.2.2 of the locationlib but nothing gets updated in home assistant.

What you are at home your position does not show up. If you go to devices in HA do you see your tracker?

I was able to get it working by following these instructions: Google Maps location sharing … Copying that cookie file worked.

It seems for whatever reason home-assistant isn’t able to log in properly. But if I do it manually as suggested in the linked I posted above by copying the cookie file over it works.

I’m using locationsharinglib version 1.2.2

how can I install 1.2.2? Sorry Noob and can not speak English

pip install -U locationsharinglib

Might I suggest someone with rights update the doc at https://www.home-assistant.io/components/device_tracker.google_maps/ with the following?

  • 2FA and Google App passwords don’t yet work with this service and the Google account used for tracking.

  • google_maps_location_sharing.conf doesn’t seem to be used now, but .google_maps_location_sharing.cookies does get created once the service successfully authenticates to Google.

  • Once the service is working, the device will be created in the known_devices.yaml file. You can change the “name:” field, but not the first field starting with “google_maps_”. If you do, that will break the device tracking and it will be recreated as a new device again.

Otherwise, I can confirm success with Hassio 1.3, Home Assistant 0.67.1, with 2FA off and using the Google password in the device tracker’s yaml file. Looks like I might need to add single quotes around my password to get it to work in my secrets file, according to a post I read above. Will have to test…

Thanks all for your hard work on this project! Very much appreciated!
Smoke.007

1 Like

anybody can update the docs :slight_smile: click on “edit this page in github” at the top right hand corner and add any edit you want and someone will come by and leave comments etc…

I did try that first, but the only option I could see to edit, was to “fork the project and edit the file”. I don’t see an option to just suggest an edit to the file. When I do that, I get the message, “You’re editing a file in a project you don’t have write access to. We’ve created a fork of this project for you to commit your proposed changes to. Submitting a change to this file will write it to a new branch in your fork, so you can send a pull request.” Is this really what I’m supposed to do?

Yup so basically your github account will create its own fork of the documentation, and it will also create a branch for you to do edits in. From there once you make your edits you submit the PR and fill out the form and all that. Then you will see your PR show up here:

Basically you are making the changes you want to suggest and if others agree they will merge it in or provide their own feedback for what you are trying to achieve. All your notes are to help the user so I don’t see any issue with it :slight_smile:

1 Like

one easy way to do it if you have ssh access to your home assistant

  1. Create a ssh tunnel from your laptop/desktop to home assistant machine ssh -D 8080 <HASS-HOSTNAME>
  2. Use SOCKS proxy in your browser as 127.0.0.1 port 8080.
  3. Login to the google account, pass captcha stuff, etc
  4. Restart home assistant
  5. Profit
1 Like

Thank you for the explanation!

Hello again.

Just updated Hassbian to 0.68. Seems to be getting locations correctly almost all he time, but keep getting errors:

2018-04-30 01:01:11 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
    disc_info)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/device_tracker/google_maps.py", line 36, in setup_scanner
    scanner = GoogleMapsScanner(hass, config, see)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/device_tracker/google_maps.py", line 55, in __init__
    self._update_info()
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/device_tracker/google_maps.py", line 68, in _update_info
    dev_id = 'google_maps_{0}'.format(slugify(person.id))
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/util/__init__.py", line 43, in slugify
    text = normalize('NFKD', text)
TypeError: normalize() argument 2 must be str, not None

Just as bug reporting. Thanks for your work.

I just reported the bug. If you were to report this 1 hour earlier i wont update… :cry:

https://github.com/home-assistant/home-assistant/issues/14177

I randomly started to get this error today. Not sure what changed but things were working fine on 0.68. I saw here it was suggested to update to 1.2.2 of the library but no dice.

This is the error I get:


Error setting up platform google_maps
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
    disc_info)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 36, in setup_scanner
    scanner = GoogleMapsScanner(hass, config, see)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 55, in __init__
    self._update_info()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 67, in _update_info
    for person in self.service.get_all_people():
  File "/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 324, in get_all_people
    people = self.get_shared_people() + [self.get_authenticated_person()]
  File "/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 291, in get_shared_people
    output = self._get_data()
  File "/srv/homeassistant/lib/python3.6/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 285, in _get_data
    return json.loads(response.text.split("'", 1)[1])
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```

EDIT: For anyone else getting this error, delete the cookies file and restart home assistant seems to have done the trick for me.