Google Maps Location Sharing - cookie problem starting 0.97.2

Home Assistant release with the issue: 0.97.2

Last working Home Assistant release (if known): 0.96.5

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io

Component/platform: Google Maps Location Sharing

Description of problem:

After a while, usually between 10 to 20 min the cookie gets invalid and if I restart HA I get the following error:

You have specified invalid login credentials. Please make sure you have saved your credentials in the following file: /config/.google_maps_location_sharing.cookies.myemail_gmail_com

Additional information:

Since the switch to 0.97.2 I have this problem. This is what I did.

I installed mapscookiegettercli and followed the instruction from here https://www.home-assistant.io/components/google_maps/#maps-cookie-getter
I run the tool on my windows 7 pc.
I got the location_sharing.cookies fine.

I then installed on my python instance on Windows 7 pc the locationsharinglib as suggested here https://locationsharinglib.readthedocs.io/en/latest/usage.html
So I checked that the cookie was ok. And it turn out fine, print(person) worked as expected.

Now I copied the file in HA directory and renamed the cookie.

Restarted HA.

It worked for a while (10 to 20min), but then after I restared HA they stopped working with the error message I posted.

I tested againg in my python environment and I got an error as well.

Am I doing something wrong, or there is some issue with Google unofficial API or something else?

Thanks for any help.

May be @costas can help on this.

The way your present things, I would be very suspicious about that reboot you mention.

It worked for a while (10 to 20min), but then after I restared HA they stopped working

If you move the cookie back to your workstation and try it out, does it work?

No, it does’t work anymore. So I guess it is ok that HA gives me an error.
But I thought that once I created a cookie with mapscookiegettercli, this cookie won’t expire.

Right now I restard HA for other reasons and suddenly Google Maps Location Sharing works with the same cookies that yesterday gave me error.

And it works also on my Windows 7 pc, outside HA.

That’s really weird.

similar for me, as of 0.98 maps device tracker stopped working.

Tried getting the new cookie but google account does not let me sign in using the selenium automator - something about “using a method that does not allow to keep account secure” … really hope to find an alternative to generate a cookie … any help would be appreciated, google_maps_tracker has been the most important device_tracker for my hass use.

My pr to use the latest locationsharinglib has just been merged into development branch.until it gets released please update to latest library version and use cookies.txt add-on in chrome to download your cookies after you authenticate in your google maps account and provide that file to the library. The latest version of the library supports text based cookies exported by add-ons.

How would I update the library version? Is it simply copying it into site-deps folder?

You need to specify the version in manifest.json of the component. Latest is 4.1.0

Depending on the traffic patterns you might get blocked by google with a captcha. If you try to access the same account from another pc in your network is might be identified as abusive network activity and you get into a window of blacklist with a captcha which of course you cannot see. I bet that that is what happened in your case since things started working again after some time.

Probably that is the case because lately I got captcha on my windows machine when I open Google Maps.

Thanks
Marco

Cool, I’d rather wait than have a patchy but working config for maps tracking. Thanks a lot @costas

Following this thread. Recently upgraded from a RPi3 -> Intel NUC - and even with copying the old cookies file over to the new setup - getting no updates. Had to go the OwnTracks route temporarily - but prefer the old Google Maps device trackers.

Fingers crossed this new version works easily - such a hassle. Thx @costas and will keep an eye out for the official update!

Maybe I am starting to become blind, but cannot find the manifest.json for the Location sharing component…

https://github.com/home-assistant/home-assistant/blob/3eb02c4b57f39ecd1fc353eba168fbbcd3194ea2/homeassistant/components/google_maps/manifest.json. That’s the file in github. In you local filesystem it should be in components, in google_maps.

But where would I find the components folder? Tried looking in the config directory and also did a full "find ./ -name “manifest.json” inside the homeassistant docker container, but only ones I get are the ones in my custom_components folder…

Hi, sorry for not getting back to you but I don’t actually know. I am still on version 0.57 so I hope someone Ehle can help with this so you can move forward.