Google Maps location tracking - "Error setting up platform google_maps"

Hello - Google Maps location sharing working correctly, but has recently stopped. This might have coincided with updating to 80, but I’m unsure.

The log entry follows. Any advice appreciated.

2018-10-25 15:51:30 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 109, in _populate
    self._charging = data[13][0]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/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/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 46, in setup_scanner
    scanner = GoogleMapsScanner(hass, config, see)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 66, in __init__
    self._update_info()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 78, in _update_info
    for person in self.service.get_all_people():
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 459, in get_all_people
    people = self.get_shared_people() + [self.get_authenticated_person()]
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 451, in get_authenticated_person
    None,
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 95, in __init__
    self._populate(data)
  File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 113, in _populate
    raise InvalidData
locationsharinglib.locationsharinglibexceptions.InvalidData

there has been an error with the library for it, not sure if its related, but here in the github page,

It’s working again in the Beta 0.81.0b2 so just wait till the next update comes on the weekend.

Thanks, guys. I’ll try with the new release.

I updated my Home Assistant to 0.81.1 today and this was still failing. I ended up following the link that @Cee shared and updated the locationsharinglib.py script with lufton’s code and it worked. For those still having issues, here’s what I did:

  1. Changed the people variable in the get_all_people method as @insajd did. (Not sure if this is needed as I still saw errors after this)
    https://github.com/costastf/locationsharinglib/issues/42#issuecomment-431362416

  2. Replaced the _authenticate method with the code that lufton provided. (This gave me an error along the lines of saying Regex is not found.)
    https://github.com/costastf/locationsharinglib/issues/42#issuecomment-431195508

  3. I imported the Regex module in the locationsharinglib.py by adding import re to the the script

  4. Then I deleted the pycache directory in the locationsharinglib directory (/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib) and deleted the .google_maps_location_sharing.cookins file from the main home assistant directory

  5. Restarted Home Assistant and my device tracker started showing up.

2 Likes

I used this solution found here from lufton:
This worked first try for me, didnt even have to approve any logins in the Google Account (I should add that I am from Germany, because apparently there can be login issues depending on your location).

Great fix until the origianl component gets its proper fix

Hi,

I have a similar error: “TypeError: ‘NoneType’ object is not iterable”. I am running home-assistant 0.83.3 using Docker.

device_tracker:
  - platform: google_maps
    username: !secret google_gps_username
    password: !secret google_gps_password

I am using a google account without 2FA that can view the location of a couple of other google accounts. The /config/.google_maps_location_sharing.cookies was created, but no new devices were created in known_devices.yaml. Futhermore no new device appears in the Device Activity page.

 dec 09 11:23:15 nuc.bachstraat20 docker[13938]: 2018-12-09 11:23:15 INFO (MainThread) 
    [homeassistant.loader] Loaded device_tracker.google_maps from 
    homeassistant.components.device_tracker.google_maps
    dec 09 11:23:16 nuc.bachstraat20 docker[13938]: 2018-12-09 11:23:16 INFO (MainThread) 
    [homeassistant.components.device_tracker] Setting up device_tracker.google_maps
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]: 2018-12-09 11:23:17 DEBUG (SyncWorker_3) [locationsharinglib.Service] )]}'
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]: [null,null,"0ahUKEwjfquDkw5LfAhWQLVAKHWSsC0AQ8ZABCAE","Fe0MXJ_MCZDbwALk2K6ABA",null,null,"GgA\u003d",1800,1544350997170]
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]: 2018-12-09 11:23:17 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]: Traceback (most recent call last):
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:   File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:     disc_info)
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:   File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:     result = self.fn(*self.args, **self.kwargs)
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:   File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 46, in setup_scanner
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:     scanner = GoogleMapsScanner(hass, config, see)
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:   File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 66, in __init__
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:     self._update_info()
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:   File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 78, in _update_info
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:     for person in self.service.get_all_people():
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:   File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 465, in get_all_people
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:     people = self.get_shared_people() + [self.get_authenticated_person()]
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:   File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 426, in get_shared_people
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]:     for info in output[0]:
    dec 09 11:23:17 nuc.bachstraat20 docker[13938]: TypeError: 'NoneType' object is not iterable

According other post this issue would be already resolved within a previous version of home-assistant, using a newer version of locationsharinglib. HA 0.83.3 seems to use locationsharinglib version 3.0.8 (locationsharinglib version 3.0.9 was release 4 days ago.).

[root@nuc config]# docker exec -it  656ca4f5c86b cat /usr/src/app/homeassistant/components/device_tracker/google_maps.py | grep locationsharinglib==
REQUIREMENTS = ['locationsharinglib==3.0.8']

Is there any way how I can resolve this issue? Your help is very much appreciated!

Regards,

Ted

This guys here seems to be providing a solution, but i cant really follow what i need to do.

Can anyone explain in plain noob english? :slight_smile:

edit: Here is the (temporary) fix, as posted above, worked for me

I also managed to fix it using this work-around: https://github.com/costastf/locationsharinglib/issues/42#issuecomment-439731010

I performed these steps:

  • Remove the .google_maps_location_sharing.cookies file from the config directory.
  • Download custom_components.zip.
  • Unzip the file contents in the config directory as below:
../config/custom_components/device_tracker/__pycache__/google_maps.cpython-36.pyc
../config/custom_components/device_tracker/__pycache__/locationsharinglib.cpython-36.pyc
  • restarted home-assistant and it worked!
1 Like

Thanks it worked for me.I am running hassio 0.81.6

custom_components.zip worked for me, but I didn’t unpacked it to /config/custom_components/device_tracker/__pycache___/ directory as the *.pyc files, just unzipped all to /config/custom_components/device_tracker/ and that’s it.

but I’ve got another question:
devices found by google maps are added to known_devices.yaml as google_maps_<21-numbers-long-id>, and following that, I need to use it as device_tracker.google_maps_<21-numbers-long-id> in my automations. is there any way to make an alias so automations/scripts could “see” it as for example: device_tracker.wife_google_maps_location?

I tried adding the “name” attribute but it isn’t working unfortunately.

1 Like

Also the custom component seem to not work anymore?

a good evening i have some problems
my google maps doesnt work i installed my hassio tottaly new or a fresh start but now google maps doesnt work any more
the cookie file dosnt excist (i cant see him)
how i ca i solve it
pls help

2019-01-15 22:16:25 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py”, line 183, 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/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py”, line 46, in setup_scanner
scanner = GoogleMapsScanner(hass, config, see)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py”, line 66, in init
self._update_info()
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py”, line 78, in _update_info
for person in self.service.get_all_people():
File “/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 465, in get_all_people
people = self.get_shared_people() + [self.get_authenticated_person()]
File “/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 426, in get_shared_people
for info in output[0]:
TypeError: ‘NoneType’ object is not iterable

I can’t get it to work with HA 92.2 either. :frowning:
I copied the Custom Component into the directory config\custom_components\google_maps\ and renamed the google_maps.py files to device_tracker.py.
After that the cookie file is created, but I get the following error messages in the log:

2019-05-05 18:24:19 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 177, in async_setup_platform
    disc_info)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/google_maps/device_tracker.py", line 39, in setup_scanner
    scanner = GoogleMapsScanner(hass, config, see)
  File "/usr/src/app/homeassistant/components/google_maps/device_tracker.py", line 60, in __init__
    self._update_info()
  File "/usr/src/app/homeassistant/components/google_maps/device_tracker.py", line 72, in _update_info
    for person in self.service.get_all_people():
  File "/config/deps/lib/python3.7/site-packages/locationsharinglib/locationsharinglib.py", line 439, in get_all_people
    people = self.get_shared_people() + [self.get_authenticated_person()]
  File "/config/deps/lib/python3.7/site-packages/locationsharinglib/locationsharinglib.py", line 400, in get_shared_people
    for info in output[0]:

Without the Custom Component it doesn’t work either :frowning:

Have you found any solution? Mine too stopped working with the same error.

Hi @diogos88,

unfortunately not :frowning:
I have given up and switched to the life360 device tracker.
The only thing that’s a little annoying is that it’s an extra app on the phone.
Apart from that, it’s really very easy to configure and works perfectly for us so far. :slight_smile:

Check it out:

I also gave up with the Google Maps tracker. It just kept failing.

I decided that all I care about is knowing whether someone is home or not (not tracking all of the time). I just use the NMAP and Tado trackers. They’re working well. The upside is that there are no extra apps on the phone as I already have the Tado app for automatic heating control.

Be aware that this was once a custom component that has now been integrated into HA… You dont need to download anything. Just remove the files and configs you have made and follow this guide to make it work:

Thanks for the hint @argykaraz , but I know it’s an official component now. Unfortunately it doesn’t work for me. Nor with the official component neither with the custom hacks :wink:

2 Likes

Same for me.