Google Maps location sharing - New thread


#61

Good job Luke. Following your trouble shooting help me connect a bunch of dots. Slang for I learned a lot. :slight_smile:

I could not understand why if you could connect, why it would not update. What is different about your “google maps” that is different than mine? Could it be that different devices update differently? But the map then would have to render it differently. You have my curiosity up. I posted the location to the code below. I glanced at the code, keep in mind you are more familiar with it than I, are you seeing the “InvalidData” exception?
I could be in the wrong area, to me looks like the work is done in _populate function.
snippet:

class Person(object):  # pylint: disable=too-many-instance-attributes
    """A person sharing its location as coordinates"""

    def __init__(self, data):
        logger_name = u'{base}.{suffix}'.format(base=LOGGER_BASENAME,
                                                suffix=self.__class__.__name__)
        self._logger = logging.getLogger(logger_name)
        self._id = None
        self._picture_url = None
        self._full_name = None
        self._nickname = None
        self._latitude = None
        self._longitude = None
        self._timestamp = None
        self._accuracy = None
        self._address = None
        self._country_code = None
        self._populate(data)

    def _populate(self, data):
        try:
            self._id = data[6][0]
            self._picture_url = data[6][1]
            self._full_name = data[6][2]
            self._nickname = data[6][3]
            self._latitude = data[1][1][2]
            self._longitude = data[1][1][1]
            self._timestamp = data[1][2]
            self._accuracy = data[1][3]
            self._address = data[1][4]
            self._country_code = data[1][6]
        except IndexError:
            self._logger.debug(data)
            raise InvalidData

https://github.com/costastf/locationsharinglib
Also I found this issue https://github.com/costastf/locationsharinglib/issues/26 The last line says Pull Request fixed issue. Must be something different.
https://github.com/costastf/locationsharinglib/pull/25/commits/e0cb8e6afd2269c7cadbdcc77b33b0a8ada7584a
Also, I started to reply but got sidetracked, you can run the locationlibsharing from the command line. You might try the latest branch, although the description does not seem to relate to your issue.


#62

The error is located on the string representation methods used in the Person class. They try to convert Null values to dates and integers and so on. I downloaded newest locationsharinglib inside my ssh addon container and debugged with a small self made piece of code. Now i placed the locatiobsharinglib in my config folder below deps together with a .version and modified the local google-maps component to have requirement to that newest version. All works fine now. The wrong of the 4th person with missing timestamp and no current location just gets ignored now.


#63

Still facing some issue on Google Location Sharing

From the log, I can see that all the 3 google account that shares location with my google account are tracked perfectly.

But in HA none is shown.
I can see an error
[locationsharinglib.Service] Could not load people, response:

What can be the issue?

@lweberru I’m facing an issue like o equal to yours.
What was your solution?

BTW, I’m on HASSIO so I have very limited possibilities… :thinking:

Thanks

018-07-18 12:22:07 DEBUG (SyncWorker_16) [locationsharinglib.Service] )]}'
[[[["xxxxxxxx","https://lh3.googleusercontent.com/-xxxxxxxx/mo/photo.jpg",null,"NAME-A ",null,null,null,"xxxxxxx"]
,[null,[null,00.000000,11.1111111]
,xxxxxxxxx,"street-location",null,"IT",7200000]
,1,2,"xxxxxxxxxx",null,["xxxxxxxxx","https://lh3.googleusercontent.com/-xxxxxxxx/mo/photo.jpg","NAME-A","NAME-A"]
,1]
,[["yyyyyyyyyy","https://lh6.googleusercontent.com/-yyyyyyyyyyy/mo/photo.jpg",null,"NAME-B",null,null,null,"yyyyyyyyyy"]
,[null,[null,22.2222222,33.3333333]
,yyyyyy,"street-location",null,"IT",7200000]
,1,1,"yyyyyyyyy",null,["yyyyyyy","https://lh6.googleusercontent.com/-yyyyyyyyyy/mo/photo.jpg","NAME-B","NAME-B"]
,0]
,[["zzzzzzzzzzz","https://lh6.googleusercontent.com/-zzzzzzzzz/mo/photo.jpg",null,"NAME-C",null,null,null,"zzzzzzzzzzz"]
,null,null,null,"zzzzzzzzz",null,["zzzzzzzz","https://lh6.googleusercontent.com/-zzzzzzzzz/mo/photo.jpg","NAME-C","NAME-C"]
,1]
]
,null,"xxxxx","xxxx",null,null,"xxxxxx/xxxxxx/xxxxxxx/xxxxxx/xxxxxx+xxxxxx/xxxx/xx/+xx/+xxxxx/xxxx+xxxxx+xxxx+xxxxx",xxxxx,[xxxxx,[null,[null,00.00000,11.111111]
,xxxxxx,"street-location",null,"IT",7200000]
]
,null,[1,[[[30000,60000]
,null,3600000]
,[[30000,60000]
,null,null,1]
]
,null,1]
]

2018-07-18 12:22:07 DEBUG (SyncWorker_16) [locationsharinglib.Service] Could not load people, response: [[[['xxxxxxxx', 'https://lh3.googleusercontent.com/-xxxxxxxxxx/mo/photo.jpg', None, 'NAME-A.', None, None, None, 'xxxxxxx'], [None, [None, 00.00000, 11.1111], xxxxx, 16, 'street-location', None, 'IT', 7200000], 1, 2, 'xxxxxx', None, ['xxxxxx', 'https://lh3.googleusercontent.com/-xxxxxxxxx/mo/photo.jpg', 'NAME-A', 'NAME-A'], 1], [['yyyyyyyyyyy', 'https://lh6.googleusercontent.com/-yyyyyyyyy/mo/photo.jpg', None, 'NAME-B', None, None, None, 'yyyyyyyyyy'], [None, [None, 22.22222, 33.333333], yyyyyyyy, 92, "street-location", None, 'IT', 7200000], 1, 1, 'yyyyyyyyy', None, ['yyyyyyyy', 'https://lh6.googleusercontent.com/-yyyyyyyyy/mo/photo.jpg', 'NAME-B', 'NAME-B'], 0], [['zzzzzzzzz', 'https://lh6.googleusercontent.com/-zzzzzzzz/mo/photo.jpg', None, 'NAME-C', None, None, None, 'zzzzzzzz'], None, None, None, 'zzzzzzz', None, ['zzzzzz', 'https://lh6.googleusercontent.com/-zzzzzz/mo/photo.jpg', 'zzzzz', 'zzz'], 1]], None, 'zzzzzz', 'zzzzz', None, None, 'zzzzz/zzzzz/zzzzzz/zzz/zz+zz/zzz/zzz/+zz/+zzzzz/zzzz+zzz+zz+zzzz', 5, zzzz, [zzz, [None, [None, 44.44444, 55.5555], zzzzz, 33, 'zzzzzzzz', None, 'IT', 7200000]], None, [1, [[[30000, 60000], None, 3600000], [[30000, 60000], None, None, 1]], None, 1]]

#64

One of your tracked accounts is missing a must have data, which results in a failing data type converstion within the library. To fix it you need to work with the newest locationsharinglib. For that you need to have a local custom component of the google_maps.py with a changed requirement setting:

1.) place a copy of the goog_maps.py into /config/custom_components/device_tracker
2.) change requirements in the file to:

REQUIREMENTS = ['locationsharinglib==2.0.11']

If it is still not working you can also make a copy of the library and modify it. Let me know if it is not working, than I tell you what to modify there.

Regards
Lukas


#65

Thanks @lweberru

Where I can find the goog_maps.py?


#66

Take the official source from git:

Regards


#67

@lweberru After placing the google_maps.py in /config/custom_components/device_tracker with the requirements files changed, rebooted, nothing changed, same error.

I can have a local copy of the library even if I am on HASSIO?

Thanks again


#68

Do you have the note, that you are using a local copy of this component like this?

2018-07-18 16:07:56 WARNING (MainThread) [homeassistant.loader] You are using a custom component for device_tracker.google_maps which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

Do you see home assistant downloading the new locationlibshared version during docker start? Think this should be visible via
hassio su logs
if this is the case, than I would install a local copy of the locationsharinglib into the directory:

/config/deps/lib/python3.6/site-packages/locationsharinglib

place the following files there:
locationsharinglib.py
locationsharinglibexceptions.py
.VERSION

you get the sources from

I modified the file like the following:

replace

return datetime.fromtimestamp(int(self.timestamp) / 1000)

with

try:
  return datetime.fromtimestamp(int(self.timestamp) / 1000)
except (IndexError, TypeError):
  return 0

but I am no python developer…


#69

I can see the message regarding usage of local copy.

I already have a locationsharinglib folder, actually I have two

13

inside the first folder:

23

The date inside the file is the same as the one you linked:
__date__ = '''2017-12-24'''

should I modify as you wrote in the message?

What about the other folder? Should I remove it?

Thanks


#70

I am still not really and fully familar with home assistant architecture and python, so perhaps someone else can say how exactly these folder and file structure should look like? Dont want to share my not existing knowledge :smile:


#71

Thanks @lweberru

Strange thing is that I have set up a new fresh install of latest version of HA without adding any device, except the ones discovered, without modifying any config file, except adding

device_tracker:
  - platform: google_maps
    username: MY_USERNAME
    password: MY_PASSWORD

and I still get no tracking.

In known_devices.yaml I get

google_maps_myemailgmailcom:
  hide_if_away: false
  icon:
  mac:
  name: google maps myemailgmailcom
  picture:
  track: true

instead of the address to be tracked.


#72

Hey, not sure if this will help anyone else but about a week ago i started using the google location tracking and all was great then all of a sudden It just stopped working,

After a bit of searching, i came across this thread and followed the steps from here down:

I’ve added the custom component, added the debug logging which gave me the error of “Could not load people, response:”

After a quick google I came across this:

Which led me to just trying jedi7’s pull request

(https://github.com/costastf/locationsharinglib/pull/25/commits/e0cb8e6afd2269c7cadbdcc77b33b0a8ada7584a)

I’ve just tried it and it’s working perfectly for me .

I may have repeated someone elses advice so apologies if i have but it fixed things for me and thought it might help others.


Google Maps Location Sharing not updating
#73

Hey, I have google maps set up in my HA and it seems to be working ok. Does anyone know if you can see up a work zone? I tried setting one up in the google maps app, but it doesn’t show at work in HA.


#74

Zones are defined within HA itself, look documentation about zones. There is also a configure option.


#75

Got it, thanks.


#76

Thanks radeon for the tip. My kids went out of state for a while where they have poor to no cell signal. Knowing about this apparent bug of phones reporting bad location info and it keeping all/some Google Maps devices from being tracked, I unshare my kids phone location to my HA Google account used for device tracking. This fixed the issue for my phone and it’s being tracked again now. I could see in the logs that the 3 devices were reporting location info, but my kids info was formatted oddly compared to my phone’s info.


#77

@radeon i am missing something here. Placed the file “google_maps.py” modified it but nothing happened
Where did you put the jedy .py script ?


#78

I was having the same issues and I finally resolved it by doing the following:
Create a new gmail account for tracking and have your friends and family allow tracking on that account. DO THIS BEFORE YOU PROCEED ANY FURTHER!

In the /config directory delete file:

.google_maps_location_sharing.cookies

Delete any entries in known_devices.yaml referring to google_maps (or just delete the entire file)

Insert ONLY the google account you set up to do the tracking in your configuration.yaml like this:

 #Tracking stuff
 device_tracker:
   - platform: google_maps
     username: [email protected]
     password: ########
     track_new_devices: true

Reboot

In your groups.yaml create something like this:

awesome_people:
  name: Awesome People
  view: no
  entities:
    - device_tracker.google_maps_xxxxxxxxxxxxxxxxxxxxxxx
    - device_tracker.google_maps_xxxxxxxxxxxxxxxxxxxxxxx

(those x’s will be a unique id you will see in the known_devices.yaml file)

Clean up:
You may want to go back into the known_devices.yaml file and put a usable name in the name: field.
After 3 days of pulling my hair out, I fixed myself a cocktail and smiled.


#79

Not sure anyone saw this pull request. I was looking for the GPS accuracy option a few days ago and it looks like someone already has the idea and feature possibly coming soon. I’ll definitely be pulling the files in a few and testing it on my production HA install.


#80