Tracking and mapping one or more devices using Home Assistant, Google Sheets, Google Maps Api, and IFTTT. Similar to Google Maps Timeline feature.
Displays the history of a Home Assistant device tracker (e.g. phones) on a Google map. Uses Google Sheets as data storage.
I am aware, that all this could be done a lot easier with a small python script and a local file or sending a PUT REST to Google Sheets or even using the local history. I prepared this as a small training project that goes through a lot of stuff.
You can also ignore most of the stuff in the git and just feed a local CSV file to the map.
Features:
Now with multiple devices!
Date filters: day, period (you can go back in time as long as you want);
For now it’s one device per map (any type of device that feeds coordinates). If you send data without any device tag (like now), from multiple devices to the same Google sheets file it will be a bit of a mess.
You either: create a different map for each device or send a device tag together with the other data and create a filter in the html to organize it a little. If there is enough interest I will implement proper multiple device support. Myself, i don’t need it (for now). --
It supports multiple devices now.
Hey, just implemented your setup for the panel iframe, but no map shows up on the front end, there are three entries in the google sheet, and I get the following in console.
Excellent! If everything works fine, and you agree I would like to add it to the git (crediting you).
Something to consider when using this approach is that you can’t go back in time too much (limited by your database purge). Also the URL should be edited to allow dynamic dates.
I get the following with any key used from different accounts:
"Google Maps API error: InvalidKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key-map-error"
"TypeError: Cannot read property 'push' of undefined
at https://null.jsbin.com/runner:96:22
at Array.forEach (<anonymous>)
at https://null.jsbin.com/runner:91:17
at Object.<anonymous> (https://d3js.org/d3.v4.min.js:2:64779)
at k.call (https://d3js.org/d3.v4.min.js:2:99927)
at XMLHttpRequest.e (https://d3js.org/d3.v4.min.js:2:63355)"
"Google Maps API warning: InvalidKey https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key"
"Google Maps API error: InvalidKeyMapError =
The API key included in the script element that loads the API is not found. Please make sure you are using a correct API key. You can generate a new API key on the Google API Console.
As you just written you have a bad API key. Go to the Google Api Console and create a new one. Before that enable the Google Maps Api. It takes a few minutes for the Api key to activate once created.
No idea how to help you. Google might help you more than me here (or not). Read a bit about the keys, maybe you are not getting or activating the right one or placing it correctly in the URL.
I have a SmartHome system would like to track again SmartHome system my location of the mobile phone to control various things.
Is there a possibility to get the data only with a request of course with the Abi key.
I just need the coordinates everything else I can do in large format in Json format.