Google Maps location sharing

These are my errors trying to setup the location sharing with a second account ( no 2fa)

2018-04-18 12:29:54 ERROR (SyncWorker_12) [locationsharinglib.Service] Caught exception
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 284, in _get_data
    people = [Person(info) for info in output[0]]
TypeError: 'NoneType' object is not iterable

No 2fa for me and getting similar error to others

Error setting up platform google_maps
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
    disc_info)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 36, in setup_scanner
    scanner = GoogleMapsScanner(hass, config, see)
  File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 55, in __init__
    self._update_info()
  File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 67, in _update_info
    for person in self.service.get_all_people():
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 292, in get_all_people
    return self._get_data()
  File "/usr/local/lib/python3.6/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 283, in _get_data
    output = json.loads(response.text.split("'", 1)[1])
  File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/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)

I have a ā€œdummyā€ account setup that I am sharing my location with. This worked initially.

Also of note, this works with the older custom_component gplus.py

Hello everyone.

Yesterday, I upgraded HA and found iut about this. I created the dummy account and, after a first reboot, granted permission from my google account. IĀ“m running HA on a virtual machine running Lubuntu (working flawlessly), but IĀ“m getting the error message:

2018-04-19 18:51:00 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 54, in __init__
    hass.config.path(CREDENTIALS_FILE))
  File "/home/tito/.homeassistant/deps/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 184, in __init__
    if cookies_file and self._validate_cookie(cookies_file):
  File "/home/tito/.homeassistant/deps/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 209, in _validate_cookie
    raise InvalidCookies(message)
locationsharinglib.locationsharinglibexceptions.InvalidCookies: The cookies provided do not provide a valid session.Please authenticate normally and save a valid session again

I erased google_maps.py, only to find out it was the component file. So IĀ“m not sure what to do next to erase the infamous cookie. Any help is welcome.

Issues here too. Hassbian, 0.67 installed, using my secrets file to pass the username/password into the google_maps component.

My error, repeated over and over again (in and amongst my various Platform cast not ready yet PITA messages) is (eg):

2018-04-19 22:27:22 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/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.5/site-packages/locationsharinglib/locationsharinglib.py", line 292, in get_all_people
    return self._get_data()
  File "/srv/homeassistant/lib/python3.5/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 283, in _get_data
    output = json.loads(response.text.split("'", 1)[1])
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/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, you know, reading the last 50 or so posts: https://www.google.com/maps/preview/locationsharing/read goes only to the same ā€œBad Request Error 400ā€ page for me. I do not have TOTP enabled either.

Second Edit: Nuked everything and started from scratch (cookies file, etc.). Also enclosed my password in secrets.yaml in apostrophes (because I did have various symbols in it). That all seems to have fixed it.

Mine went down 13 hours ago. Refuses to update. Iā€™ve upgraded to 0.67.1 in a docker image and deleted the cookie file in my config directory. I get this:

Thu Apr 19 2018 22:29:50 GMT-0500 (Central Daylight Time)

Could not open pickle file, either file does not exist or no read access.

Followed by:

2018-04-19 22:32:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1524195147.1069007, level=ERROR, message=Caught exception, exception=Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 284, in _get_data
    people = [Person(info) for info in output[0]]
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 284, in <listcomp>
    people = [Person(info) for info in output[0]]
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 87, in __init__
    self._populate(data)
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 95, in _populate
    self._latitude = data[1][1][2]
TypeError: 'NoneType' object is not subscriptable
, source=/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py>

Hi everyone, sorry it has taken this long for me to help out, it has been a bit hectic. I have a new version of locationsharinglib v.1.2.2 with some added error handling so we can debug easier. Might I suggest we move the discussion about errors to the library https://github.com/costastf/locationsharinglib/issues so we can fix stuff? So please try out 1.2.2 and post issues on the library part until we iron them all out. Home assistant does not really have much to do with this so for anyone wanting to help troubleshoot this and fix it please use the library directly according to this documentation http://locationsharinglib.readthedocs.io/en/latest/usage.html .

There is also this branch https://github.com/costastf/locationsharinglib/tree/f-authenticate-interactively that deals with 2FA and if someone follows the discussion in https://github.com/costastf/locationsharinglib/issues/14 and can help out to have this fixed it would be great! Have a great weekend everyone!

I have merged the latest code in the 2FA branch and can validate that it works for me. People can use the cli.py on the root of the project to create their cookies. Please try out this latest code and report back issues on the issue tracker. If we get consensus that this code works for everybody, I will merge into master and make a new version of the library.

So I finally got this working this evening. It took me using my desktop which is Ubuntu installing the location sharing via pip and then running the cli.py to generate the cookie file. Once all of that was done nothing ever showed up in the conf file that it would create. On a whim I checked my known_devices file and low and behold at the bottom of the file was the maps entry. I then copied my mac address from my existing entry into that and all is right in the world. Thank you for doing this @costas I would rather use this over OwnTracks as would the Mrs.

I asked this elsewhere but suspect there is more likely to be someone here who knowsā€¦
I really like this and I too would prefer to use it than Owntracks but what about restricting use of the api key?

I have tried all sorts of formats, for example:

MY_DOMAIN.duckdns.org:8123/*
MY_DOMAIN.duckdns.org/*
MY_DOMAIN.duckdns.org

but all to no avail. Can someone point me in the right direction please?

IĀ“m sorry, IĀ“m all for helping out, but I donĀ“t have the slightest idea of what to do. How do I get to install all that??

You donā€™t need to install anything, you can just git clone that branch and then try out the usage documentation.

Iā€™ve tried to use the git release of the locationsharinglib and in homeassistant Iā€™ve got a new device_tracker

source_type: null
friendly_name: google maps 11824xxxxxxxxxxxxxxxxxX527
entity_picture: https://lh6.googleusercontent.com/-_xxxxxxxxxxxxxxxxxxxom8/photo.jpgsource_t

But there are no location information like latitude and longitude in that device_tracker

The state is always not_home.

Any hints?

OK. After uninstalling HA and locationsaringlib (LSL), wiping everything clean and reinstalling HA (a couple of times), it finally worked!

BUT, now IĀ“m getting an error message:

2018-04-23 12:55:41 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 67, in _update_info
    for person in self.service.get_all_people():
  File "/home/tito/.homeassistant/deps/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 292, in get_all_people
    return self._get_data()
  File "/home/tito/.homeassistant/deps/lib/python3.6/site-packages/cachetools/__init__.py", line 46, in wrapper
    v = func(*args, **kwargs)
  File "/home/tito/.homeassistant/deps/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 283, in _get_data
    output = 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)

I hope itĀ“s just a bug, everything seems to be working fine. IĀ“ll share 2 more locations this afternoon and report back.

Great work!

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.