I tried exactly these steps (only exception is that I did it on python 3.4 on Windows).
Used mapscookiegettercli 0.2.0 and latest firefox. It logs in and saves cookie. Renamed cookie to the same name the locationsharinglib tried to create (.google_maps_location_sharing.cookies.myusername_gmail_com) and uploaded it to the config folder on my Pi. Rebooted HomeAssistant and still got:
locationsharinglib.locationsharinglibexceptions.InvalidCookies: The cookies provided do not provide a valid session.Please authenticate normally and save a valid session again
mapscookiegettercli worked for me just fine. i had it running with chrome in the base Ubuntu18 VM hosting hassio itself. I tied the latest update as well unfortunately the cookie it produced was still not working with hassio.
as far as testing locationsharinglib by itself, i got the package and can setup the virtual environment for it. but i don’t know enough about how to run the module as a standalone and to pass in the cookie created by mapscookiegettercli. the usage page doesn’t say anything about standalone usage, just how to set it up the dev environment.
you are not alone. it does not work for me either. are you using hassio? i have a feeling everyone who got it working were using other flavors of hass instead of hassio. at least i haven’t seen any specific mentioning of it working under hass.io. i am going to try it under a fresh hass docker image see if it works better from there.
pulled latest official homeassitant docker image from the hub. added google_maps into configuration with no change to anything else… did not work. same set of errors as hassio. used the mapgettercli to create a cookie… no go. same errors.
what version of hassio are you on and what hardware? did you have to do anything with the locationsharinglib such as custom_module override or upgrade it to the latest (4.0.1 i think)? did you have to use the mapscookiegettercli to create the cookie?
See inline :
what version of hassio are you on and what hardware? Raspberry PI, version 0.94.3 did you have to do anything with the locationsharinglib such as custom_module override or upgrade it to the latest (4.0.1 i think)? No did you have to use the mapscookiegettercli to create the cookie? Yes
Thanks! the only difference is the hardware then… i might have to try it on a pi just to see it working SOMEWHERE. although i have a feeling hardware might not be the cause…
Like @eggman I also am running in docker with 94.4 and I’ve ran the script to get me the cookies but HASS keeps complaining that the cookies are not valid. Sad panda
This worked like a charm! Ran it on Windows, renamed the cookie file and transferred it to my NUC running Homeassistant in Docker. After a reboot data started flowing in again
Is there any solution to getting this cookie file from a headless linux installation? I tried to run the maps-cookie-getter, and although firefix happens to be installed, there is no GUI, so selenium barfs while trying to launch it.
I installed the cookie getter on a machine with a gui and was successful getting the cookie, but it still failed on my homeassistant machine. I installed locationsharinglib on the GUI machine and it succeeds, returning the locations of the linked account.
Now I’m struggling with how to upgrade locationsharinglib on HA. Every time I restart HA, it reinstalls 3.0.11. I didn’t see anything in the Pipfile about it, but I have to admit, I’m pretty inexperienced with Pip.
OK , found where to make it install and use 4.0.1. Change the manifest.json file in lib/python3.6/site-packages/homeassistant/components/google_maps to 4.0.1.
Now I succeed using the example code from USAGE, but it still fails in HA
2019-07-03 13:11:19 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy
Traceback (most recent call last):
File "/home/denny/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/setup.py", line 76, in async_set
up_legacy
tracker.see, discovery_info)
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/denny/homeassistant/lib/python3.6/site-packages/homeassistant/components/google_maps/device_tracker.py", line 39, in set
up_scanner
scanner = GoogleMapsScanner(hass, config, see)
File "/home/denny/homeassistant/lib/python3.6/site-packages/homeassistant/components/google_maps/device_tracker.py", line 49, in __i
nit__
from locationsharinglib.locationsharinglibexceptions import InvalidUser
ImportError: cannot import name 'InvalidUser'
The only other thing I can think of is I am not using a gmail.com account but a GSuite account.
Set up a gmail account, got the cookie, and it works with the standalone locationsharinglib, but still get Invalid User in HA. Not that I know what I’m looking for, but diving deeper