Google Maps location sharing - New thread


#21

That is exactly what I am using.
So, if you delete the cookie, do you have to approve it again?
Also, I think it only tries to login once at startup. That is why to get it to try, you have to restart.
BTW, there is no telling how many times I rebooted. But it did work. :slight_smile:


#22

I dont need to approve it. And I restarted endless times now.
I am a bit disappointed of home assistant now. I see lot of features which dont really work but are open to be used by the community. I have no problem to use open source solutions and be part of the community. But the system looks really not ready to use. There are so many different features which the solution officially supports, but most of them are not more than a beta first release. The HUE light support for example is my main use case and is not really good supported. Scenes have to be generated manually with much effort again. If I configure systems which are not always online, like my TV or my camera or my chromecast device I get endless error messages in the log file and if they are off during boot they dont even get discovered and not existant in the system… and much more
Regards
Lukas


#23

https://www.home-assistant.io/components/device_tracker.google_maps/

on the top right side
you will see

Introduced in release: 0.67
Source: device_tracker/google_maps.py

Click on that it will take you to the GitHub(official - The one that is used on hassio)

https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/device_tracker/google_maps.py

it is still @ 2.0.2 change it to 2.0.7
REQUIREMENTS = [‘locationsharinglib==2.0.2’]

I didn’t have to approve mine, I did not see any request to approve in google when I got it to work.

also very important

make sure only these 2 files are in the /config/deps/lib/python3.6/site-packages/locationsharinglib/
/config/deps/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py
/config/deps/lib/python3.6/site-packages/locationsharinglib/locationsharinglibexceptions.py


#24

I wonder what are the differences? Two factor? I am not using two factor.


#25

I don’t have 2 factor enabled also.

Initially when I set it up, approval was needed. I only did it a few times, but after that I wasn’t getting it anymore .

What is odd I have this[google_maps_none:] as entity name in known_devices.yaml which works for me as I don’t have that long odd alphanumeric after google_maps_ of which I was getting initially when it was not working.

So I have:
device_tracker.google_maps_none


#26

@Vin: Ok I downloaded that version of google_maps.py and changed as explained the requirements line, removed the cache file and restarted the system. No errors in the log and no update of the tracked devices. Is there a chance to enable some kind of debug feature, to see what the service is doing?

Regards
Lukas


#27

I activated some logging now:

logger:
  default: warning
  logs:
    homeassistant.components: critical
    homeassistant.components.device_tracker: debug

and got this in the logs:

2018-06-07 11:26:57 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
2018-06-07 11:27:29 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.fritz
2018-06-07 11:27:31 INFO (SyncWorker_12) [homeassistant.components.device_tracker.fritz] Successfully connected to FRITZ!Box 6490 Cable (lgi)
2018-06-07 11:27:31 INFO (SyncWorker_12) [homeassistant.components.device_tracker.fritz] Scanning
2018-06-07 11:27:32 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.google_maps
2018-06-07 11:27:47 INFO (SyncWorker_6) [homeassistant.components.device_tracker.fritz] Scanning
2018-06-07 11:28:08 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-06-07 11:29:48 INFO (SyncWorker_13) [homeassistant.components.device_tracker.fritz] Scanning
2018-06-07 11:31:48 INFO (SyncWorker_9) [homeassistant.components.device_tracker.fritz] Scanning
2018-06-07 11:33:49 INFO (SyncWorker_0) [homeassistant.components.device_tracker.fritz] Scanning
2018-06-07 11:35:50 INFO (SyncWorker_0) [homeassistant.components.device_tracker.fritz] Scanning
2018-06-07 11:37:51 INFO (SyncWorker_3) [homeassistant.components.device_tracker.fritz] Scanning

and that again all I get…


#28

That is strange and got me thinking…
First, Luke, If you go to the user that you are using to expose the shares, do you see the users that are sharing their locations.

Example, I have UserShare. Then my wife and I share our location with UserShare. If I go to the maps of UserShare, I will see the locations of my wife and I.
Luke, do you see the shared locations in your UserShare maps?

Vin, that is strange. So if you goto the states tab on the HA dashboard, there should be something like “device_tracker.google_maps_xxxxLongNumberxxxxx” If I hear you right, you see “device_tracker.google_maps_none”. How many users are you sharing?

Are you seeing the “device_tracker.google_maps_xxxxx” in your state (http://192.168.x.x:8123/dev-state) list?
If so, sorry, been troubleshooting the wrong issue. If you do see it, then you are connected and we need to look elsewhere.
Something I learn at one time I did not think I was being updated. When I clicked on my “home/away” icon it would be a long time. For example my wife is still home, her last update is 11 hours ago. That was when she got home. I started noticing that the last update was when we arrived at a location. Then I remember google only updates when there has been a change. That is why it save battery.


#29

Yes manuelle with google maps itself all works fine. I see all 4 with this account shared people. When I dont have the devices commented out I see thos device_tracker.google_maps_xxx instances in the list. If I comment them out, they are not recreated. I have those entries within the known_devices from a moment when it worked.


#30

Oh, I would think if they are showing up in the states list, they should be working. My bad, I did not understand the issue. :blush:

Not sure what you are trying to accomplish or exception is?


#31

Please see also:


#32

@penright I only have one now, I used to have 2 but since prior to getting it to work, I got tired and moved my wife tracker to IOS with the ha app.

@Lukas if you delete the cookie and remove or comment out the google_maps_ entity on your known_devices.yaml after your reboot if it is working properly the cookie and the entity google_map_ known_devices.yaml will be recreated.

I will try to add my wife again to see if that makes a difference.


#33

ok. I have added my wife, I delete the cookie and the google_map_xxx in the known_devices.yaml and rebooted.

cookie and google_map_xxx got created after reboot. For mine the recreated google_map_xxx is still google_map_none: my wife got google_maps_117667326098977333154:

At this point I’m not sure if it is working as we are both home.

I will monitor and post later.


#34

Confirmed its working, now tracking my wife as well and the shared location are updating for myself and my wife.

update:
lol… I figured out why mine was saying google_map_none. Its because I was not sharing location from my other account which I thought I was tracking. Probably the new feature mentioned above to track your self without another account.


#35

Anyone seen these before in the log?

2018-06-10 11:54:43 ERROR (SyncWorker_9) [locationsharinglib.Service] Unable to parse response :<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content="initial-scale=1"><title>https://www.google.com/maps/preview/locationsharing/read?authuser=xxx</title></head>
<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="e=document.getElementById('captcha');if(e){e.focus();}">
<div style="max-width:400px;">
<hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>
<form action="index" method="post">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div id="recaptcha" class="g-recaptcha" data-sitekey="6LfwuyUTAAAAAOAmoS0fdqijC2PbbdH4kjq62Y1b"></div>
<input type='hidden' name='q' value='EgR5LUZxGOmX8tgFIhkA8aeDS4S_2bAiybk5Fx7asprnycQj3F1dMgFy'><input type="hidden" name="continue" value="https://www.google.com/maps/preview/locationsharing/read?authuser=xxx">
<input type="submit" name="submit" value="Submit" style="font-size:18px; padding:4px 0;"><br><br><br>
</form>
<hr noshade size="1" style="color:#ccc; background-color:#ccc;">

<div style="font-size:13px;">
<b>About this page</b><br><br>Our systems have detected unusual traffic from your computer network.  This page checks to see if it&#39;s really you sending the requests, and not a robot.  <a href="#" onclick="document.getElementById('infoDiv').style.display='block';">Why did this happen?</a><br><br>
<div id="infoDiv" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">
This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the <a href="//www.google.com/policies/terms/">Terms of Service</a>. The block will expire shortly after those requests stop.  In the meantime, solving the above CAPTCHA will let you continue to use our services.<br><br>This traffic may have been sent by malicious software, a browser plug-in, or a script that sends automated requests.  If you share your network connection, ask your administrator for help &mdash; a different computer using the same IP address may be responsible.  <a href="//support.google.com/websearch/answer/86640">Learn more</a><br><br>Sometimes you may be asked to solve the CAPTCHA if you are using advanced terms that robots are known to use, or sending requests very quickly.
</div>

IP address: 121.x.x.x<br>Time: 2018-06-10T02:24:42Z<br>URL: https://www.google.com/maps/preview/locationsharing/read?authuser=xxx<br>
</div>
</div>
</body>
</html>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/locationsharinglib/locationsharinglib.py", line 386, in _get_data
    data = json.loads(response.text.split("'", 1)[1])
  File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/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)

I’ve opened the website in the error and finished the captcha, but will see whether it comes back.

Edit: Solving the captcha didn’t help, these come up in my logs every 1 minute.


#36

yup issue is logged here:

in my case i just wait a few hours until it passes. I am testing 2.0.7 of the library and so far no signs of this issue. I think 0.71 includes this version.


#37

Thanks I’ll monitor that thread. The captcha says that the captchas will stop after the requests stop, so I disabled the component from homeassistant for a few hours and then restarted and it seems to be working again. Its the first time its happened after using it for a month or two.


#38

yea in my case I just let the error run and after 3 hours it stops and the component starts working again.


#39

Same here, very annoying. But that´s on the Google side, so there´s nothing to be done about it…


#40

yea we need to keep commenting on that bug I linked. 2.0.7 was supposed to fix this. If you guys see the error make sure to comment on the bug with the error message so it can be fixed. I personally have not seen it since I switched to 2.0.7.