Device Tracker, Best echange for Life360

That might be your problem. Shouldn’t it be .59kxxxxxxrxxx_gmail_com, ALL lower case? HA typically runs on Linux, and in Linux, filenames are case sensitive.

The K and R are uppercase for the account

Do I need to create another google account lower case only?

No, you just need to name the cookies file with all lower case letters. So:

.google_maps_location_sharing.cookies.59kxxxxxxrxxx_gmail_com
1 Like

Live and learn…A > a

Working fine now…

1 Like

Good points, I’ll try again without logging out and see if there is a checkbox.

Thanks Paul, All works now, I guess that was the trick. Didn’t see anything on staying logged in, but didn’t log out and I can see every status now, it’s pretty nice showing battery, address, if charging, lat/long etc.

I’ve found that “Get cookies.txt LOCALLY” (the extension the Google Maps doc page recommends for Chrome) also works on Microsoft Edge. I just gave it a try. It’s a bit easier to use than what I suggested above. Here is a procedure I wrote up for it (which is also a bit more detailed than the one above.)

  1. Install “Get cookies.txt LOCALLY” (https://chrome.google.com/webstore/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc)
    Note this works in Google Chrome and Microsoft Edge.
  2. Go to the extension’s details and turn on “Allow in inPrivate” or similar for Google Chrome.
  3. Open browser in incognito or inPrivate mode.
  4. Browse to www.google.com/maps.
  5. Click “Sign in” box in upper-right and follow the prompts.
  6. If an option named “Don’t ask again on this device” appears, check it.
  7. Open the “Get cookies.txt LOCALLY” extension. A window with all the cookies should appear.
  8. Make sure Export Format is set to Netscape.
  9. Click Export All Cookies.
  10. Find the downloaded cookies.txt file. Rename it per the HA Google Maps integration doc page. It should be .google_maps_location_sharing.cookies.SLUGIFIED_EMAIL_ADDRESS
    where SLUGIFIED_EMAIL_ADDRESS is the email address of the account “slugified.” Slugify basically means change all upper case letters to lower case, and change all characters that are not a letter or number to an underscore.
    E.g., if the email addres is [email protected], the resulting cookie file name would be: .google_maps_location_sharing.cookies.this_is_my_email_address_gmail_com Be careful that there is no file extension (such as .txt).
  11. Copy that cookie file to your Home Assistant configuration directory, which is typically /config, or wherever configuration.yaml is located.
  12. Close the browser, but do NOT log out.
  13. (Re)start HA.
3 Likes

@pnbruckner Thanks for your clear explanation.
Before trying this out, I first wanted to set up the actual sharing between my family members. Seems (if I’m not mistaken) that location sharing longer than 24 hours is only possible for people +18 years old.

Just found an integration Geofency but did not have time to try it yet.

I was using Life360 (which was working well for me at the time). I stopped using it based on their data practices. Switched to HA app tracking, it’s ok but no matter what settings I change on my phone, the location (sometimes) needs to phone awake to change. This for me is important for location based automations that require an update within 5 seconds or so.

So I thought I’d try the Google Maps method. I have tried numerous times, but cannot get at the stage where the known_devices yaml is created.

I have followed the instructions, but cannot figure out what is going on. I have created a fresh Gmail account for the integration and where other existing accounts connect to.

I can see the shared device account on Google Maps android app (signed in with the new account).

Take a look at the following. I’ve written some detailed instructions that have worked for others that had no luck previously getting it working. At some point I hope to update the official Google Maps integration documentation accordingly.

1 Like

Thanks, those are the instructions I previously found and believe to have followed. I’ve literally tried about 6-7 times, checking all configs, spellings, etc. Even tried to manually create the known devices yaml, but it doesn’t populate.

It’s the ‘new email account’, that should be the one logged on to, to extract the cookies info, right? I have an existing account which I shared the location of, to that new account.

Also in the configuration yaml, the email should be typed with regular characters and not slugified?

If you manually created a known_devices.yaml file in your configuration directory, then restarted HA, it should create restored entities for all the items in that file, assuming it is filled in correctly (and assuming the device_tracker component starts due to other configs.) FWIW, I wouldn’t recommend doing this. I don’t think it provides any useful data points.

Assuming you created a new Gmail (not just any email) account for the Google Maps integration, then yes, that is the account you need to get a cookies file for.

Correct, in the YAML config, use the exact email address. The Google Maps integration will slugify it to determine the name of the corresponding cookies file.

Hmm yes, I seem to be doing everything correctly.

The system logs don’t show anything. Is there anything that can be checked? If not, I’ll have to stick with the HA app for tracking for the time being.

Try turning on debug, then looking in the logs for anything from the google_maps integration:

logger:
  logs:
    homeassistant.components.google_maps: debug

I’m assuming you haven’t seen any errors or warnings?

Still no error showing.

Also tried using Chrome browser. Not tried Firefox yet.

Also look for debug messages. It could be rejecting location data for a couple of different reasons that is only indicated in debug messages.

FYI, debug messages don’t show up on the Settings → System → Logs page by default (even when they are enabled.) You have to click LOAD FULL LOGS. Then type google_maps into the “Search logs” box.

If that doesn’t tell you anything useful, then you could also enable debug for locationsharinglib. That normally outputs a LOT of messages.

logger:
  logs:
    locationsharinglib: debug
    homeassistant.components.google_maps: debug

Ok, so I think I finally have it working.

It seemed it was down to the sharing of location itself. Although I did check via Google Maps app (logged in with the new account) that I could see the shared one, I couldn’t actually see the same when I logged in via the browser. I go via a VPN device on my devices. I disabled that and tried again, this time the shared device was showing in the browser.

Ran the steps again and it seems to be working. Let’s hope it continues (and/or Google doesnt go the same way as Life360).

Thanks for the advice (and for the work on Life360)

Separately, is it possible to change the entity name to something more meaningful?

You can’t change the entity ID, but you can change the “friendly” name. To do that you need to edit known_devices.yaml (in the same directory as configuration.yaml.) On the next HA restart, you will see the updated name(s).

FWIW, I’ve started work on a major update of the Google Maps integration. No promises. I’ve had much simpler changes rejected, so…

5 Likes

Thanks for that.

There must be something on my phone that’s not waking the GPS on time. Even with the Google Maps integration, there’s a significant enough delay for automations not to work on time.

I have automations to trigger when arriving in the home zone - front lights etc. But barely triggers when I’ve already been on the driveway for 5-10 seconds (if at all) Even expanded the zone a little.

Anyway, I’ll see to post this as a separate issue as it’s not directly integration related per se.

I have been trying to get this working with no luck. I have tried both extensions in Edge and “Get cookies.txt LOCALLY” on chrome. Created a file with the name as noted in step 10 and placed it in config. None of the three seem to take. One quick question… Step 12 confuses me a little. Close the browser, but do NOT log out. Can you elaborate any?

My HA is on a different device. Am I not understanding correctly?