Enhanced Google Maps Integration

I noticed that the integration was not working anymore, always showing everyone
not connected. So I deleted the integration, re-added it and created the new cookie file. It is updating now, but it doesn’t show any of my friends as entities anymore. If I let it create an entity for me, it works, showing my location. I also added another account with me in it and that works as well. However, my main account that should be able to see the people that are sharing with me doesn’t work. It works fine in Google, but this integration doesn’t find them anymore. V1.3.2

What version of HA Core are you using?

Have you enabled debug for the integration? If not, please do so.

With debug enabled for the integration, are there any log messages (ERROR, WARNING or DEBUG), that can shed any light?

Feel free to send me a PM or chat with details.

Version 2024.5.2 I turned on the debug. I will send you a PM.

Released 1.3.3

  • Fix config flow when cookies file expires by @pnbruckner in #32
  • Fix hassfest warning

Release 1.3.4b0
20241031 1.3.4

  • Add timeout to server requests. In some cases, it was possible for server requests to not finish and to hang forever. If this happens, the timeout should abort the request so the integration can retry.

Released 1.3.5b0

  • Use UTC datetimes internally to avoid DST → Standard Time issues
  • Use HA’s local time zone for last_seen instead of the OS’s time zone

any idea if this works for kids/supervised accounts? I can’t create a separate account because of that.

I don’t really know. All I can say is, if you can see another person’s location via Google Maps, then this integration should be able to see them, too. It basically pretends to be Google Maps.

I’ve been using this integration since around February and have been pretty pleased with it. Using version 1.3.4 and HA core 2024.10.4.

I’m using the “pers & alt accts” strategy. I’ve been paying attention the last few months and realized that the cookies for my pers account expire every 14 days like clockwork. The alt account cookies haven’t expired in many months. One thing worth noting in case it makes a difference is that my pers account is a “google apps for my domain” account, or whatever google is calling it these days. It is not a [email protected] account.

Any idea why I am having to refresh the cookies every 14 days? Perhaps the cookies on a personal domain acct aren’t as long-lived as a standard gmail acct?

Honestly, I have no idea. I also use the “pers & alt accts” strategy, but my personal account is a “regular” Google/gmail account (i.e., me @gmail.com.) I have not had the cookies expire. Currently, the cookies expiration date for both accounts are about two years from now.

Strange. I just checked the cookie expiration for my pers account that I renewed cookies for yesterday, and the integration says those cookies expire 400 days from when I generated them. I will see if I can get any other clues about why this cookie file keeps needing renewal every 14 days.

The expiration date the integration displays is based on the expiration dates of a few of the cookies it gets from the server. The server often updates these cookies (which you can see in debug log messages), and the integration saves the newer cookies (and their newer expiration dates) when received (which appears to happen about every 15 minutes.)

However, the server is free to decide when it no longer likes the “login” (expressed by those cookies.) This is why I came up with the procedures I did; i.e., to attempt to avoid “offending” the server and having it prematurely “log out” the “session.”

But since Google doesn’t document, or really support, any of this, there’s no way to really know what’s going on.

1 Like

Hello,

I found this integration by coincidence today. Great job!!

One question regarding Missing Data for Account Tracker: Is it possible to manually add a entity_picture for the account tracker?

  • Eg by manually changing some parameters within the integration config.
  • Alternatively, maybe via a helper device tracker which applies updates via an automation?

I had done this in the past by manually adding a picture attribute for the account entity to known_devices.yaml.

Check out:

Hi @pnbruckner

Thanks a lot for the unbelievably good add-on! If you can help me with an issue I have been facing for the last week or so, that’s great. For more than a week, the location of the account tracker (or the account owner) location is not reporting to HA. All other (location) shared accounts are working fine. I tried updating the cookies file using the Google Chrome method. No errors, but the location is not getting reported! There are no entries with the word “map” on the HA Log.
HA:
Core. 2024.12.5
Supervisor 2024.12.0
Operating System 14.1
Frontend 20241127.8
Google Maps: v 1.3.5

Thanks in advance!

What did you set max gps accuracy to?

I think 50m. I don’t know how to access the previous settings, and it’s currently showing 100m when I reconfigure, which I think is the default. I remember changing it to 50m.

The usual way. I.e., Settings → Devices & services → Google Maps → CONFIGURE.

If you see 100 when you click on the CONFIGURE button (and advance to the page with this setting), then that is the value it’s using.

In any case, the reason I ask is, sometimes people think that smaller is “better”, and set it very small. But that just rejects more updates. If it is set small enough, all updates will be rejected, and you won’t see any changes in the entities.

You can see if this is happening by enabling debug for the integration, then look in the full/raw log for Google Maps messages that say, “Ignoring …”.

Also check for any Google Maps messages (in the full/raw log, including debug messages) that might shed any light on why the account tracker entity isn’t updating.

Thanks. There are no entries with “Ignoring” in the Core raw log. I enabled debug logging for Maps, but even after that, I don’t see anything on the HA Core raw log other than my other entities getting reported as usual. There are no entries for my account.
I guess I am looking at the right place for debug logs for the Maps component!

Do you see any debug message containing the following string?

Missing location or other data for person

You should be looking either directly in the home-assistant.log file, or via Settings → System → Logs. In the three-dot menu, click on “Show raw logs”. Then, in the Search logs box, type: custom_components.google_maps

If you have debug properly enable for the integration, you should see at least a few messages. You may need to click the Refresh button.

Is there a device_tracker entity for the account (other than the entities for the people who have shared their location with this account)? If so, what is its state and attributes, especially the last_seen attribute?