New Google maps device tracker issue?

Hi, trying to setup the new google device trackern, but getting an error?

My config:

device_tracker:
platform: google_maps
username: [email protected]
password: mypassword

error when validating:

Platform not found: device_tracker.google_maps

please help :slight_smile:

The only thing I can think of is making sure you upgraded to 0.67.

upgraded to .67 and I got this error

the password has special characters but used quotes
password: ‘@mypassword123

Caught exception
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 284, in _get_data
people = [Person(info) for info in output[0]]
TypeError: ‘NoneType’ object is not iterable

Did you already share the location of a device with the account you added for this component?

yes with my friend… another error

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py”, line 67, in _update_info
for person in self.service.get_all_people():
File “/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 292, in get_all_people
return self._get_data()
File “/srv/homeassistant/lib/python3.6/site-packages/cachetools/init.py”, line 46, in wrapper
v = func(*args, **kwargs)
File “/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 283, in _get_data
output = json.loads(response.text.split(“'”, 1)[1])
File “/usr/local/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/local/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/local/lib/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The same problem I am having.

There is a discussion in this thread: Google Maps location sharing

I just upgraded to 0.68.1 and decided to give Google Maps Device Tracker a whirl. I followed the install directions on: Google Maps - Home Assistant

HA Version: 0.68.1
HA Install: Hass.io
Server: RaspberriPi 3

Config:

device_tracker:
  platform: google_maps
  username: !secret google_maps_login
  password: !secret google_maps_password

Setup:
Sharing my location with a new account. Attempting to login to new account from HA. Not using 2FA.

After restarting, I got this error:

Response: [None, None, ‘0ahUKEwjFvuai9uTaAhWP0YMKHawNAhAQ8ZABCAE’, ‘h5ToWoXfAo-jjwSsm4iAAQ’, None, None, ‘CP+potcFEAAaAA==’, 1800, 1525191815054, None, None, [0]]
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 292, in get_shared_people
people = [Person(info) for info in output[0]]
TypeError: ‘NoneType’ object is not iterable

I checked the unknown device security check as explained in the install directions, and verified with Google that it was infact me trying to login.

Restarted HA and got this error:

Error setting up platform google_maps
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py”, line 184, in async_setup_platform
disc_info)
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py”, line 36, in setup_scanner
scanner = GoogleMapsScanner(hass, config, see)
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py”, line 54, in init
hass.config.path(CREDENTIALS_FILE))
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 184, in init
if cookies_file and self._validate_cookie(cookies_file):
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 211, in _validate_cookie
raise InvalidCookies(message)
locationsharinglib.locationsharinglibexceptions.InvalidCookies: The cookies provided do not provide a valid session.Please authenticate normally and save a valid session again

I deleted the .google_maps_location_sharing.cookies file. Restarted and get the first error again. Restarted… then got the second error again.

I checked the other tread, and didn’t see any help there.

Please Help!

1 Like

@gremblin I to just upgraded to 68.1, PI3, hassio.
Exact same steps and I to am getting the line 211 error, invaldCookies(message).
Please post if you figure it out.

Ok from having dived around the threads, I’ve done this to get it to work:

  1. Log in to your new Google account, and check https://myaccount.google.com/device-activity to see if it’s prevented any unauthorised logins. If it has, and it looks like HA, then approve it.
  2. Delete the .google_maps_location_sharing.cookies file from your config folder.
  3. Restart HA. This will instigate a new login attempt which should create a new cookie.

This process worked for me, but YMMV.

Hi all

thanks for sharing this feature.
Can this be done to locate multiple users, for example all my family shares locations with a new account (as far as I understood, each one should share with a new account)?

Thanks

I get to approve my login on my phone, but i dont see it show up under Device Activity on the Google Page and i cant approve a login there either ( there is no prompt for it ).
Are you using 2FA aswell on your gmail account?
Thanks

I’ve been trying to get this working too. If I delete the cookie file and restart HA, the message The cookies provided do not provide a valid session.Please authenticate normally and save a valid session again goes away and I see a message pop up on my phone to verify that the user trying to log in is me. Once I approve the log in, the known_devices.yaml file still doesn’t get created. I see a ring on my map but it doesn’t update.

According to Device tracker - Home Assistant

Once device_tracker is enabled, a file will be created in your config dir named known_devices.yaml. Edit this file to adjust which devices to be tracked.

How do I get this file to be created using google_maps device tracker?

I see this message in my log files:

ERROR (SyncWorker_12) [locationsharinglib.Service] Could not open pickle file, either file does not exist or no read access.#033[0m

Any idea what that means?

EDIT:

Never mind, I found this post and followed it’s recommendation. I created a fresh google account (without 2-step security) and I think that solved the problem. Now my known_devices.yaml file gets created with the necessary location data. :slight_smile:

1 Like

Has anyone found their already existing known_devices.yaml not being appended with the device tracker entry from this component?

Both the .cookies file and known_devices.yaml have rw-r–r-- and the latter gets appended normally from other components.

And no error in the log either so I am at a loss.

Same thing here.

Hey @toddsantoro. I got the device tracker going. What I did wrong was twhen sharing my main acct location with the dummy acct, the maps app glitched on me and I thought the process was complete but it wasn’t. I went into the app again and when I tapped the empty avatar of the dummy acct in “Location sharing” a card popped up with a toggle to activate sharing my location with that acct. Restarted HA and there it was! known_devices was recently modified!

I hope that is your issue too, please let me know how it went for you.

1 Like

This worked for me too. The instructions on the component page are not clear. They state that you only need to have the dummy account follow you and not that both need to be following each other. I also deleted the /config/.google_maps_location_sharing.cookies file which still shows 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte but I now have the device showing up.

On another note have you gotten the step counter in Own Tracks to work?

My dummy account doesn’t follow anyone.

Weird… I had to follow myself and then it magically worked after hassio restart. I think I am going to go unfollow myself.

Actually I’m confused. I never had the dummy account share with anyone. The setup process is really confusing. I guess I finally just clicked the right stuff by mistake…