Google device tracker and cookies

My google device trackers have stopped working after being fine for many, many months so I guess it is something to do with the recent changes and cookies?

However, I have searched the forum and read and re-read the docs but I cannot for the life of me work out the detail of what I have to do.

I have got the Chrome extension (cookies.txt) and exported my cookies but which one do I need??? I have hundreds!

The docs are incredibly vague saying simply…

Save the cookie file to your Home Assistant configuration directory

the cookie file” - not particularly informative…

:wink:

save the file in the /config directory
Rename it .google_maps_location_sharing.cookies.YOURMAIL_gmail_com

What?
The whole file?
I have hundreds of cookies in there.

Look at previous post.
Use firefox in private mode

I’m not ungrateful (on the contrary, I’m very grateful whenever anyone tries to help) but to install another browser just to get the cookie does seem a bit heavy handed!

I already installed Chrome purely because HA works better on it than it does on Edge. Stop laughing at the back, I am a very happy and satisfied Edge user.

In fact given the whole ethos of HA around privacy and data ownership I often find myself amused at how much of Google’s technology is used to support HA.

Indeed, one of the main selling point of Nabu Casa seems to be how it seamlessly integrates Google and Amazon services into HA. I’m not knocking it, it’s just that the irony amuses me.

But I digress…
Back to Google Location cookies… There must be a simpler solution?

sorry … I’m French and I had to use Google translation there :grin:
a simpler solution … sincerely I do not know :smile:

I installed firefox, recovered the file, and uninstalled firefox :grin:

However … Google, Nabucasa, ours phones …same war concerning privacy :joy:

2 Likes

Use chrome’s private mode?

However, not sure why you’d have hundreds of cookies. You need to be logged in to chrome as the user you set up to share locations with, not as your normal user. So, unless you use that account regularly it won’t have hundreds of cookies.

I tried that but I didn’t seem to be able to use the cookies.txt extension.

And yes, that is a fair point. As I said I only use that account for HA so for some reason I logged onto Chrome using that account to keep it separate form my MS account. I have clearly over time, drifted onto other websites too. I suppose I could simply clear my cache, logon to Google again and start from there. Seems sensible.

So, is it literally the cookie that appears when logging on to Google or is there a particular part of Google that needs to be visited/authenticated against?

Thanks.

I just went to the google maps page. There was still about 20 odd rows in the export file, which surprised me, but they all seemed to be google related.

Thanks.

I logged out of Chrome.
Deleted all cookies
Logged in to Google
Went to Google Maps
Downloaded my cookies
Renamed the file
Copied it to my config
Restarted HA

Still no luck with getting my Google location into HA though :frowning:

Any errors in the log?

That is basically what I did and it worked fine, but that’s not to say it will every time I restart … I’m not certain google always processes the log in the same.

No errors in the log.
Maybe I should try another restart?

I restart a lot though as I’m always tinkering so it’s not a great sign if it doesn’t always work.

Apparently you can set a Chrome extension to be allowed in an incognito window.

FWIW, the cookie file I downloaded is about 15 KB (as opposed to only 3 KB for the older, binary format), and has 70 lines. No idea which line(s) is/are necessary, so I just live with it. :slight_smile:

EDIT: I just tried downloading the cookies.txt file from an incognito window and got pretty much the same file. Details are a bit different, but about the same size.

Well that’s interesting… I restarted and got this

The cookie file provided does not provide a valid session. Please create another one and try again.

I’ll do as it tells me and create a new one…

Do I just have to log on to Google?
Literally just go to google.com, logon on and go to google maps and then download the cookies?

I just go directly to the Google Maps site, log in with the account I want to use in HA, click on the cookies.txt icon in the top-right corner, then click on the link in the window that pops up that says “To download cookies for this tab click here”.

1 Like

Thnaks.
I found out how to enable the extension in incognito mode.
So I did pretty much as you described except I did log on to Google before going to Google Maps.

My cookies file is only 1KB and appears to only have two cookies in it.

But…
I got that error message again.

I’ll give it another try…

Personally I’ve had a heck of a time with this as well.

  • Currently I have a separate Google account created and share each my own and my wife’s location with this account (worth noting I do NOT have 2FA on this account - and further that this is the account I’ve setup in configuration.yaml)
  • I downloaded a copy of firefox and installed the cookie getter extension (per instructions here: https://www.home-assistant.io/components/google_maps/ )
  • I logged into google w/ the ‘separate’ google account and went to maps.google.com in Firefox.
  • I then used the extension to download the ‘google.com’ cookies.
  • I then saved this file per the instructions and copied into my config directory on my NUC running HA
  • I then rebooted and it came back ok

Fingers crossed that 1) this keeps working for me and 2) that it works for you too!

6 Likes

Not sure incognito mode is a good thing to use here. By definition, doesn’t that prevent the creation of cookies (so nothing useful to save to the file)??? I’m no browser expert, but it just seems that’s not going to get you what you want.