I just removed the custom component from my setup (using hassio) and restarted HA. Seemed to work fine
Just trying out Hass.io on a fresh install. Tried to add the device tracking for google maps and I get this.
I just noticed that today, and yes I guess it is expected since google registers your ip as the one that your third party account uses to access the shares and it reaches it every few seconds, so when another account gets accessed by the same ip it triggers Google’s security. As long as they don’t block the initial account with captcha I guess we will have to live with this.
Can the interval it checks the location be reduced? Maybe an option in a future release?
My thoughts were it is getting flagged due the the number of queries, not the different accounts? I mean, we could have 5 people in the house accessing google services and therefore coming from the same IP and have no issues. I think an IP hitting the google services every few seconds is what is getting flagged as unusual, because its pretty obvious its automated vs a user doing it. But I could be wrong
I just treid the new component an am running into an error, when I try ti share the location of more than one devices.
With one device everything is fine, but when I add the second I get the following error:
2018-04-14 18:57:52 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/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/homeassistant_venv/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py”, line 292, in get_all_people
return self._get_data()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/cachetools/init.py”, line 46, in wrapper
v = func(*args, **kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py”, line 283, in _get_data
output = json.loads(response.text.split(“'”, 1)[1])
File “/usr/lib/python3.5/json/init.py”, line 319, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.5/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.5/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
It seems not to be related to the number of shared locations. I reduced it back to the initial one device, but am still getting the same error-message.
Unter the Device Activity Page from Google is nothing special.
Same here worked fine with one user then added a second now it does the same as yours. Can’t get it working at all now.
I think I found the culprit.
Whe I call the url in my browser, that is called by the locationsharing library,
https://www.google.com/maps/preview/locationsharing/read
then Google thinks, I might be a bot and presents me a captcha.
I guess that is what happens to the script as well.
Any idea how to solve this or if this even is the culprit?
It started working again for about 10 minutes, now I get a new error:-
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/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/homeassistant_venv/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py”, line 292, in get_all_people
return self._get_data()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/cachetools/init.py”, line 46, in wrapper
v = func(*args, **kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py”, line 283, in _get_data
output = json.loads(response.text.split("’", 1)[1])
File “/usr/lib/python3.5/json/init.py”, line 319, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.5/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.5/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)
What happens in your Browser when you try to open https://www.google.com/maps/preview/locationsharing/read
I played a little bit around and tried it with a testscript from here Usage — locationsharinglib 5.0.3 documentation
Then I got the security warning in the Google Account and could dismiss it.
After that I am getting this error:
2018-04-14 21:55:29 ERROR (Thread-12) [locationsharinglib.Service] Caught exception
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py”, line 284, in _get_data
people = [Person(info) for info in output[0]]
TypeError: ‘NoneType’ object is not iterable
I have set up one account that shares his location with this account. When I run my testscript I get results.
I have no idea what to look for…
It seems like I found a fix for this.
I am running a manually installation version in virtualenv.
In my case the File to edit is located under
/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/components/device_tracker/
In the google_maps.py file the used version for the locationsharinglib is 0.4.0 while the newest release is 1.2.1
So I changed the file from
REQUIREMENTS = ['locationsharinglib==0.4.0']
to
REQUIREMENTS = ['locationsharinglib==1.2.1']
After a restart of homeassistant everything is working fine with to shared locations.
The captcha Problem is coming back periodically…
400. That’s an error.
Your client has issued a malformed or illegal request. That’s all we know.
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.