Google maps device tracking with multiple users

Hi all - I wonder if anyone could help with me with using Google device tracking with multiple users. I have two accounts to be tracked shared with a second tracking account, and I get my location shown on the map card in Lovelace. The problem I have is making HA aware of the second account. How does it differentiate between the two? I have us both as Persons in the configuration, with “device_tracker.google_maps_location_tracker_gmail_com” (my personal version of course) configured under track device, but (as expected, I guess) both icons on the map are always in the same place. How does HA know who is who? I’ve probably missed a step in the config, but I can’t figure it out for the life of me. Any help would be appreciated, thanks!

  • Create new account for google maps (it looks like you’ve already done this)
  • Both people share their location with the new account
  • Use the credentials of the new account to set up the integration
  • Two distinct devices should be created, one for each location shared with the new account
  • Associate the devices with the relevant persons

The more difficult part is step 3, messing around with cookies, that’s explained pretty well in the docs.

1 Like

That seems to work perfectly. Thanks for your swift and well written reply.

1 Like

It is working here as well… I get 2 known devices:

google_maps_1_LONG_NUMBER_9:
  hide_if_away: false
  icon:
  mac:
  name: google maps 1_LONG_NUMBER_9
  picture: https://lh4.googleusercontent.com/-taxc2xwDswM/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ACHi3rd89L-1of-s18m_yvyEkCwkTtL8vw/photo.jpg
  track: true

google_maps_EMAIL_NAME_gmail_com:
  hide_if_away: false
  icon:
  mac:
  name: google maps email name gmail com
  picture:
  track: true

Second I have change google maps location set on ALWAYS in iOS even when its closed.
But when I look into HA and rebooted the device trackers are set on AWAY

When I open google maps, then location sharing then they change to current location.

Or do I wait 1 minute before it will change because of default scan_interval: 60 ?

How can I do this to do it automatic?

Had this working for a good while, 6+ months. Until recently, 105 update, they are removing group.all_devices going forward.

The only item going forward is with automation rules with 2 users. (Zones are setup).
Currently if 1st users leaves the setting sets Not_Home and the 2nd User is still at Home, the automation rule should stay off and not trigger motions. 1 user shows Not_Home and the other shows Home and automation rule turns on still.

I’m looking to better understand going forward how to set an automation rule. With the new changes coming there is no clear documentation.

Here is my config as of today:

- id: '999999999999'
  alias: (Automation) Arm House Away Mode
  description: ''
  trigger:
  - entity_id: group.all_devices
    platform: state
    to: not_home
  condition: []
  action:
  - alias: ''
    data:
      entity_id: automation.travel_upstairs_motion_sensors
    service: automation.turn_on

I tried the following below for each Google user (share account) which is tied to their Person. But when the 1st person leaves it triggers the automation rule.

- id: '999999999999'
  alias: (Automation) Arm House Away Mode
  description: ''
  trigger:
  - entity_id: person.name_1,person.name_2
    platform: state
    to: not_home
  condition: []
  action:
  - alias: ''
    data:
      entity_id: automation.travel_upstairs_motion_sensors
    service: automation.turn_on

Any assistance in proper configurations would appreciated.

Hi all,

I have also google_maps working as device_tracking. And I really like it when it works. :slight_smile:

@eggman I made all the steps you say.
After it stays working for a few days. Then I realize that it’s not tracking anymore, and I need to get the cookies again and update the cookies file.

There is some solution to get the cookies automatically?

Sorry, I can’t help you with that. I downloaded them, following the instructions over six months ago and haven’t updated them since.

is this integration stil working? i get always same error:

2022-11-20 21:19:35.475 ERROR (SyncWorker_2) [homeassistant.components.google_maps.device_tracker] The cookie file provided does not provide a valid session. Please create another one and try again
2022-11-20 21:19:35.945 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy google_maps

folowed also doku, i try it with chrome and firefox addons, with clean cookies, fresh install of firefox and so on. no luck.