Google Maps location tracking - "Error setting up platform google_maps"

Hello, I started having problem with google maps too. Does tado inform the battery in the phone?

I managed to take the newest version of locationsharinglib (4.0.1) and the google_maps component and make them into a custom component, that seems to be working so far:

1 Like

Sorry, only just saw your message. There’s no additional battery impact from what the Tado all would use otherwise. But, it will only say whether you are home–not where you are when you are not home.

perhaps i missed something there. the git you linked contains a package that overwrites device_tracker.py but doesn’t overload anything in the locationshareinglib. so in order for this to work i have to manually upgrade the locationshareinglib to 4.0.x first?

i tried the custom_component as-is, it did not work. error was “invalideuser: /config/.google_maps_location_shareing.cookies.myuser.” looks like it was trying to put the cookie file name to where the “username” is suppose to be, something is not quite right.

You want to put the whole gmaps folder in the custom_components subdirectory of your .homeassistant config directory. It should upgrade locationsharinglib to 4.0.1 when you restart.

/home/homeassistant/
├── .homeassistant
│   ├── custom_components
│   │   └── gmaps

You have to create the cookie yourself and put it in your config directory, naming it with the same username (slugified,) ie, if the account you use for the google maps user is [email protected], you would name the cookie

.google_maps_location_sharing.cookies.example_gmail_com

If you were previously using the google_maps component, that file should already exist and you can copy over it.

i didn’t have issue with where to put the custom_components and already have a cookies file previously generated by the cookiegettercli.

but there is really only one file in the gmaps package: “device_tracker.py”. is that really right? i don’t see how it could upgrade the locationsharinglib like that?

No, there are three total:

custom_components/gmaps/
├── device_tracker.py
├── __init__.py
└── manifest.json

The manifest.json file is what tells HA to upgrade locationsharinglib (which just updated to 4.0.2)

i saw the requirements specifying locationsharinglib 4.0.1 but wasn’t aware that this would actually cause the package to be upgraded…

in any case, it is not working for me as locationsharinglib stayed at 3.0.11… i will dig around some more and maybe try it with a manual upgrade and hope for the best.

thanks for the effort. i’m glad to hear it worked for you, this gives me some hope at least. :slight_smile:

Interesting. I tried it on a couple machines and it did the upgrade. The way I discovered the manifest is that I would upgrade it with pip then restart and it would downgrade :slight_smile:

I have this in my home-assistant.log when it gets the package:

2019-07-10 15:13:40 INFO (SyncWorker_5) [homeassistant.util.package] Attempting install of locationsharinglib==4.0.2

How are you running HA? Mine is using venv. Maybe it’s different? If you are using venv you could try this after activating the venv:

pip install locationsharinglib -U

and then restart and watch the log

it did not work for me in hass.io or hass by itself in docker. makes sense if you had it in a python venv it may behave differently.

1 Like

it worked after manual upgrading locationshareinglib to latest version (4.0.2 i think). not the best thing for some since the changes will not survive updates for those running hassio or using pre-built hass docker/images. but this is the first/only time i got google gps tracking working so no complains from me for sure! :slight_smile:

Thanks @dennyreiter!

I’ll try setting it up in Docker, etc and see if I can figure out how to make it better. The author of locationsharinglib says he was going to tackle upgrading the integration soon, so it might be a moo point.

I also have a hass.io, could you help me in setting it to finally work? I have already added cookie, custom component in config directory and added device_tracker setting in configuration.yaml but still nothing

This may be a stupid question, but for the life of me I can’t get the cookie thing working - I’ve tried doing it on a Mac, but get the ‘no packages found’ when trying to pip install it.

My server runs on a low power PC running ubuntu server 18.04, so don’t have access to a desktop environment to get the cookie using that. I have a windows PC, but it’s running windows 10, so don’t know if it’s compatible. In any event, I’m really confused about how to get the cookie file?

Any chance there’s an ‘idiots guide’ for it? The documentary isn’t that helpful.

You can install the cookie getter on WIndows, but you have to install an entire python environment to do it. I’ve been messing trying to create a windows executable but have failed thus far. This extension might work, but I have not tried it yet for this, though it did work for the Alexa component:

I believe it exists for Firefox, also.

If you try it and it works, let me know and I can update the README.

I haven’t used hass.io, but can you turn on logging in it?

locationsharinglib: debug

Will give you more info

I just set up hass under docker and it seems to have upgraded locationsharinglib automatically for me. Now on to see about hass.io. I think I have a spare rpi laying around.

hassio is annoying in that those extra layers that supposed to make things “easier” obscures a lot of stuff from end users. but at end of the day ha is still just a managed docker image inside hassio… i’m surprised your docker install updated the lib automatically, mine did not for some reason.

main steps are highlighted in @dennreiter’s git readme.

the hard part for most people is figuring out how to generate that cookies file manually via mapscookiegettercli. exactly how to setup it up depends on what you have to work with but the idea is to allow the script to hijack a cookies file while you manually sign into maps.google via a browser. you will need to know how to setup a python environment on a box with a gui. google search should return a bunch of discussions on how others set things up. for me, i made a Ubuntu VM, installed chrome and did the whole thing via remote x display. a physical box might be easier.

if you have the manually generated cookie and gmaps custom_component both in place and it still does not work (getting errors along the line of “invalid user”) then you probably have the same problem as me. if the locationsharinglib in hassio is not being updated to the latest version it won’t work with @dennreiter’s mod. the newer locationlib has breaking changes as the variables in api are different from older versions. i got around the problem by manually upgrading the files inside the ha docker image with latest 4.0.2 files downloaded from @costastf’s Git. on my install those files are under something like /usr/local/lib/python3.7/site-packages/locationshareinglib. in theory it should be much better/cleaner to overload those lib files via custom_components but i couldn’t get it working that way.

just keep in mind if you mess with the hass docker image you will have to do it again when you upgrade hassio. no ideal but at least it works for now.

In my case, generating a cookie was not a problem but thank you for an explanation. Last time I was trying to update locationshareinglib inside docker using
docker exec -i -t CONTAINER_NAME pip install locationsharinglib==4.0.2 and manualy bump manifest and device_tracker.py located in usr/src/homeassistant/homeassistant/components/google_maps
I will try one more time using your tips