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

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.

Hello, I started having problem with google maps too. Does tado inform the battery in the phone?

I managed to take the newest version of locationsharinglib (4.0.1) and the google_maps component and make them into a custom component, that seems to be working so far:

1 Like

Sorry, only just saw your message. There’s no additional battery impact from what the Tado all would use otherwise. But, it will only say whether you are home–not where you are when you are not home.

perhaps i missed something there. the git you linked contains a package that overwrites device_tracker.py but doesn’t overload anything in the locationshareinglib. so in order for this to work i have to manually upgrade the locationshareinglib to 4.0.x first?

i tried the custom_component as-is, it did not work. error was “invalideuser: /config/.google_maps_location_shareing.cookies.myuser.” looks like it was trying to put the cookie file name to where the “username” is suppose to be, something is not quite right.

You want to put the whole gmaps folder in the custom_components subdirectory of your .homeassistant config directory. It should upgrade locationsharinglib to 4.0.1 when you restart.

/home/homeassistant/
├── .homeassistant
│   ├── custom_components
│   │   └── gmaps

You have to create the cookie yourself and put it in your config directory, naming it with the same username (slugified,) ie, if the account you use for the google maps user is [email protected], you would name the cookie

.google_maps_location_sharing.cookies.example_gmail_com

If you were previously using the google_maps component, that file should already exist and you can copy over it.