Posts

1 ) Introduction & prerequisite

Introduction Hi, I quickly knocked up a not so elegant way of my kids asking Google Home asking where I am and it replies with my location and distance away. It came about when I got home the other day and they said they'd asked it where I was and it couldn't give them an answer. This method is not easy and not for the faint hearted. It's something I knocked up quickly and should be fairly easy to follow. The main downsides are: It will be redundant if Google allow us to hook into their pre-existing Location Sharing or Life 360 finally get their app working with Google Home and not just Alexa It needs a computer to always be on (PC/Mac/Linux/Pi) It's not free, it uses 2 paid for Android apps, luckily for me I'd already bought them, they are around £6 in total, something that may put you off instantly, however, they are brilliant apps and can be used for so much more than just this. Prerequisite You need to have a PC, Mac, linux PC or a Pi running Ho

2) Get free webspace

Get Free Webspace I code in PHP (not very well!), for a section of this it requires PHP so you need some webspace with PHP and cURL enabled. I have found a highly recommended provider called 000webhost.com  - I've only been using it 2 days but they were recommended to me elsewhere. Sign up to there or anywhere else that has PHP and cURL enabled, confirm your email etc and remember the URL you were given for step 3.

3) Android Apps

Android Apps Before we create the fist step, we need to install 2 Android apps which we need data from. 1) Tasker, buy it from the Play Store here . 2) Auto Remote (tasker plugin), buy it from the Play Store here . AutoRemote Open the app, on the top bar click the 2nd icon that looks like a mobile phone On the top bar again press the IFTTT icon (orange, blue & black triangle) Visit  https://ifttt.com/services/maker_webhooks/settings and get the code from the URL after /use/ Enter this code into Auto Remote Go back to the main screen and there is a URL in the middle of the screen, click it and send it to yourself (email, messenger etc). Once received on your computer or phone, open it so you get the full URL, not the shortened one. From the URL extract the long key and save it. Tasker Warning: Tasker is not very user friendly! Open Tasker, press the plus in the bottom right and choose "event". From the list choose "Plugin" and then "Au

4) IFTTT part 1

IFTTT Part 1 Go to IFTTT & create a new applet. Choose Google Assistant as the "IF" with "Say a simple phrase" Set the what you want to say as something like "Where is dad" with alternates like "where's dad", "where is my dad" I set the response to be: "locating, you will receive a response shortly" Move on to the "THAT" part and choose Webhooks then "make a web request" Set the URL to be the following but use the autoremote key you got in step 3 https://autoremotejoaomgcd.appspot.com/sendmessage?key=INSERT_YOUR_KEY_HERE&message=LocationRequested Leave the rest of the options as they are So, now we are at this point: You say "hey google, where's dad?" That uses IFTTT to send a webrequest to AutoRemote which uses your key to forward it to your device. This is then picked up by Tasker which forwards your location to the URL you setup.

5) Website

Website Now we need to insert PHP that will take you location and change it into something easy to understand. I've written a script which you can download here . Open the script in Notepad++ or similar. You need to edit lines 20, 25, 26, 32 & 85 20) Go to Google and get an API key from here , once you have a key, add it to the URL 25) Insert the latitude and longitude of where your Google Home is, use a site like this 26) Go to Google and get a different API key, this time from here 32) You need your Webhooks key from IFTTT which you can find here , it provides you with a URL, the key is at the end after /user/ 85) Customise what you want Google Home to say but leave in the variables that begin with $ If you used 000webhost then you can visit here and sign in, ensure you are in "public_html" on the left. in the top right choose "upload files" and upload index.php that you just edited (and saved!)

6) The final IFTTT

The Final IFTTT Create a new applet on IFTTT For "IF" choose webhooks & receive a web request Event name is "locationReceived" In "That" choose Webhooks and "make a web request" For the URL you need to put in the one for Home Assistant that looks like this: http://yourURL:8123/api/services/tts/google_say?api_password=YOUR_PASSWORD Method = POST Content type: application/json Body: {"entity_id": "media_player.lounge_speaker","message":"{{Value1}}"}

7) We're done

The End So, it's done, I'm guessing not many of you are left at this point as most gave up straight away :D Here's what we've achieved: You say "hey google, where's dad?" That uses IFTTT to send a web request to AutoRemote which uses your key to forward it to your device. This is then picked up by Tasker which forwards your location to the URL you setup. The URL takes your location, using Google API returns a friendly street and town name, then using another API works out how far that is in miles and time (with current traffic conditions too). It creates a phrase, passes this back to IFTTT which pushes the phrase to Home Assistant on your computer which tells Google Home to play using Text To Speech. Simple. Hope this has been some help to you!