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.