Google Maps location sharing

I get that error as well, if I wait 1 hour. Login to maps.google.com using incognito mode and bypass the “are you a human” warnings" it will work again upon restart. For how long it works? Who knows lol.

Not tracking (pun intended :slight_smile:) what you are using?
I have my WIN 7 desktop running chrome. I can log in my tracker account with no issues. I have given my hass device permission as per instructions. I do not get any “are you human” messages. How are you testing the account? Is there an URL? I have not found it in the code, except for “self._login_url = ‘https://accounts.google.com’”.
Also, I am on hass.io so all I can do is from the command line. I guess I could try curl?
Here is the results of my “curl” test…

So then I did curl ‘https://accounts.google.com/ManageAccount

<HTML>
<HEAD>
<TITLE>Moved Temporarily</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Temporarily</H1>
The document has moved <A HREF="https://accounts.google.com/ServiceLogin?passive=1209600&amp;continue=https%3A%2F%2Faccounts.google.com%2FManageAccount&amp;followup=https%3A%2F%2Faccounts.google.com%2FManageAccount">here</A>.
</BODY>
</HTML>

SO then when I did that “Moved Temporarily” I got this screen.

Of course since this is a different session, it is asking for username/password. Not sure how pass credentials with the URL.

For me I am using windows 10 and home assistant is installed on ubuntu 17 in a virtual environment, I don’t think thats the issue. This is what I did to get up and running.

  1. Create a new account without 2fa or anything
  2. Add that account to my contacts and my wife
  3. Share location from our accounts to the test account
  4. Open incognito window and login to new account
  5. Sometimes I get the are you a human thing (usually after step 11)
  6. Setup configuration.yaml and restart after updating to hass 0.68.1
  7. Observe the cookie error but tracking working
  8. About a week later I get the future exception error I posted up above
  9. Restart hass and component fails to setup
  10. Leave teh component not working for an hour
  11. Open incognito window and go to maps.google.com
  12. Navigate past all the are you a human questions
  13. Restart home assistant a few hours later
  14. Everything up an running
  15. I expect to repeat steps 8-14 again as I literally just did this again yesterday lol

One thing you should do is login as the new account and go to google activity page and make sure all devices on that account are accepted

Hi everybody, I have just released locationsharinglib version 2.0.0 with the 2FA support and a command to help with retrieving the cookies. http://locationsharinglib.readthedocs.io/en/latest/usage.html . Please let me know how things work for you…

@costas do you think the new version will fix the issue I described above?

Traceback (most recent call last):

File “/usr/bin/get-maps-cookies”, line 11, in
load_entry_point(‘locationsharinglib==2.0.0’, ‘console_scripts’, ‘get-maps-cookies’)()
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2631, in load_entry_point
return ep.load()
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2291, in load
return self.resolve()
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2297, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
ModuleNotFoundError: No module named ‘cli’

@costas, I found this on installations http://locationsharinglib.readthedocs.io/en/latest/installation.html .
How does install work with hass.io?
If I use the terminal addon, will that put me in the right environment?
Will the next hass update 69.x have it?

1 Like

@dshokouhi, as stated many times during this admitedly very long thread, there is not much that can be done for whatever google will throw our way. They are doing a very good job at monitoring usage and if they block it with a captcha half way through there is not much that can be done. Sadly (or not) I am having none of the issues above and it works for me consistently for a couple of months now. I guess that security is very much location dependent. So bottom line is either someone with issues has to fix the issue, or it has to happen to me so I can try to tackle it.

@jojoro, the cli portion is broken I will try to have a look at it and fix it after thursday.

@penright, To be honest I do not know, the version has to be bumped in the componet and a MR accepted in the main line. For now people can try to update the version on their components locally so we can see how this goes before we try to merge it to the main line.

I’ve bumped version in component manually and installed 2.0.0 ver of your lib.
Now I get this:

May 07 19:44:30 myhost hass[11282]: 2018-05-07 19:44:30 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1525715070.0819838, level=ERROR, message=Error doing job: Future exception was never retrieved, exception=Traceback (most recent call last):
May 07 19:44:30 myhost hass[11282]: File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
May 07 19:44:30 myhost hass[11282]: result = self.fn(*self.args, **self.kwargs)
May 07 19:44:30 myhost hass[11282]: File “/home/hassio/ha36/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py”, line 68, in _update_info
May 07 19:44:30 myhost hass[11282]: for person in self.service.get_all_people():
May 07 19:44:30 myhost hass[11282]: File “/home/hassio/ha36/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 424, in get_all_people
May 07 19:44:30 myhost hass[11282]: people = self.get_shared_people() + [self.get_authenticated_person()]
May 07 19:44:30 myhost hass[11282]: File “/home/hassio/ha36/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 391, in get_shared_people
May 07 19:44:30 myhost hass[11282]: output = self._get_data()
May 07 19:44:30 myhost hass[11282]: File “/home/hassio/ha36/lib/python3.6/site-packages/cachetools/init.py”, line 46, in wrapper
May 07 19:44:30 myhost hass[11282]: v = func(*args, **kwargs)
May 07 19:44:30 myhost hass[11282]: File “/home/hassio/ha36/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 385, in _get_data
May 07 19:44:30 myhost hass[11282]: return data
May 07 19:44:30 myhost hass[11282]: UnboundLocalError: local variable ‘data’ referenced before assignment
May 07 19:44:30 myhost hass[11282]: , source=components/device_tracker/google_maps.py>

@costas that is understandable. The funny thing is that yesterday I noticed the issue happened again however it seemed to resolve itself after about 2.5 hours. Not sure what changed and I know it must be very difficult since you cannot reproduce it. I will just continue to post my findings here as I think they will be helpful for others who may have a similar issue. Thank you for all the hard work you have done :slight_smile:

@dshokouhi I would guess that you get some kind of “are you human” interactive message which eventually goes away after a long inactivity period. We could try to troubleshoot if you are willing to do some code editing so we can try to fix it, but honestly i am quite pressed with time so I cannot be really responsive. If that is ok with you and you are in it for the long run then let me know and we can try to come up with something.

@jojoro v2.0.1 should fix the cli issue. Let me know.

@NLJ v2.0.2 should fix that issue and I added logging of the exception. The reason the code breaks for you is that the response is invalid and cannot be parsed correctly. The debugging should show us why.

It would be great if everyone added issues to the issue tracker of the library so we can try to fix everything and have an awesome component that works for everybody.

@costas I am all for helping out in the long run :slight_smile: I will go ahead and get an issue created in github so we can begin the troubleshooting steps. I will make sure to include details of my install as well. No worries about your responsiveness, we can work on any schedule :slight_smile:

@costas
Traceback (most recent call last):
File “/usr/bin/get-maps-cookies”, line 11, in
load_entry_point(‘locationsharinglib==2.0.2’, ‘console_scripts’, ‘get-maps-cookies’)()
File “/usr/lib/python3.6/site-packages/locationsharinglib/cli.py”, line 81, in main
CookieGetter(args.email, args.password, args.cookies_file)
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 310, in init
cookies_file=cookies_file)
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 189, in init
if cookies_file and self._validate_cookie(cookies_file):
File “/usr/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py”, line 216, 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

The message is self explanatory right? The cookies are invalid.

@costas, first thank you also for you time. I too am in for getting this to work. As I said, I am a .NET guy, but can read and understand python, just take some of my comments with grain of salt.

Just curios. You will see why in my next comment.

I was debating if I should post this question on github. On one hand it is not an issue per say, but anyone wanting to help test by loading the components locally and is running hass.io would have the same issue.
I not sure how to handle the “sand box” of hass.io. The link talks about a PIP install. (Here is where my python ignorance may show.) Can I, what I call xcopy install, just copy the files into the right directory? Or can I run PIP install from the debugger sh (-p 22222)? Again, I am trying to figure out how to get around the “sand box” of hass.io? If I can get the LSL down, I know where the component code is, do I just change the version to 2.0.2?
If you think this should be under github, either let me know or copy the above text and post a back link. Whichever is easiest for you.

The preferred way would be to change the version of the component to use the latest library version. Not sure where exactly in hass.io the components exist but I would guess that it is pretty easy to figure that out. Copying over files is not encouraged uncles you really really know what you are doing so just go with the bumping of the version in the component in your local installation.

I bumped to 2.0.2 and have no error now. Doesn’t seem to work tho because I don’t see any updates of device trackers. I’ll wait some more and report back (if there will be error I’ll open issue on github :slight_smile: )
Thx :slight_smile:

Hi all,

Sorry if this was already answered. But would a google ‘App password’ work for this?
https://myaccount.google.com/apppasswords

Cheers

Edit: As I posted this I noticed the ‘similar post’ message on the right hand side of the screen, sorry!

Looks like hassio with 0.68.1 is still using

locationsharinglib-1.2.1-py3.6.egg-info/

Facing this issue outside of hassio with get-maps-cookies -https://github.com/costastf/locationsharinglib/issues/22

A usage question, within homeassistant with 2FA enabled, how is the challenge handled given it’s only u/p in the config and the rest is in the background.

How fix cookie error?