home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.6k stars 30.76k forks source link

google_maps device_tracker: TypeError: 'NoneType' object is not iterable #17410

Closed sagilo closed 5 years ago

sagilo commented 6 years ago

Running latest version - 0.80.0

Configuration:

  - platform: google_maps
    username: !secret google_maps_username
    password: !secret google_maps_password
    max_gps_accuracy: 200

In 0.79.3 .google_maps_location_sharing.cookies was created but nothing appeared in logs and no new device_tracker in HA. After upgrading to 0.80.0 I get the following error:

home-assistant   | 2018-10-13 18:57:35 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform google_maps
home-assistant   | Traceback (most recent call last):
home-assistant   |   File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
home-assistant   |     disc_info)
home-assistant   |   File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
home-assistant   |     result = self.fn(*self.args, **self.kwargs)
home-assistant   |   File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 46, in setup_scanner
home-assistant   |     scanner = GoogleMapsScanner(hass, config, see)
home-assistant   |   File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 66, in __init__
home-assistant   |     self._update_info()
home-assistant   |   File "/usr/src/app/homeassistant/components/device_tracker/google_maps.py", line 78, in _update_info
home-assistant   |     for person in self.service.get_all_people():
home-assistant   |   File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 459, in get_all_people
home-assistant   |     people = self.get_shared_people() + [self.get_authenticated_person()]
home-assistant   |   File "/usr/local/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 421, in get_shared_people
home-assistant   |     for info in output[0]:
home-assistant   | TypeError: 'NoneType' object is not iterable

Nothing appears in Device Activity page.

Running in docker over Ubuntu 16.04

wattsra commented 5 years ago

in your "/config" folder should work. it did for me!

dartfrogdk commented 5 years ago

thanks

WedHumpDay commented 5 years ago

@sherbang This worked perfectly.! Now, what I have done, I moved away from Hass.io to a custom VM server with Ubuntu, witih HA virtual environment. I'm extremely pleased with this direction.

While I enjoyed the Hass.io, I've always preferred to handle configurations under my control. IMHO - Hass.io seems to have more issues and at times, late with supporting certain features. Again. This is my personal opinion.

To note. This still not fixed in Hass.io .83.1. Just saying.. The work around also does not work in Hass.io.

Gluwc commented 5 years ago

@WedHumpDay The work around works fine for me in Hassio, I'm running it on Ubuntu instead of HassOS not sure if that matters.

WedHumpDay commented 5 years ago

@Gluwc I was running Hassio on Ubunti 18.04.1 on a VM instance. Wasnt able to get the work around to take. Regardless, Im pleased with my new setup.

scholy commented 5 years ago

Until the code is updated, you can temporarily work around the problem by using lufton's code to create the cookie file separately (I did it on a separate linux box and then uploaded the cookie file to hassos).

git clone https://github.com/lufton/locationsharinglib.git
cd locationsharinglib/
mkvirtualenv -p `which python3` locationsharinglib
pip install -r requirements.txt 
python cli.py --email '<your email>' --password '<your password>' --cookies-file 
.google_maps_location_sharing.cookies

Thanks, working for me on hassios 83.3. Needed to get mkvirtualenv working on my ubuntu box, simple and only took 2min, followed pre-req's here: https://stackoverflow.com/questions/13855463/bash-mkvirtualenv-command-not-found

robandwcom commented 5 years ago

Update 0.84 has: "Update locationsharinglib to 3.0.9 (@pc-coholic - #19045) (device_tracker docs)"

Lets hope everything is ok now 👍

royduin commented 5 years ago

Nope, see: https://github.com/home-assistant/home-assistant/issues/17410#issuecomment-433720343

pc-coholic commented 5 years ago

Update 0.84 has: "Update locationsharinglib to 3.0.9 (@pc-coholic - #19045) (device_tracker docs)"

Lets hope everything is ok now

Just FYI: This PR (as well as all my other HA-PRs relating to locationsharinglib) were only addressing issues, where the location of the account owner was not populated. The whole "NoneType is not iterable"-stuff never was an issue for me, so I never looked into this...

feene commented 5 years ago

Until the code is updated, you can temporarily work around the problem by using lufton's code to create the cookie file separately (I did it on a separate linux box and then uploaded the cookie file to hassos).

git clone https://github.com/lufton/locationsharinglib.git
cd locationsharinglib/
mkvirtualenv -p `which python3` locationsharinglib
pip install -r requirements.txt 
python cli.py --email '<your email>' --password '<your password>' --cookies-file 
.google_maps_location_sharing.cookies

Thanks, working for me on hassios 83.3. Needed to get mkvirtualenv working on my ubuntu box, simple and only took 2min, followed pre-req's here: https://stackoverflow.com/questions/13855463/bash-mkvirtualenv-command-not-found

This just worked for me after struggling for quite awhile. Add lufton's file into a custom components directory on HASS.IO and move the cookie you create into /conf share

krasatos commented 5 years ago

Until the code is updated, you can temporarily work around the problem by using lufton's code to create the cookie file separately (I did it on a separate linux box and then uploaded the cookie file to hassos).

git clone https://github.com/lufton/locationsharinglib.git
cd locationsharinglib/
mkvirtualenv -p `which python3` locationsharinglib
pip install -r requirements.txt 
python cli.py --email '<your email>' --password '<your password>' --cookies-file 
.google_maps_location_sharing.cookies

Thanks, working for me on hassios 83.3. Needed to get mkvirtualenv working on my ubuntu box, simple and only took 2min, followed pre-req's here: https://stackoverflow.com/questions/13855463/bash-mkvirtualenv-command-not-found

This just worked for me after struggling for quite awhile. Add lufton's file into a custom components directory on HASS.IO and move the cookie you create into /conf share

Hey there, could you please elaborate on what exactly you did for us with low coding IQ? :) What file exactly did you get? just throw it in /custom_components/? What does your configuration look like? And do i get the .cookies file created by the original component and throw it in /share/? Thanks in advance :+1:

WedHumpDay commented 5 years ago

Anyone else experience no updates starting 84.3 ? Had to roll back to 83.3 in order for the updates to show.

au190 commented 5 years ago

Is this working in 83.3 ?

WedHumpDay commented 5 years ago

Is this working in 83.3 ?

Yes. Working on 83.3. Scroll up and and you can sees its working under Hass & Hass.io.

databoy2k commented 5 years ago

Until the code is updated, you can temporarily work around the problem by using lufton's code to create the cookie file separately (I did it on a separate linux box and then uploaded the cookie file to hassos).

git clone https://github.com/lufton/locationsharinglib.git
cd locationsharinglib/
mkvirtualenv -p `which python3` locationsharinglib
pip install -r requirements.txt 
python cli.py --email '<your email>' --password '<your password>' --cookies-file 
.google_maps_location_sharing.cookies

Thanks, working for me on hassios 83.3. Needed to get mkvirtualenv working on my ubuntu box, simple and only took 2min, followed pre-req's here: https://stackoverflow.com/questions/13855463/bash-mkvirtualenv-command-not-found

I'm struggling here. I created a ~/locationsharinglib/.bash_profile with the solution's lines in it, but I continue to get "command not found". Am I going about this wrong?

AZDane commented 5 years ago

I am struggling getting mkvirtualenv working on Turnkey Linux. I keep getting the no such file or directory.

aa755 commented 5 years ago
git clone https://github.com/lufton/locationsharinglib.git
cd locationsharinglib/
mkvirtualenv -p `which python3` locationsharinglib
pip install -r requirements.txt 
python cli.py --email '<your email>' --password '<your password>' --cookies-file 
.google_maps_location_sharing.cookies

This worked for me in version Home Assistant 84.6. In arch linux, I had to replace mkvirtualenv by virtualenvand add ./bin to $PATH.

Frankster-NL commented 5 years ago

Tried the solution by @sherbang but get the following:

Traceback (most recent call last): File "cli.py", line 143, in main() File "cli.py", line 137, in main CookieGetter(args.email, args.password, args.cookies_file) File "/home/pi/locationsharinglib/locationsharinglib/locationsharinglib.py", line 349, in init super(CookieGetter, self).init(email, TypeError: super() argument 1 must be type, not classobj

froggy974 commented 5 years ago

i have the same error message

TypeError: super() argument 1 must be type, not classobj did you find a solution to get the cookie ?

shr00mie commented 5 years ago

still going strong using my solution...

image

image

cough --> image

froggy974 commented 5 years ago

yes ! it's working image

shr00mie commented 5 years ago

@froggy974 which solution are you using?

btw, love that you're french/in france and your username is froggy. tips hat

froggy974 commented 5 years ago

The workaround described by @sherbang worked for me

Ps:yes, I was not so inspired for the username ;-) to

alex206cc commented 5 years ago
git clone https://github.com/lufton/locationsharinglib.git
cd locationsharinglib/
mkvirtualenv -p `which python3` locationsharinglib
pip install -r requirements.txt 
python cli.py --email '<your email>' --password '<your password>' --cookies-file 
.google_maps_location_sharing.cookies

This worked for me in version Home Assistant 84.6. In arch linux, I had to replace mkvirtualenv by virtualenvand add ./bin to $PATH.

i'm sorry but i not know very well linux....

(homeassistant) homeassistant@homeassistant:/usr/local/bin $ virtualenv -p `which python3` locationsharinglib
Already using interpreter /srv/homeassistant/bin/python3
Using base prefix '/usr'
Traceback (most recent call last):
  File "/srv/homeassistant/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/srv/homeassistant/lib/python3.5/site-packages/virtualenv.py", line 768, in main
    symlink=options.symlink,
  File "/srv/homeassistant/lib/python3.5/site-packages/virtualenv.py", line 1013, in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
  File "/srv/homeassistant/lib/python3.5/site-packages/virtualenv.py", line 1214, in install_python
    mkdir(lib_dir)
  File "/srv/homeassistant/lib/python3.5/site-packages/virtualenv.py", line 382, in mkdir
    os.makedirs(at_path)
  File "/usr/lib/python3.5/os.py", line 231, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.5/os.py", line 231, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/locationsharinglib'

can i help me?

vg8020 commented 5 years ago

It works! Raspbian 9.6 and Home Assistant 0.84 on a Virtual Environment in a Raspberry Pi 3

Steps are just a bit different than those kindly described by @sherbang in https://github.com/home-assistant/home-assistant/issues/17410#issuecomment-440357856

#from /home/pi

#clone lufton's fork
git clone https://github.com/lufton/locationsharinglib.git

#stop HA
sudo systemctl stop home-assistant@homeassistant.service

#activate virtual environment
sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate

#generate cookie file
(homeassistant) homeassistant@raspberrypi:~/.homeassistant $ python /home/pi/locationsharinglib/cli.py --email '<your email>' --password '<your password>' --cookies-file .google_maps_location_sharing.cookies

#make sure known_devices.yaml does not exist or remove it so that HA will create it from scratch. you can always edit it later to match your needs so keep a copy if needed (fixed)

#restart HA (fixed)
sudo systemctl restart home-assistant@homeassistant.service

#check https://myaccount.google.com/device-activity and there it is: new Linux session

Please, mind I have not installed lufton's fork, but just made use of the fork to generate the cookies.

chelming commented 5 years ago

thanks @vg8020 that was enough to get the cookies generated and get it working for me!

spattinson commented 5 years ago

It works! Raspbian 9.6 and Home Assistant 0.84 on a Virtual Environment in a Raspberry Pi 3

Steps are just a bit different than those kindly described by @sherbang in #17410 (comment)

from /home/pi

clone lufton's fork

git clone https://github.com/lufton/locationsharinglib.git

stop HA

sudo systemctl stop home-assistant@homeassistant.service

activate virtual environment

sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate

generate cookie file

(homeassistant) homeassistant@raspberrypi:~/.homeassistant $ python /home/pi/locationsharinglib/cli.py --email '<your email>' --password '<your password>' --cookies-file .google_maps_location_sharing.cookies

make sure known_devices.yaml does not exist or remove it so that HA will create it from scratch

restart HA

sudo systemctl stop home-assistant@homeassistant.service

check https://myaccount.google.com/device-activity and there it is: new Linux session

Please, mind I have not installed lufton's fork, but just made use of the fork to generate the cookies.

This worked for me, I was getting a cookies file but it didn't work. You dont need to delete known_devices.yaml - I had stuff I wanted to keep in there! Your #restart HA command "stops" HA Now I need to try to link this intelligently to open my garage when I am coming home in MY car, not someone elses, and not walking.

vg8020 commented 5 years ago

@spattinson It's edited now. Thank you for your remarks.

databoy2k commented 5 years ago

Followed @vg8020's instructions. Had to amend the destination of the cookies file to /home/homeassistant/.homeassistant (running hassbian).

With that said, I'm not getting any google maps devices in my homeassistant instance. Was I supposed to remove username and password from configuration.yaml? I have no errors in my logs either.

hudecitydave commented 5 years ago

For me, running 0.85 under Raspberry 3 and hass.io google is dead:

2019-01-11 17:46:12 ERROR (MainThread) [homeassistant.components.device_tracker] 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 183, 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

Is there any workaround for hass.io users? Strange fact - everything was fine for me with 0.84.6. Now after updating to 0.85 I got the error for the first time.

tehstevo commented 5 years ago

@hudecitydave check out the thread here: https://github.com/costastf/locationsharinglib/issues/42#issuecomment-439731010 and, in particular, Lufton's hack (https://github.com/costastf/locationsharinglib/issues/42#issuecomment-439731010). I was having the same issue and his hack resolved it for me.

hudecitydave commented 5 years ago

@tehstevo Thanks, but that did not the trick for me somehow...

I still get this:

019-01-13 11:39:46 ERROR (MainThread) [homeassistant.components.device_tracker] 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 183, 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 65, in __init__
    self._update_info()
  File "/config/custom_components/device_tracker/google_maps.py", line 77, 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

I played around with the google cookies...

For me the custom component generates a file called: google_maps_location_sharing.cookies

My original component named it

.google_maps_location_sharing.cookies

Oh, what a mess...

tehstevo commented 5 years ago

The . in front means it's a hidden file. Delete the cookies and restart hass w the hack in place. That's what did it for me

spurgelaurels commented 5 years ago

I'm not clear on the areas of ownership here, but I believe this is directly related. The above workarounds are not working for me from several OS/python venvs. All giving me the same error as below.


Open the Google App, and tap 'Yes' on the prompt to sign in ...
Traceback (most recent call last):
  File "cli.py", line 143, in <module>
    main()
  File "cli.py", line 137, in main
    CookieGetter(args.email, args.password, args.cookies_file)
  File "/home/daphne/locationsharinglib/locationsharinglib/locationsharinglib.py", line 351, in __init__
    cookies_file=cookies_file)
  File "/home/daphne/locationsharinglib/locationsharinglib/locationsharinglib.py", line 218, in __init__
    self._authenticate()
  File "/home/daphne/locationsharinglib/locationsharinglib/locationsharinglib.py", line 256, in _authenticate
    self._submit_password()
  File "/home/daphne/locationsharinglib/locationsharinglib/locationsharinglib.py", line 303, in _submit_password
    self._handle_prompt(body)
  File "/home/daphne/locationsharinglib/locationsharinglib/locationsharinglib.py", line 330, in _handle_prompt
    response.raise_for_status()
  File "/usr/lib/python3.7/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://accounts.google.com/_/signin/challenge?TL```
rolfberkenbosch commented 5 years ago

I see if i'm right the issue (https://github.com/costastf/locationsharinglib/issues/42) seems to be fixed. But the tag of locationsharinglib has not been updated. So i cannot push a new commit (update) to home assistant git to use the new code. I have created a new issue (https://github.com/costastf/locationsharinglib/issues/55) the create a new tag. When the tag is created, i will send the new version to the home assistant git.

rolfberkenbosch commented 5 years ago

Update on this, i have created a pull request to use the new version 3.0.11 (https://github.com/home-assistant/home-assistant/pull/20322)

morhimi commented 5 years ago

Still facing this issue on 0.86.3 (HassIO)

2019-01-28 21:52:09 ERROR (MainThread) [homeassistant.components.device_tracker] 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 183, 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 439, 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 400, in get_shared_people
    for info in output[0]:
TypeError: 'NoneType' object is not iterable
aegjoyce commented 5 years ago

0.87 seems to reintroduce the error. I’m getting the same as the above

EDIT: fixed it by deleting the google maps cookie file and restarting twice

lleone71 commented 5 years ago

0.88.b0 still no success for me and non of the above workarounds work. :'(

original 0.88.b0 or @sherbang or @spattinson :

Traceback (most recent call last):
  File "locationsharinglib/cli.py", line 143, in <module>
    main()
  File "locationsharinglib/cli.py", line 137, in main
    CookieGetter(args.email, args.password, args.cookies_file)
  File "/home/homeassistant/ha-venv/temp/locationsharinglib/locationsharinglib/locationsharinglib.py", line 351, in __init__
    cookies_file=cookies_file)
  File "/home/homeassistant/ha-venv/temp/locationsharinglib/locationsharinglib/locationsharinglib.py", line 218, in __init__
    self._authenticate()
  File "/home/homeassistant/ha-venv/temp/locationsharinglib/locationsharinglib/locationsharinglib.py", line 256, in _authenticate
    self._submit_password()
  File "/home/homeassistant/ha-venv/temp/locationsharinglib/locationsharinglib/locationsharinglib.py", line 299, in _submit_password
    raise InvalidCredentials(body)
locationsharinglib.locationsharinglibexceptions.InvalidCredentials:
[["gf.sicr",null,null,5,null,[null,null,"type: FIRST_AUTH_FACTOR\n",1,null,"INCORRECT_ANSWER_ENTERED",null,null,1,6,null,null,null,null,null,"Luca Leone","llam.service.ha@gmail.com","https://lh3.googleusercontent.com/-1uMiaziHLbg/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfWh-OkZ4fnSYwGqqND3imTE8lRQA/mo/photo.jpg",null,null,1,1,{"1001":[1]
,"5001":[6,["gf.uicd","AAWk9lRUVN6hkKtjlaDqI6d7HNXh58-nWK8QicXvHQc3M_exY9-8T1TolSj6HZGKOXwY8hzgiahVjsCF5NANFGcAewL9fTKz-Jlqd8sudTfjmpna4L1B8wSOWwuYjC9-Y-x5yXbfek1Ns531W3cjuMXYOaiWjDSYCqRDB94gT9N4SIDqCzqv_2Q"]
]
}]
]
]

Using a previously save cookie : TypeError: 'NoneType' object is not iterable

Any hint ?

chelming commented 5 years ago

@lleone71 do you have multifactor auth enabled for your google account? I'm not sure it'll work with the locationsharing library. I created a new account and shared my location with it for this specific purpose.

lleone71 commented 5 years ago

@lleone71 do you have multifactor auth enabled for your google account? I'm not sure it'll work with the locationsharing library. I created a new account and shared my location with it for this specific purpose.

I created an ad-hoc account. I tried without 2FA, with 2FA and with 2FA but creating an application specific password.

I think I couldl wipe everything and start from scratch: a plain vanilla HA setup with only google maps enabled. Just to try...

L.

BlakeBiggs commented 5 years ago

@lleone71 Personally, I had an issue where locationsharinglib was not upgrading correctly via pip. Once I manually deleted the package files and reinstalled it, it began working.

shr00mie commented 5 years ago

@lleone71 do you have multifactor auth enabled for your google account? I'm not sure it'll work with the locationsharing library. I created a new account and shared my location with it for this specific purpose.

I created an ad-hoc account. I tried without 2FA, with 2FA and with 2FA but creating an application specific password.

I think I couldl wipe everything and start from scratch: a plain vanilla HA setup with only google maps enabled. Just to try...

L.

for what it's worth, my fork is designed specifically to work with 2FA via device authentication and has been flawless since 0.81.

designed and tested for ubuntu server standalone install variant, so any other config would require some input from wanting parties.

lleone71 commented 5 years ago

for what it's worth, my fork is designed specifically to work with 2FA via device authentication and has been flawless since 0.81.

designed and tested for ubuntu server standalone install variant, so any other config would require some input from wanting parties.

I'm running a headless Centos 7 (gui not installed). Install of your fork could be:

chrome: `( echo "[google-chrome]" echo "name=google-chrome" echo "baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch" echo "enabled=1" echo "gpgcheck=1" echo "gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub" ) > /etc/yum.repos.d/google-chrome.repo

yum -y install google-chrome-stable ` home assistant: git clone https://github.com/shr00mie/gmapslocsharing.git

?

Thanks, L.

shr00mie commented 5 years ago

@lleone71 thanks! added CentOS script to my readme. updated the dependencies while i was at it.

have you tried it? does it work for you?

lleone71 commented 5 years ago

@shr00mie , sorry for the late reply. I tried it but it doesn't work: nothing written into the log file (debug level), no errors/outputs displayed, nothing at all.

I managed to get something by manually grabbing the cookies SID, HSID, SSID, from a chrome session and these lines:

bash:

curl -s 'https://www.google.com/maps/preview/locationsharing/read?authuser=3&pb=' -H 'cookie: HSID=xxx SID=yyy SSID=zzz' > ./tmp1

python

import requests url= "https://www.google.com/maps/preview/locationsharing/read?authuser=3&pb=" r1 = requests.get(url, cookies={'HSID':'xxx;','SSID':'yyy','SID':'zzz'}) print(r1.content)

but I'm not a python coder so I stopped any further attempt.

After 15 days, the HSID/SSID/SID I stole from the chrome gmap session still work. May be putting them in the yalm file instead of username/password?

Luca.

PS: authuser=3 because I have a google multiuser environment. I think that for most people this should be authuser=0 or could be totally omitted.

aegjoyce commented 5 years ago

Another release, another relapse...

Broken again with update to 0.92 from 0.91.4. Unfortunately this time deleting the cookie file and restarting twice does not fix the issue:

Error setting up platform google_maps
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/device_tracker/__init__.py", line 177, in async_setup_platform
    disc_info)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/google_maps/device_tracker.py", line 39, in setup_scanner
    scanner = GoogleMapsScanner(hass, config, see)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/google_maps/device_tracker.py", line 60, in __init__
    self._update_info()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/google_maps/device_tracker.py", line 72, in _update_info
    for person in self.service.get_all_people():
  File "/usr/local/lib/python3.7/site-packages/locationsharinglib/locationsharinglib.py", line 439, in get_all_people
    people = self.get_shared_people() + [self.get_authenticated_person()]
  File "/usr/local/lib/python3.7/site-packages/locationsharinglib/locationsharinglib.py", line 400, in get_shared_people
    for info in output[0]:
TypeError: 'NoneType' object is not iterable

I note other users also encountering this issue again. Hello darkness my old friend...

robfish1956 commented 5 years ago

Same problem here.

shr00mie commented 5 years ago

@shr00mie , sorry for the late reply. I tried it but it doesn't work: nothing written into the log file (debug level), no errors/outputs displayed, nothing at all.

I managed to get something by manually grabbing the cookies SID, HSID, SSID, from a chrome session and these lines:

bash:

curl -s 'https://www.google.com/maps/preview/locationsharing/read?authuser=3&pb=' -H 'cookie: HSID=xxx SID=yyy SSID=zzz' > ./tmp1

python

import requests url= "https://www.google.com/maps/preview/locationsharing/read?authuser=3&pb=" r1 = requests.get(url, cookies={'HSID':'xxx;','SSID':'yyy','SID':'zzz'}) print(r1.content)

but I'm not a python coder so I stopped any further attempt.

After 15 days, the HSID/SSID/SID I stole from the chrome gmap session still work. May be putting them in the yalm file instead of username/password?

Luca.

PS: authuser=3 because I have a google multiuser environment. I think that for most people this should be authuser=0 or could be totally omitted.

@lleone71 hey man. sorry. just saw this. could you do me a favor and try replacing authuser=3 with authuser=<account.location.is.shared.with> and let me know if you're getting the expected output?

after digging around a bit, it looks like authuser=X can be either the order from 0 -> whatever which represents the accounts you're logging into google with on your session, or can be replaced with the specific account you're looking to target. If that's the case, i would just need to tweak a bit of code to get that resolved so we're not guessing numbers anymore.

give it a go with your test case and let me know if that works. i could implement and push in like 30 minutes after you confirm.

shr00mie commented 5 years ago

Hello darkness my old friend...

@aegjoyce

i got your darkside right here, brah.