Closed sagilo closed 5 years ago
Я получил эту работу без 2FA, и я просто хотел поделиться тем, что я сделал, если у кого-то еще остались проблемы. Сегодня я обновил свой домашний помощник до 0,81.1, и это все еще не удалось. обмен google_maps никогда не работал для меня. Вот что я сделал.
- Изменены люди переменной в get_all_people способом , как @insajd сделал. (Не уверен, что это необходимо, поскольку я все еще видел ошибки после этого) # 42 (комментарий)
- Заменил метод _authenticate кодом, предоставленным @lufton . (Это дало мне ошибку, говоря, что Regex не найден.) # 42 (комментарий)
- Я импортировал модуль Regex в locationharinglib.py , добавив импорт повторно в скрипт
- Затем я удалил каталог pycache в каталоге placesharinglib (/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib) и удалил файл .google_maps_location_sharing.cookins из главного справочника помощника # 42 (комментарий)
- Запущен домашний помощник и мой трекер устройства.
thx, in my case after the docker restart, it seems to revert back to the original locationsharinglib.py
I combined all the necessary files into one (google_maps.py, locationsharinglib.py and locationsharinglibexceptions.py). Then put in "custom_components\device_tracker\google_maps.py".
Unfortunately I cannot help there as I am unfamiliar with running HASS.io in Docker. I am running a Hassbian image.
I just have tried lufton's commit, and also new version 3.0.7, but nothing worked properly.. Everytime shows up this error:
File "
", line 1, in File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 433, in get_all_people people = self.get_shared_people() + [self.get_authenticated_person()] File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 394, in get_shared_people for info in output[0]: TypeError: 'NoneType' object is not iterable
In Google device activity i can see, that it logged to the account correctly: https://i.imgur.com/jVnlAcA.png
And this is output from cli, using correct credentials:
Traceback (most recent call last): File "cli.py", line 39, in
from locationsharinglib import CookieGetter File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 44, in from .locationsharinglibexceptions import (InvalidCredentials, SystemError: Parent module '' not loaded, cannot perform relative import
I just have tried lufton's commit, and also new version 3.0.7, but nothing worked properly.. Everytime shows up this error:
File "", line 1, in File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 433, in get_all_people people = self.get_shared_people() + [self.get_authenticated_person()] File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 394, in get_shared_people for info in output[0]: TypeError: 'NoneType' object is not iterable
In Google device activity i can see, that it logged to the account correctly: https://i.imgur.com/jVnlAcA.png
And this is output from cli, using correct credentials:
Traceback (most recent call last): File "cli.py", line 39, in from locationsharinglib import CookieGetter File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 44, in from .locationsharinglibexceptions import (InvalidCredentials, SystemError: Parent module '' not loaded, cannot perform relative import
I have the same problem
My homeassistant.log
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
disc_info)
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 46, in setup_scanner
scanner = GoogleMapsScanner(hass, config, see)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 66, in __init__
self._update_info()
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 78, in _update_info
for person in self.service.get_all_people():
File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 471, in get_all_people
people = self.get_shared_people()
File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 432, in get_shared_people
for info in output[0]:
TypeError: 'NoneType' object is not iterable
Console output
Traceback (most recent call last):
File "main.py", line 2, in <module>
from locationsharinglib import Service
File "/config/custom_components/device_tracker/locationsharinglib.py", line 45, in <module>
from .locationsharinglibexceptions import (InvalidCredentials,
ImportError: attempted relative import with no known parent package
@slipx06 Not sure if this will work for you, I am on hass.io on a pi. I created a single file with all the dependencies in it( and I removed the links to the external dependency files). I created a file called google_maps.py in /config/custom_components/device_tracker (I had to create some of that path).
This is the file (rename to google_maps.py), which I just copied and pasted from the original files.
I just have tried lufton's commit, and also new version 3.0.7, but nothing worked properly.
Yeah, I realize that my solution doesn't let script do get_authenticated_person
. I assume it is because of some cookies it didn't get. But if you change get_all_people
to something like
people = self.get_shared_people()
It should work.
When can we expect this to be fixed/merged ?
Finally got it working using @StyxyDog method. I had to delete the old cookie file and make the edits summarised by @jdecker91
I have commented on the code. It does not follow the design of the protect and it does not work for everybody, so marching something that is broken itself is not really a benefit. I am sorry that this got complicated and I will not have time to work on it before mid next month. Apologies.
Guys, I know a lot of you waiting for google_maps device tracker fix. For now I can share my temporary solution. Place custom_components from ZIP to your <config directory>
:
custom_components.zip
It is dirty hack version, but it works for me. The google_maps.py
wasn't modified much from original, locationsharinglib.py
is slightly modified and merged with locationsharinglibexceptions.py
.
If you have 2FA enabled it might not work from first time you restart HA, try restarting HA until you stop receiving phone notifications to allow login. Congratulations! Now you are able to track devices.
@lufton i still get the same error with that :/ no 2FA (UK Based)
2018-11-18 22:25:28 ERROR (SyncWorker_32) [custom_components.device_tracker.google_maps] Hey you!!! 2018-11-18 22:25:31 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps Traceback (most recent call last): File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform disc_info) File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/device_tracker/google_maps.py", line 46, in setup_scanner scanner = GoogleMapsScanner(hass, config, see) File "/config/custom_components/device_tracker/google_maps.py", line 66, in __init__ self._update_info() File "/config/custom_components/device_tracker/google_maps.py", line 78, in _update_info for person in self.service.get_all_people(): File "/config/custom_components/device_tracker/locationsharinglib.py", line 453, in get_all_people people = self.get_shared_people() File "/config/custom_components/device_tracker/locationsharinglib.py", line 414, in get_shared_people for info in output[0]: TypeError: 'NoneType' object is not iterable
@lufton i still get the same error with that :/ no 2FA
2018-11-18 22:25:28 ERROR (SyncWorker_32) [custom_components.device_tracker.google_maps] Hey you!!! 2018-11-18 22:25:31 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps Traceback (most recent call last): File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform disc_info) File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/device_tracker/google_maps.py", line 46, in setup_scanner scanner = GoogleMapsScanner(hass, config, see) File "/config/custom_components/device_tracker/google_maps.py", line 66, in __init__ self._update_info() File "/config/custom_components/device_tracker/google_maps.py", line 78, in _update_info for person in self.service.get_all_people(): File "/config/custom_components/device_tracker/locationsharinglib.py", line 453, in get_all_people people = self.get_shared_people() File "/config/custom_components/device_tracker/locationsharinglib.py", line 414, in get_shared_people for info in output[0]: TypeError: 'NoneType' object is not iterable
Okay, that is strange. Can you turn on 2FA to check if that cause problem.
i just worked it out :) it wasn't picking up the shared device :) had to unshare and reshare and it's now working. Thanks :D
i just worked it out :) it wasn't picking up the shared device :) had to unshare and reshare and it's now working. Thanks :D
Glad it worked for you. Hopefully it wouldn't break soon.
@lufton wow thanks, that worked perfectly!!! First time ever this works, FINALLY!!!
I just have tried lufton's commit, and also new version 3.0.7, but nothing worked properly.. Everytime shows up this error:
File "", line 1, in File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 433, in get_all_people people = self.get_shared_people() + [self.get_authenticated_person()] File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 394, in get_shared_people for info in output[0]: TypeError: 'NoneType' object is not iterable
In Google device activity i can see, that it logged to the account correctly: https://i.imgur.com/jVnlAcA.png And this is output from cli, using correct credentials:
Traceback (most recent call last): File "cli.py", line 39, in from locationsharinglib import CookieGetter File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 44, in from .locationsharinglibexceptions import (InvalidCredentials, SystemError: Parent module '' not loaded, cannot perform relative import
I have the same problem
My homeassistant.log
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform disc_info) File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 46, in setup_scanner scanner = GoogleMapsScanner(hass, config, see) File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 66, in __init__ self._update_info() File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 78, in _update_info for person in self.service.get_all_people(): File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 471, in get_all_people people = self.get_shared_people() File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 432, in get_shared_people for info in output[0]: TypeError: 'NoneType' object is not iterable
Console output
Traceback (most recent call last): File "main.py", line 2, in <module> from locationsharinglib import Service File "/config/custom_components/device_tracker/locationsharinglib.py", line 45, in <module> from .locationsharinglibexceptions import (InvalidCredentials, ImportError: attempted relative import with no known parent package
@lufton OMG after days of torture your code got it working for me! Thanks!
As for the Import Error, did you pip install regex on your Hassio box?
I got this same error and I had to install regex (the import re ) library.
I might have done something else too, like delete cookie files etc, but I think the install may help here.
Mike K
As for the Import Error, did you pip install regex on your Hassio box?
This fix doesn't use regex
library as parser it is parsed by json
.
@lufton thank you so much! It worked perfectly!
@lufton thank you! It worked perfectly also for me. Could you please merge this change to the master branch in order to have it for the future version in HASS?
@lufton thank you! It worked perfectly also for me. Could you please merge this change to the master branch in order to have it for the future version in HASS?
You are welcome! I can't merge that as I'm not the owner of this plugin, @costastf is. More of that it is dirty hacked version, read his https://github.com/costastf/locationsharinglib/issues/42#issuecomment-439601385.
Custom component seems to work for me too. Thank you @lufton for putting this together while we wait for the proper fix to the library.
Hi everybody! Could everybody with issues with the latest version of this library, without @lufton 's patch please report country of origin so I can use a vpn service and try to fix this consistently for everyone? I am hoping to invest some time on this after coming week. Thanks in advance!
Germany
Ukraine (If you need I can setup Ukrainian VPN server on my mikrotik router)
United Kingdom
On Wed, 28 Nov 2018 at 14:30, Дубовик Максим notifications@github.com wrote:
Ukraine
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/costastf/locationsharinglib/issues/42#issuecomment-442466105, or mute the thread https://github.com/notifications/unsubscribe-auth/AqWJ80nXx0x0h5NaIPQbfwNIrUUR9ZNnks5uzp32gaJpZM4XawWk .
Ireland
Israel, Thank you!
South Africa
United States - Thank you Sir!!!!
And my 12 points go to... FRANCE! 🎆
Australia
Russia
Sweden
Austria
The Netherlands
Canada
Spain ;)
The Netherlands
I'm in the UK.
Thanks for the fix, Lufton
Thanks for the fix, Lufton
I'm just a human, do what I can )
Croatia
Please remove the log, it contains personal information.
On Tue, Dec 4, 2018 at 10:35 AM blakadder notifications@github.com wrote:
Croatia
Here's the error log from get-maps-cookies https://hastebin.com/yizoduyeco.xml
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/costastf/locationsharinglib/issues/42#issuecomment-444033393, or mute the thread https://github.com/notifications/unsubscribe-auth/AEbFa7S3NJP-7XLxDsY5_nuzbwGPfjVVks5u1kHhgaJpZM4XawWk .
During waiting to fix this issue, I've used other option mentioned here (hardcode cookies into code). Will work for a while.
Argentina
Poland
Finland
Italy :)
Romania
please hepl me
Tue Dec 11 2018 21:31:56 GMT+0200 (Ora standard a Europei de Est)
Error setting up platform google_maps Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py", line 184, in async_setup_platform disc_info) File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 46, in setup_scanner scanner = GoogleMapsScanner(hass, config, see) File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 66, in init self._update_info() File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/google_maps.py", line 78, in _update_info for person in self.service.get_all_people(): File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 465, in get_all_people people = self.get_shared_people() + [self.get_authenticated_person()] File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 426, in get_shared_people for info in output[0]: TypeError: 'NoneType' object is not iterable
I've install version 3.0.6 inside a virtual environment Running test.py:
Output:
Username & password belongs to a new google account which I've shared my location with. I've logged in using Firefox to the new account before running the program.