Platform Legacy Error - Google Maps

Hi,

I ran a fresh install of Hassio today (0.94.1). Everything seems to have gone smoothly, however I seem to be having issues with the Google Maps Location Sharing Component.

I’ve used the component without issues for roughly a year. But now, the entity itself has not appeared and I am receiving the following error in the logs:

<><><>
Error setting up platform legacy
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py”, line 76, in async_setup_legacy
tracker.see, discovery_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/homeassistant/homeassistant/components/google_maps/device_tracker.py”, line 39, in setup_scanner
scanner = GoogleMapsScanner(hass, config, see)
File “/usr/src/homeassistant/homeassistant/components/google_maps/device_tracker.py”, line 60, in init
self._update_info()
File “/usr/src/homeassistant/homeassistant/components/google_maps/device_tracker.py”, line 72, in _update_info
for person in self.service.get_all_people():
File “/usr/local/lib/python3.7/site-packages/locationsharinglib/locationsharinglib.py”, line 439, in get_all_people
people = self.get_shared_people() + [self.get_authenticated_person()]
File “/usr/local/lib/python3.7/site-packages/locationsharinglib/locationsharinglib.py”, line 400, in get_shared_people
for info in output[0]:
TypeError: ‘NoneType’ object is not iterable
<><><>

configuration.yaml

device_tracker:
  - platform: google_maps
    username: [email protected]
    password: xxx

I’ve seen a few other posts about “platform legacy” errors since 0.94, but nothing specific to Google Maps.

Are there any steps I can take to bug-fix further? Thanks in advance!

I had the same error ans solved it by deleting the .google_maps_location_sharing.cookies.* and restart HA twice. The first time it complains it can not find the pickle file (the deleted file) and the 2nd time it worked again.
Hope this works for you too.
Marc

1 Like

Thanks for you reply. I gave that a try. Got the pickle file message after the restart - but after 2nd restart I was back to the above error message.

I have the same problem. I’ve restarted, removed the “cookies” file and the problem persists.

Fortunately for me, when I set up a fresh install, I also used a fresh SD card. Which meant I had the old SD card with the previous install still intact.

I fired up the old install, grabbed the cookies from there. Then copied them over on to the new install - and it just started working again.

Still not really sure why it didn’t work as expected after the new install. But hopefully if you have a copy of the old cookies somewhere you can try copying them over?

I switched to life360

Any update on a proper fix for this? I know it was an “unofficial” way of grabbing data, but it was still useful.
I have the exact same error lines as the OP and I have done this as a fresh install of HA (using HASS.IO). I do not have an old cookie file to use as a work around.

I think it is a very easy way to do presence detection. I can do this without any extra apps on my phones.

The authentication method used by google keeps changing and breaking locationsharinglib, which is the utility home assistant uses to grab the data from google.

@costas has (rightly) had enough of constantly trying to fix it and has produced another utility which allows you to authenticate manually, using a browser, and then creates the required cookie file which, once copied in to your config folder, allows it to work without having to re-authenticate.

YMMV but it worked for me. Have a look here -

I suspect you’ll need to regenerate the cookie periodically, but once everything’s setup it’s not much effort.

2 Likes

I am happy that things are working for people! The benefit from this method is that the account can have settings, like 2fa and the works because essentially it is a manual authentication and the user can go through everything. The cookie created should be working just fine. As mentioned it should be working with the existing version of HA but that still accepts username and password and will try to authenticate which will break for much of the world. So i think that next step is to bump the locationsharinglib dependency in the component and amend the documentation to mention the above process of retrieving the cookie with the extra tool. Any takers? If not, I will do it but it will be late July since I am going on vacation.

2 Likes

Please have a look at Google Maps Device Tracking Setup? for details.

Hi All
I have just completed a Full Reinstall of Hassio on New SD Cards and now setting up Life360 which was working perfectly fine on Old Install
Where is the Device trackers Gone?

Also Getting this error

Fri Jun 28 2019 08:55:59 GMT+1200 (NZST)
Error setting up platform legacy Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 76, in async_setup_legacy tracker.see, discovery_info) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/life360/device_tracker.py", line 298, in setup_scanner zones_from_places_interval() File "/config/custom_components/life360/device_tracker.py", line 288, in zones_from_places_interval zones_from_places(api, home_place_name, add_zones, zones) NameError: free variable 'api' referenced before assignment in enclosing scope

Please help, as I really like Life360 I HA and I works perfectly
Cheers all

I did this, and made it custom component. I looked at doing a pull request, but it’s a little daunting for someone new :slight_smile:

1 Like

Hi @dennyreiter, this is great! What did you find daunting to push this to the main line? Is anyone here that feels that he/she could help with this?

Inexperience and lack of time mostly :slight_smile: I intend on working on it. I’ve been trying to build the cookiegetter into a windows executable so it would be easier for people to fetch their cookie but have not succeeded as of yet. Thank you for this and making it possible!

1 Like

What do you mean “windows executable”? if you pip install mapscookiegettercli you will get an executable under your python installation Scripts directory which works just fine on windows just like in linux and Mac. Am I missing something?

No, not at all, I was just trying to make it easier for people who didn’t want to install a python environment on their Windows machine and didn’t have a gui on their linux machine.

I think that you could very easily make a portable exe of this with pyinstaller, not sure what method you are trying. As for the non gui part, it does not really make much sense since if there is no gui there is no browser so there is no interactive log in. Let me know if you need help with making it a windows executable with pyinstaller.

oh and by the way, the latest windows 10 version has python easily installable (finally!!) https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/

Watching this carefully as my Maps tracking has recently fallen over after a fresh install but am a little clueless reading the guides about how to get the new cookie file (I need an ELI5 - “Explain Like Im 5” version), a windows executable would be fantastic.

@dennyreiter - Is your custom component repository in the custom component store? (or whatever its called, I forget…) would be great to do this as then it’s not so life and death to get the pull request sorted as people can just install your component via the GUI?