Hi,
I installed it the first day you published it, and as they say, no new good news. It works very well on my side.
Hi,
I installed it the first day you published it, and as they say, no new good news. It works very well on my side.
It has been working fine for me as well. I use it in conjunction with the HA mobile app, on both an iPhone and an Android phone.
The mobile app is faster than the google maps reporting by 4-10 seconds upon entering or leaving a zone. On Android, the mobile app is faster by 22-95 seconds. I’ve only looked at a few samples of either to compare. I have the update period in the google maps integration set to 20 seconds and GPS accuracy 100m.
The iPhone is being shared with my personal account which is then read into the integration. The Android is being shared with an alt account which is being read into another instance of the integration. Doesn’t seem like that would introduce any extra reporting delays between the two.
Working great!
Still working fine but the long update interval situation hasn’t gotten any better.
orange is Google maps, purple is the Mobile App and light blue is GPSLogger (yours).
those were all at city driving speeds. But it isn’t any much better at highway speeds tho.
(the big step change was a service issue for my phone so ignore that)
I did discover a potential issue this afternoon. My person.kap
entity toggled between home and away several times when I walked away from my house. person.kap
is defined by 3 entities - a WIFI access point reporting me connected or not, my HA app location, and my google maps location. It did not settle on ‘away’ until after the google maps entity finally reported me being away. Google maps was the last one to report, and it was in the 3 minutes between when the other 2 had decided I was away and when the google maps integration decided I was away that the person.kap
toggling happened. When I used to have Life360 in place of google maps, I didn’t get this toggling.
I see in messages above that you use last_seen
. Is it possible that this keeps triggering my person.kap
to update to home? Would using last_changed
prevent this?
I am having the issue where I am asked to reauthenticate the HA integration after a few hours of reinstalling the cookies text file. When loading the text file they have an expiry date of over 2 years. I must have missed something in the installation but can not identify what. Can anyone please assist.
What custom integration version are you using?
Exactly what errors do you get?
Can you enable debug and share any related DEBUG messages from the full log as well?
What “account strategy” are you using?
I may not be able to help much for a couple of days, but I’d be interested in getting more details about your situation because this seems to happen to some people and it’s not entirely clear (at least to me) why.
Thanks for coming back to me.
1.) Version is 1.0.0
2.) Reconfigure. (Discovered on Integration page)
3.) 2024-02-11 09:16:29.251 ERROR (MainThread) [custom_components.google_maps] Authentication failed while fetching Google Maps ([email protected]) data: InvalidCookies: Invalid session indicated
2024-02-11 09:16:29.252 DEBUG (MainThread) [custom_components.google_maps] Finished fetching Google Maps ([email protected]) data in 0.319 seconds (success: False)
4.) Pers & Alt accts
I can report that I tried all the three strategies mentioned in the github. I ended up with “Alt acct only”, by creating a dedicated account for sharing with, as
The toughest part as unexpectedly saving the cookie file, either the cookies wouldn’t show up in the extension or it didn’t save them sucessfully (Firefox on macos). Not sure what I did to finally manage it, somehow I did without changing any settings. I never touched that account since and it seems to work fine, for a week so far.
Other than that, the integration works fine, location update is very fast, setup is smooth. Thanks for that!
@dormani: I experienced that behaviour when using a second account that was used on multiple computers. It worked until somehow a new cookie file was created somewhere else. Using the old cookie file I used to initialize the setup didn’t work a secomnd time, it was rejected as invalid. Creating a new one worked for some hours, then it was back to step one. I suggest you try a dedicated account as I did.
FWIW, I’ve been using only my personal account with the integration for years and have never experienced this problem.
However, I’m told by the locationsharinglib author that Google behaves differently in different parts of the world, so he strongly suggests using a separate account only for the HA integration and have everyone share with that account (i.e., what I describe as the “Alt acct only” strategy.)
IMHO, the person integration does a lousy job of combining multiple tracker entities. I’ve never used it for that purpose. One of the main reasons it does a poor job is that it does NOT use a last_seen
attribute. The last_updated
state field can change when things besides location change (such as battery level, etc.) So just looking at that can definitely cause incorrect results.
You might want to take a look at my composite integration. You can use that to combine the various inputs, and then use the output of that as the input to the person entity.
Released 1.0.1
I have a potential solution to the long existing issue of cookies expiring. I think I found a way to save the updated cookies that the Google server sends back after (I think) every query.
The corresponding changes are currently available in a PR/branch. If anyone who knows how to use the branch would like to try the changes, I would appreciate some feedback.
It will overwrite the cookies file every 15 minutes & at HA shtudown, so that the next time HA (re)starts, it will use the updated cookies file. (And, of course, while running it is constantly using the updated cookies as they are received.) To test it out, you can see the expiration date of the main cookies by clicking on the CONFIGURE button (and then just closing the window.) Check it out when starting HA, then check it again after 15 minutes or so. You should see an updated expiration date.
If this all works, and works in all scenarios, then users should never see any errors about the cookies being expired.
I still have to play with it some more to get a better idea of when cookies are actually updated (and which ones.) From the very limited testing I did today I definitely got (& saved) new cookies. I’m just not sure how often the ones that really count are actually updated. Here’s hoping…
I’ve downloaded and installed it and it looks like it’s working as expected. The cookies file expiration date/time has changed on its own.
I made a couple more commits. Now it will only save cookies when they actually change (and still no more than every 15 minutes, and at shutdown.) Also, it will dump the cookies to the log in a DEBUG message at startup, and if the InvalidCookies exception is ever thrown. It only prints the names & expiration times of the cookies, not their values, etc. E.g.:
2024-02-17 16:51:29.796 DEBUG (SyncWorker_6) [custom_components.google_maps] [email protected]: cookies: SEARCH_SAMESITE: 2024-07-07 12:11:00-05:00, NID: 2024-07-10 12:05:29-05:00, __Secure-1PSIDTS: 2025-01-08 11:11:08-06:00, __Secure-3PSIDTS: 2025-01-08 11:11:08-06:00, SIDCC: 2025-02-16 16:51:29-06:00, __Secure-1PSIDCC: 2025-02-16 16:51:29-06:00, __Secure-3PSIDCC: 2025-02-16 16:51:29-06:00, APISID: 2026-02-16 14:05:01-06:00, HSID: 2026-02-16 14:05:01-06:00, SAPISID: 2026-02-16 14:05:01-06:00, SID: 2026-02-16 14:05:01-06:00, SSID: 2026-02-16 14:05:01-06:00, __Secure-1PAPISID: 2026-02-16 14:05:01-06:00, __Secure-1PSID: 2026-02-16 14:05:01-06:00, __Secure-3PAPISID: 2026-02-16 14:05:01-06:00, __Secure-3PSID: 2026-02-16 14:05:01-06:00
And here’s what it looks like when it saves the cookies:
2024-02-17 17:06:33.770 DEBUG (MainThread) [custom_components.google_maps] [email protected]: Saving cookies, changes: updated: __Secure-3PSIDCC, __Secure-1PSIDCC, SIDCC
And one more commit to the PR to retry failed requests. I was periodically experiencing ERROR 500 and other client connection errors. Those should now be retried automatically, and hopefully, the user won’t see any of these errors anymore, well assuming the server is alive and responding reasonably well.
Released 1.1.0
Includes the feature to save updated cookies and retry failed requests as discussed above.
Released 1.1.1
In HA 2023.11 a new serial number field was added to device info. In some, but not all, versions before that, an exception can occur when this integration attempts to create a device with a serial number specified. This change does not attempt to add a serial number in older HA versions that do not support this field.
Yesterday the locations from my integration didn’t show. Rebooting HA solved that. Not sure how I should have debugged that, any ideas for the next time?
tbh my HA is having ‘issues’ with integrations only working for some time after a reboot, maybe it’s more of a general problem.
Can you elaborate on what you mean by, “the locations from my integration didn’t show”? Do you mean the device_tracker
entities did not exist (i.e., they weren’t on the STATES page)? The devices/entities did not appear on the Integrations page under “Google Maps”? They did not appear as icons on a map page/card? …?