Google Maps location sharing

Working for me too. Had some trouble getting it to detect when I was home, then realized my GPO coordinates for home were wrong. Doh! Thanks for taking the time to work on this!

I monitored it for a few hours (which is the best way for Google to ban your IP, be careful, lol), I couldn’t find any unreasonable values for that variable.

I was actually exposing that field as accuracy but got a report from @michaelarnauts about a value that was imposible so I removed that. Lets be a bit m ore confident that that is the correct one before I add it back in.

Thanks you and @michaelarnauts for all your hard work. I patched the component to show the accuracy and added a min_acc of 100 meters to the _update_info method to see if that decreases the number of errors (which I do attribute to caching or similar, as I often find values that are barely two blocks away). I’ll keep you guys posted on how the accuracy varies and if I got the errors decreasing.
Also I just checked my current gps accuracy (17, which I assume to be meters) and is not that far from the 21.5 meters that GPSLogger shows on my phone. I do believe that Gmaps uses something to artificially pump that figure up.

Thank you for your hard work too! Keep us updated on how this testing goes and if you get somewhere make an MR (proper credits will of course be given) and let’s make a component that rocks!

I needed sudo to install the locationsharinglib

sudo pip install locationsharinglib

It seemed to install fine but I get the following error

pi@raspberrypi:~/.homeassistant $ sudo python
Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170124] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> username="tracking email address"
>>> password="password for above"
>>> from locationsharinglib import Service
**Traceback (most recent call last):**
**  File "<stdin>", line 1, in <module>**
**ImportError: No module named locationsharinglib**
>>>

Hi @Esiravegna, how is the testing going? Is it looking good for you? Should we have a look at your changes if they work for you and merge?

1 Like

Trying to figure out exactly where I’m going wrong with the Python piece:

username=“myusername”
password=“mypassword”
from locationsharinglib import Service
Traceback (most recent call last):
File “”, line 1, in
File “locationsharinglib/init.py”, line 38, in
from .locationsharinglib import Service, Person
File “locationsharinglib/locationsharinglib.py”, line 39, in
from bs4 import BeautifulSoup as Bfs
File “bs4/init.py”, line 35, in
from .builder import builder_registry, ParserRejectedMarkup
File “bs4/builder/init.py”, line 7, in
from bs4.element import (
File “bs4/element.py”, line 10, in
from bs4.dammit import EntitySubstitution
File “bs4/dammit.py”, line 14, in
from html.entities import codepoint2name
ImportError: No module named html.entities
service=Service(username, password, “google_maps_location_sharing.conf”)
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘Service’ is not defined

Seems like your python environment is busted. Beautifulsoup seems to be partially installed and thus unusable.

Thanks! Uninstalled and reinstalled BeautfulSoup and it created the file.

thanks for this component,

i got this componen working, but also facing the hit and miss in the zone.
but this happens only to one off the two devices i use.

the only differents i see is when i look in the dev_panel at the device state attributes:
device 1 is showing in the address the long / lat coordinates
device 2 is showing the actual addres ( street, city and country )

device 1 is working without hit and miss
device 2 has the hit and miss problem

Hey @costas, they’re doing fine, I rarely, if ever, saw any values above reasonable 400 mteres or so, especially on the move, I do believe the 1500 on the previous measurements were related to using a cell tower as a location, which google sometimes uses and its for sure quite bad in accuracy terms.
There are no changes of relevance on my end: I just reverted to your branch in which the accuracy was reported and used it.
Thanks a lot!

1 Like

@michaelarnauts? Should I reimplement the accuracy and you can expose it and see where that takes us?

Is there a way to remove the entity picture? I really want to use an icon for my view, but I cant because pictures are higher priority than icons


I’ve had pretty bad results when using those values. I had a lot of 1500’s that’s make the result pretty useless. The lat/long values were spot on, so I assume those accuracy values were not correct.

Maybe if somebody can do some more testing with GPS disabled or by playing with the android location settings?

In case it’s helpful, I’ve been suffering of state changes between ‘home’ and ‘not_home’ since I installed the component when we are steady at home and our phones are not been used.

When I am reported to be ‘not_home’, I open Google Maps using the ‘target’ account which is monitoring location sharing and I can see that the accuracy is really bad, and it centers us in a huge circle of maybe 3 or 4 km radius. The result, obviously, is that we are located about 200 or 300m away of home, but it could be more as it is taking the center of such a huge circle. As @Esiravegna pointed, I am sure it is using a cell tower as a reference.

Then, some time after (without us doing anything), it returns using more accurate location and we are back home. I suppose it’s the result of Google Maps updating its location without using much power. I don’t know in what circunstances it switches between gps and network location


GPS accuracies always are tricky to handle for presence detection, whereas you’re using GoogleMaps or Owntracks or whatnot. What I did was
to use a group for tracking presence, with one of the components of the person being a GPS tracker and the other a router or similar.

1 Like

For the purpose of home assistant, I assume those huge accuracy’s are not useful. If that specific value really is the accuracy, maybe we shouldn’t register locations when the accuracy is above a specific threshold?

1 Like

Indeed. Owntracks, alas, I’m pretty much sure that ALL GPS device trackers, suffers from the same problem and have an ad-hoc parameter for that, accuracy: https://home-assistant.io/components/device_tracker.owntracks/

@michaelarnauts how about implementing the filtering based on the accuracy if above some threshold?

2 Likes