Are you getting errors in the Homeassistent log?
If you do, could you please post them?
I would guess, that you are getting this one:
people = [Person(info) for info in output[0]]
TypeError: ‘NoneType’ object is not iterable
I can’t get it to work in home assistant. I’m assuming because I use two-step verification. I tried creating an app password but that failed with “invalid credentials”. Next step is to create a new account as my location sharing “service account.”
On the latest version of the library there is in interactive helper object for 2FA. By this evening I will make a small cli utility around it and push a new version so you can use it to get the cookies from a 2FA account. Hang in there…
If someone with 2FA could validate that things work for them from this branch https://github.com/costastf/locationsharinglib/tree/f-authenticate-interactively using the cli.py on the root I can merge in master bump and make a package of this so it can be used on the HA component. Thanks!
what’s the usage for it? python3 cli.py -u email -p password
? what’s the expected result? a .google_maps_location_sharing.cookies
file being generated? at what point should I be asked for my second factor for auth?
The expected outcome would be for use with 2FA enabled to get a message asking to validate its second factor before the cookies get created. I do not have 2FA enabled on the account that I share info with and this was a contribution that worked for the person contributing the code. I am quite pressed with time to look into this, so contributions are welcome!
Yeah, running the following:
python3 cli.py -u '[email protected]' -p 'my_password'
gives me a cookies file, but no output whatsoever, and no prompt for any additional factors. I have U2F and TOTP (Google Authenticator) enabled for my account.
I know its a silly question but here goes, those cookies are invalid right?
As far as I can tell, they are. If I try using them I get an InvalidCookies exception.
Right. So as i commented on the issue on github this code was contribution from a user and it was validated that it works for him, which probably means that there are multiple 2FA responses from google and if we want this to be robust we need to figure them out. #284 is where the identification of 2FA happens in the library on the branch and _handle_prompt is the method that handles the challenge. If people having problems with 2FA who are also python literate could have a look and identify the issue for them I would love to accept an MR that solves this. Sadly I am quite pressed with time currently to look into this myself and I think that it will take a couple of weeks before I am in a place to do so, so more eyes are welcome!
@cwhits This was designed with a second account in mind from the beginning. Of course fixing it to work for all situations would be awesome, but till then, just create a new account and share your locations with that one so you can get things working.
Thanks. Any relevant info I find I’ll add do the issue on github.
Sorry i not English
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 284, in _get_data
people = [Person(info) for info in output[0]]
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 284, in
people = [Person(info) for info in output[0]]
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 87, in init
self._populate(data)
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 95, in _populate
self._latitude = data[1][1][2]
TypeError: ‘NoneType’ object is not subscriptable
my error message
I tried the cli.py script on my account with 2FA enabled. It generated a cookie but then after placing it on my home-assistant config directory and restarting I instantly got this:
2018-04-16 19:04:20 ERROR (SyncWorker_34) [locationsharinglib.Service] Caught exception
Traceback (most recent call last):
File "/usr/local/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
SO I have it set for the 2FA to be a prompt on my Pixel phone. So when it was botting back up after putting the google maps tracker in, my phone asked “Is it you trying to sign in?” I clicked yes, so I think the 2FA is now validated. But then of course:
Caught exception
Traceback (most recent call last):
File "/usr/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
File .google_maps_location_sharing.cookies contains:
'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
Here is my attempt at getting it to work, please note that this guide I wrote DOES NOT WORK DOES NOT WORK DOES NOT WORK:
Okay for those with 2FA on their google account and are trying to get https://www.home-assistant.io/components/device_tracker.google_maps/ (Google Maps Location Sharing Component) to work, this is how I did it.
Firstly, add the component to your config file, with your real google password there.
Now restart your HomeAssitant. You may get a prompt on your phone to allow the sign in, I tick ‘yes’.
After reboot, I deleted the file .google_maps_location_sharing.cookies containing:
'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
I then went to https://myaccount.google.com/apppasswords
Login to your account
Now click “Select App” -> “other (Custom name)”
Now click “select device” -> “other (Custom Name)”
Call it something like “Google Location Sharing on HA”
You will get a 16 letter code. Replace your password in the configuration.yaml for the google location component.
Reboot Home Assistant again
You should now have the component working
So I can get a cookie from cli.py, but that cookies first character contains some odd special character that UTF-8 codec cant decode. I’ll keep trying
I have this error in my log.
The authentication seam to be working…but I do not see the device on the map.
Got any idea?
Same here I also created a new account strictly for location purposes. I’ll continue to use mytracks for now but I’m very excited about this because my wife won’t use mytracks due to the constant item in here notification tray on her phone
I had a similar issue, deleting owntracks from my phone seemed to solve the problem.