Google Maps Device Tracking Setup?

That was it!
I’m sure I did that correct the first ten times or so, but I must have missed it at the last (at least what it feels like) 100 times

Spent hours (probably close to 10 hours) trying to get this to work. Followed the various suggestions provided by @Luu and other helpful members, but I’m still getting the ERROR :
[homeassistant.components.google_maps.device_tracker] The cookie file provided does not provide a valid session. Please create a new one and try again.

Per the Home Assistant definition, I use Home Assistant Supervised :
“If you installed Linux and then ran a script to install HA and have add-ons then you have #homeassistant_supervised

I run a Windows 10 box, with a Linux Mint VM. Home Assistant Supervised is installed in the Linux environment.

I’ve logged in to google.com, maps.google.com, google.ca with the newuser

I tried using Chrome and Firefox in both Windows 10 and Linux to create the cookie file.

My configuration.yaml and home-assistant.log file reside in the following path which I presume to be the configuration folder :
*\Home\User\docker\hassio\homeassistant*

The aforementioned path is where I save the renamed cookie file :
.google_maps_location_sharing.cookies.newuser_gmail_com
it should not be an issue with *.txt extension, as the file becomes hidden/invisible when copied to the configuration directory.

I used the following in my configuration.yaml file :
device_tracker:
-platform: google_maps
username: newuser

I’ve also tried : [email protected], newuser.google.com

Can anyone confirm whether they get the same error message, if they simply delete the cookie file, but keep the device_tracker in the configuration file.

Any other suggestions on how to troubleshoot this item would be greatly appreciated.

Thanks

I don’t use this platform but if you have the .txt on a filename and whatever interfaces with it is not looking for text files, you will have problems. Even if it’s hidden, the file in question will be filtered by the wildcards provided by the software.

@petro thanks for your response. I was conscious of deleting the *.txt extension when renaming. I also do not see the *.txt extension on the file in Linux so it should be good I think. That said - i’m not sure if HA is even seeing the file to begin with, since I get the same error message when I delete the cookie file.

This is what my cookie looks like - I’m wondering if there should be a reference to maps.google.com anywhere.

image

The file looks correct.

I also had lots of problem and spent probably more time than you have. (same error message)
I finally got it working and it was the .txt that was there. That perhaps not your issue but perhaps encoding?
Try and create a new file in Configuator and copy paste the cookie details in it.

But at the end. I’m not sure it was worth it.
The GPS positioning is slow and inaccurate.
When I’m home it often shows about 400-700 m wrong but the HA companion app is within 10 m.

@Hellis81 thanks for your confirmation. Can you clarify what Configurator and where to find it. I’ll give your suggestion a try. My HA Companion app lags terribly unfortunately - which is why I’m looking to try this - since it is running in the background on the phone. The HA app is very slow - it will be running and refreshed on an LTE connection, yet it will still report in Home Assistant that the device is running on Wifi. The tracking is equally bad.

Edit : found it - turned out to be called File Editor in my Supervisor setup. Pasted the contents from that cookie, and named it

.google_maps_location_sharing.cookies.newuser_gmail_com

It saves directly into the path : \Home\User\docker\hassio\homeassistant

Unfortunately, the same error. I can’t help but feel like it’s not seeing the file.

Your cookie is ok. Wondering if the location of the file is correct, must be on same location as configuration.yaml file. My file is inside homeassistant\config folder

@Luu thanks for confirming as well. I added a config folder and placed the cookie file in there as well. Same issue.

Perhaps this is an issue with using Home Assistant Supervisor, I’m hoping others with the same setup can chime in.

Thanks

This is my Google maps tracker, distance from home.

This is HA companion app.

Although they are similar look at the details in the app vs Google maps.
It’s as if Google only updated once or twice during my drive today.
Also I did not drive somewhere, go back home and drive away again as Google believes. HA app is correct.
Same thing at about 14-16 today, you notice more of the walk.

Very rarely do I get better result on Google maps.

@Hellis81 thanks for sharing your experience with this Tracker. I’ve honestly, spent way too much time on this. If the performance is going to be disappointing as you’ve noted, then I best look for another solution. Other users have found success with Owntracks, GPSLogger, and Life360. I guess I’ll give one of those a try - although I was hoping to avoid installing yet another app on the phone.

While I gave up trying to get this to work for me, this turned out to be a blessing in disguise. Life360 was super easy to setup and so far seems quite responsive to location changes. It also has fantastic metrics you can access like address, driving status, speed, wifi, battery, etc. These can be useful for automations. I’m not trying to convert others from Google Maps, but want to offer an alternative to those who have had the same difficulties I experienced trying to get it setup.

Check out DrZzs great video on how to integrate
https://www.youtube.com/watch?v=lPDpd5OcisM

Just to show you more of a normal day.
Here is a typical day for me as being home with the little one.
Leave home at about 9 in the morning to drop if my son at preschool and then go back at 14 to pick him up.
See the difference…

Also notice the scale is different. Google believes I was up to 900-ish meters away where as HA says about 400 meters

@Hellis81 - thanks for the update. Curious - is that distance view something you setup? I’m still pretty new to HA, so I don’t really know where to find everything just yet. I’ll do the same comparison between HA Companion and Life360.

I use the sensor places.

It gives you an attribute of distance from “zone”.
And the Google maps does the same so I just compare the two.

I really like this places thing since it gives so much information.

Then I use a template sensor to extract the attribute to a state which I could display and track.

1 Like

@Hellis81 - Thanks for the tip. It’s exactly what I needed too - as I was looking at the Google Geocode option - but was a pain to setup since you needed to signup to get an api. Will setup and report back my findings :slight_smile:

@Hellis81 - did test and can confirm both HA tracking and Life360 were both decent.

Home Assistant

Life360

The Life360 is super accurate. It shows a slight dip at 9pm, because I was test driving my dad’s vehicle after completing a repair.

In any case-I’m happy with the setup and can comfortably start some automations based on my locations now. Thanks for your help.

I believe you are comparing apples and oranges.
The scale of the HA app is in kilometers, life360 is in meters.
HA app can only show 1, 2, 3 and so on where as life360 has a much finer scale.

Try and use the meter attribute for HA also and see what you get.
I’m quite sure that is an option in the reverse places sensor.

But how often does life360 update?
If you look at the values on the graph how many minutes apart are the values?

Hi @Hellis81 - I can adjust the measurement to km for Life360 and retest. However, the big drop in the HA result would point to missing data points.

Life360 polls every 12sec by default - but can be changed in the configuration. That said, it is known fir very good battery life for how frequent it polls. I used it all day - and it used 8% of my battery. I’m still at 40% and its almost bed time.

I was more thinking that you could change HA to meter.

I have that attribute in reverse places sensor.
Comparing two distances in km will be accurate. Even google maps might be correct then…

BTW. Life360 is a paid service. and Google is going to 2FA. All i want for xmas is a way to “automatically” add HA location at my current location