Thank you for the explanation!
Hello again.
Just updated Hassbian to 0.68. Seems to be getting locations correctly almost all he time, but keep getting errors:
2018-04-30 01:01:11 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-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/local/lib/python3.6/dist-packages/homeassistant/components/device_tracker/google_maps.py", line 36, in setup_scanner
scanner = GoogleMapsScanner(hass, config, see)
File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/device_tracker/google_maps.py", line 55, in __init__
self._update_info()
File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/device_tracker/google_maps.py", line 68, in _update_info
dev_id = 'google_maps_{0}'.format(slugify(person.id))
File "/usr/local/lib/python3.6/dist-packages/homeassistant/util/__init__.py", line 43, in slugify
text = normalize('NFKD', text)
TypeError: normalize() argument 2 must be str, not None
Just as bug reporting. Thanks for your work.
I just reported the bug. If you were to report this 1 hour earlier i wont update…
https://github.com/home-assistant/home-assistant/issues/14177
I randomly started to get this error today. Not sure what changed but things were working fine on 0.68. I saw here it was suggested to update to 1.2.2 of the library but no dice.
This is the error I get:
Error setting up platform google_maps
Traceback (most recent call last):
File "/srv/homeassistant/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 "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 36, in setup_scanner
scanner = GoogleMapsScanner(hass, config, see)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 55, in __init__
self._update_info()
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 324, in get_all_people
people = self.get_shared_people() + [self.get_authenticated_person()]
File "/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 291, in get_shared_people
output = 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 285, in _get_data
return json.loads(response.text.split("'", 1)[1])
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/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)```
EDIT: For anyone else getting this error, delete the cookies file and restart home assistant seems to have done the trick for me.
Ok that issue came back again within 10 minutes and now it doesn’t seem to go away no matter what I do. Not sure what happened here.
EDIT: just restarted home assistant and its working again, something odd is happening maybe its at google’s end???
I asked the question in this posthttps://community.home-assistant.io/t/new-google-maps-device-tracker-issue/50328/8?u=penright because someone else had the same issue. Reading this post, maybe here is a better place.
After going through all the setups, I am at the point where you get “The cookies provided do not provide a valid session.Please authenticate normally and save a valid session again” error.
I saw where many talked about deleting cookies, unless I missed it, there was no mention of where they are at.
What should be the next step?
Here is my log for reference.
Thu May 03 2018 13:52:11 GMT-0500 (Central Daylight Time)
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```
issue came back again, this component seems to be really iffy with how frequently it breaks and fixes itself
@michaelarnauts I notice you contribute to both google_maps.py and locationssharinglib. Can you help with a couple of questions?
I notice on github under the dev branch, it is “REQUIREMENTS = [‘locationsharinglib==1.2.2’]”
Looking at the code currently installed, it is “REQUIREMENTS = [‘locationsharinglib==1.2.1’]”
Looking at the website http://locationsharinglib.readthedocs.io/en/latest/contributing.html 1.2 was released 4/2/2018.
Does that have the credential/cookie fix?
Looking at the google_maps.py code, I am guessing the magic happens in the location sharing lib (LSL).
I am a .NET not a python programer, but REQUIREMENTS looks like a variable/constant. I don’t see where it is used, so I assume it is used as a remark. Just for grins, I did try and change it to 1.2.2 and it did not make a difference.
I am running hass.io and I do have developers ssh (-p 22222) enabled.
Can I and how do I install the latest LSL?
Restarted home assistant again this morning and it started working again
This is different. I wanted to show the error when loging in whitout cookies. ie: first time.
I deleted the cookie and restarted hass. This is my error …
Log Details (ERROR)
Fri May 04 2018 09:52:45 GMT-0500 (Central Daylight Time)
Could not open pickle file, either file does not exist or no read access.
Expecting it not to be there, did a “ls -la” and it was there.
So I just deleted it and trying again. Same thing.
Something maybe getting cache so this time I waited till the “lost connecting”… Same thing.
I am changing my “REQUIREMENTS = [‘locationsharinglib==1.2.2’]” back to 1.2.1 and see what happens.
Same thing.
So this time I am restarting hass, with my google_maps rem out. Then I will delete cookie and see what happens. … Same thing.
I wonder if there is a race condition. Been looking at the LSL code and still trying to get the lay of the land. As I said, I am more .NET, but as all languages there are similarities and nuances. I wonder if some of the sessions calls are non blocking. As I said, I not sure about python.
For now I guess, i am giving up, unless someone has an idea.
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 ) 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…
-
curl ‘https://accounts.google.com’
Moved TemporarilyMoved Temporarily
The document has moved here.
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&continue=https%3A%2F%2Faccounts.google.com%2FManageAccount&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.
- Create a new account without 2fa or anything
- Add that account to my contacts and my wife
- Share location from our accounts to the test account
- Open incognito window and login to new account
- Sometimes I get the are you a human thing (usually after step 11)
- Setup configuration.yaml and restart after updating to hass 0.68.1
- Observe the cookie error but tracking working
- About a week later I get the future exception error I posted up above
- Restart hass and component fails to setup
- Leave teh component not working for an hour
- Open incognito window and go to maps.google.com
- Navigate past all the are you a human questions
- Restart home assistant a few hours later
- Everything up an running
- 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…
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?
@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