Overview

Skill Level: Beginner

In this recipe I will explain how you can broadcast time and weather information every hour to your google home using a Raspberry, Node-RED and Bluemix Service like text to speech and the weather company service.

Ingredients

Google Home or a Google Cast

Bluemix account

IoT Boilerplate (Node-RED and IoTP)

Text to Speech Service

Weather Insight Service

PI with Node-RED Installed

(or a your desktop with Node-RED

and node.js/npm installed)

Step-by-step

  1. Objective

    When I work or when I am deep into code –¬† I sometimes loose track of time¬†and forget to get lunch etc. Of course I could setup reminders but¬†I want do something more automaticaly / programable. For example play the Big Ben chimes when its noon or give me the time and weather information every hour without asking for it.

    So I looked at the API from Google Home and Alexa (echo) and there is no simple way of accomplishing that without using the wake/hotword. After a bid more research I found a simple solution / workaround using google cast which works for all google cast devices. The cool thing is there are Node-RED and node.js extentions and examples out for it  Рwhich I was able to use as a starting point.

     

     

  2. Scenario 1 - Playing a Big Ben Chimes at noon using Node-RED

    For this Scenario I used a Raspberry Pi which is connected to the same local wifi than the Google Home devices. You can of course use your Notebook or Computer to do the same. I just my homepi (TJBoT) do to the work since its always running. I will also show you how you can do this also just via node.js in a later section.

    Here our higle use-case. Have a Node-RED flow on a local machine at noon play an mp3 file (Big Ben Chimes) on Google Home.

    Scenario 1 - Playing sound on Google Home

    Here the setup procedure:

    1. Install Node-RED on your device РInstruction here
    2. Install the google cast add on for Node-RED Рgooglecast 
    3. You can find Node-RED flow for this sceanrio flows in my github and below
    4. You will need to find the ip address of your google home device(s) via your wifi router
    5. Update the IP address of you google home in the Node-RED flow.

    Here the Node-RED flow:

    [{"id":"aa904d9e.8e95d8","type":"chromecast-play","z":"f95771b3.ad74a8","name":"Play on GH(mini)","url":"","contentType":"","ip":"192.168.1.206","x":530,"y":340,"wires":[["1ba929a0.db58a6"]]},{"id":"f5b064ae.1022b8","type":"inject","z":"f95771b3.ad74a8","name":"AT Noon","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"05 12 * * *","once":false,"onceDelay":"","x":140,"y":340,"wires":[["20d7e1e4.5a268e"]]},{"id":"1ba929a0.db58a6","type":"debug","z":"f95771b3.ad74a8","name":"BBInfo","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":710,"y":340,"wires":[]},{"id":"20d7e1e4.5a268e","type":"function","z":"f95771b3.ad74a8","name":"Get Sound","func":"msg.payload = {\n ip_address:'192.168.1.206',\n ip: '192.168.1.206',\n url: 'https://www.parliament.uk/audio/images/bigben-images/hourlychimebeg.mp3',\n contentType: 'audio/mp3'\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":343,"y":340,"wires":[["aa904d9e.8e95d8"]]}]

    here a quick video:

    https://youtu.be/zNpa46YccNg

     

  3. Scenario 1b - Using node.js

    You can accomplish the same using node.js of course. Just a bit more typing / coding. Again you can install this on you Pi or Desktop/Notebook etc. If you add ngrok you can even trigger/send message or sounds externaly (Note: This will open your network externaly so make sure to secure it properly or better do not do it.

    Here the setup procedure for the node.js version

    1. Install node.js and npm 
    2. clone the git from github
    3. run npm install in the clone project (tdd)
    4. update the IP address of your Google Home in the example program see below
    5. run node yourname.js

    here an example program

    // mvk@ca.ibm.com - 20180416 Simple Broadcast to GH
    var googlehome = require('./ghnotifier');
    var language = 'us';
    gh.device('Google Home', language);
    // or if you know your Google Home IP
    gh.ip('192.168.1.206', language);
    var d = new Date();
    time = d.toLocaleTimeString('en-US');
    nowArray = time.split(':');
    time = nowArray[0]+':'+nowArray[1];
    ampm = nowArray[2].split(' ');
    time = nowArray[0]+':'+nowArray[1]+" "+ampm[1];
    gh.notify('It is now '+time, function(res) {
    console.log(res);
    });

    here a quick video:

    https://youtu.be/zNpa46YccNg?t=2m41s

  4. Scenario 2 - Broadcast Time and Weather information using Google Home

    In this scenario I used Watson Text to Speech, the Weather Inside service and Node-RED for scheduling and orchestration. Alternatively you can use also google translate api for Text to Speech I wanted a different voice since if have more scenarios and in which I like  to distinguish them via the different voices. 

    Setup is the same as above in Scenario 1 plus¬†the Bluemix account and services. Here our high-level use case. Every hour get the Weather information (base on Latitude,Longitude) add the time to it and send the String to Watson TTS¬† like ” It is now 11:00 am , temperature feels like 7 C with light rain and wind gusts of¬†¬†37 km/h”. Watson TTS send back a mp3 buffer which¬†we save to the filesystem. Once the file is save I retrive the file via a file hook/http endpoint and send it to Google Home; which then will play the mp3 file to one or multiple Google Homes.

    Hourly Time and Weather

    1. Install Node-RED on your device РInstructions are here
    2. Install the Watson Node-RED add onto your Pi/Desktop (npm install node-red-node-watson)
    3. Install the google cast add on for Node-RED – googlecast
    4. Logon to Bluemix http:/console.bluemix.net 
    5. Create a space with the text to speech and weather service
    6. Note down the service credentials of these services so you can update the Node-RED flows
    7. You can find Node-RED flow for this scenario flows in my github and below 
    8. You will need to find the ip address of your google home device(s) via your wifi router
    9. Update the IP address of you google home in the Node-RED flow.
    10. Update the service credentials in the Node-RED for the tts and weather service

    Here hte Node-RED flow:

    [{"id":"83bc376f.bb0408","type":"watson-text-to-speech","z":"f95771b3.ad74a8","name":"TTS","lang":"en-US","langhidden":"en-US","langcustom":"NoCustomisationSetting","langcustomhidden":"","voice":"en-US_MichaelVoice","voicehidden":"en-US_MichaelVoice","format":"audio/mp3","password":"4wHMFxPvalCp","payload-response":false,"default-endpoint":true,"service-endpoint":"https://stream.watsonplatform.net/text-to-speech/api","x":750,"y":540,"wires":[["3e1f49a4.15660e","f3a64296.a4f6f"]]},{"id":"3e1f49a4.15660e","type":"function","z":"f95771b3.ad74a8","name":"name file","func":"//generate the filename\nvar d = new Date();\nvar n = d.getTime();\nmsg.file = n + \".mp3\";\nmsg.file = \"hello.mp3\";\nreturn msg;\n","outputs":1,"noerr":0,"x":920,"y":580,"wires":[["cb151377.dc606"]]},{"id":"cb151377.dc606","type":"function","z":"f95771b3.ad74a8","name":"Save Speech","func":"base = \"/tmp/cache_speech/\";\nmsg.filename = base + msg.file;\nmsg.payload = msg.speech;\nreturn msg;","outputs":1,"noerr":0,"x":910,"y":620,"wires":[["ca86cf56.90ec6","4fec655d.ba4f8c"]]},{"id":"ca86cf56.90ec6","type":"file","z":"f95771b3.ad74a8","name":"SaveSpeech","filename":"","appendNewline":false,"createDir":true,"overwriteFile":"true","x":910,"y":660,"wires":[]},{"id":"f3a64296.a4f6f","type":"debug","z":"f95771b3.ad74a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":910,"y":540,"wires":[]},{"id":"400a5567.c09814","type":"chromecast-play","z":"f95771b3.ad74a8","name":"to GH (Mini)","url":"","contentType":"","ip":"192.168.1.206","x":570,"y":640,"wires":[["1beb3f84.ebb0a8"]]},{"id":"f293451.0069138","type":"inject","z":"f95771b3.ad74a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":120,"y":640,"wires":[["b28bdded.cc1b08"]]},{"id":"1beb3f84.ebb0a8","type":"debug","z":"f95771b3.ad74a8","name":"GH","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":730,"y":660,"wires":[]},{"id":"b28bdded.cc1b08","type":"function","z":"f95771b3.ad74a8","name":"WatsonFile","func":"msg.payload = {\n ip_address:'192.168.1.206',\n ip: '192.168.1.206',\n url: 'http://192.168.1.52:1880/mp3',\n contentType: 'audio/mp3'\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":370,"y":640,"wires":[["400a5567.c09814","c3ecdaa2.e70868"]]},{"id":"4872dee7.67d18","type":"function","z":"f95771b3.ad74a8","name":"Say Time","func":"var d = new Date();\nd.toLocaleString(); // -> \"2/1/2013 7:37:08 AM\"\nd.toLocaleDateString(); // -> \"2/1/2013\"\ntime = d.toLocaleTimeString('en-US');\n nowArray = time.split(':');\n time = nowArray[0]+':'+nowArray[1];\n ampm = nowArray[2].split(' ');\n time = nowArray[0]+':'+nowArray[1]+\" \"+ampm[1];\n\nmsg.payload = \"It is now \" + time\nnode.warn(msg.payload )\nreturn msg;\n","outputs":1,"noerr":0,"x":560,"y":580,"wires":[["83bc376f.bb0408"]]},{"id":"d215d929.adf908","type":"inject","z":"f95771b3.ad74a8","name":"test","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":90,"y":580,"wires":[["4872dee7.67d18"]]},{"id":"4fec655d.ba4f8c","type":"delay","z":"f95771b3.ad74a8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1080,"y":620,"wires":[["b28bdded.cc1b08"]]},{"id":"7628111b.ad6338","type":"weather_insights","z":"f95771b3.ad74a8","name":"Get Toronto Weather","host":"twcservice.mybluemix.net","service":"/observations.json","geocode":"43.6692562,-79.4096344","units":"m","language":"","x":340,"y":540,"wires":[["bd425552.e34768"]]},{"id":"bd425552.e34768","type":"function","z":"f95771b3.ad74a8","name":"","func":"var d = new Date();\nd.toLocaleString(); // -> \"2/1/2013 7:37:08 AM\"\nd.toLocaleDateString(); // -> \"2/1/2013\"\ntime = d.toLocaleTimeString('en-US');\n nowArray = time.split(':');\n time = nowArray[0]+':'+nowArray[1];\n ampm = nowArray[2].split(' ');\n time = nowArray[0]+':'+nowArray[1]+\" \"+ampm[1];\n\nmsg.payload = \"It is now \" + time\n\n\n\n//msg.payload ={}/\n///msg.payload.temp = msg.observation.temp\ngust=msg.observation.gust\n\nif(msg.observation.gust == null)\ngust=msg.observation.wspd\n\n\nmsg.payload = msg.payload + \", temperature feels like \"+msg.observation.feels_like+ \" with \"+msg.observation.wx_phrase + \" and wind gusts of \"+gust + \" km/h\"\nnode.warn(msg.payload )\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":540,"wires":[["83bc376f.bb0408"]]},{"id":"7a5c891.7e297f8","type":"inject","z":"f95771b3.ad74a8","name":"Hourly","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"0 8-20 * * *","once":false,"onceDelay":"","x":80,"y":540,"wires":[["7628111b.ad6338"]]},{"id":"c3ecdaa2.e70868","type":"chromecast-play","z":"f95771b3.ad74a8","name":"GH Big","url":"","contentType":"","ip":"192.168.1.51","x":560,"y":680,"wires":[[]]}]/[{"id":"8038887d.f48d38","type":"http in","z":"e6662302.c1daf","name":"","url":"/mp3","method":"get","upload":false,"swaggerDoc":"","x":220,"y":100,"wires":[["1a9dabf8.a0e60c"]]},{"id":"1a9dabf8.a0e60c","type":"file in","z":"e6662302.c1daf","name":"","filename":"/tmp/cache_speech/hello.mp3","format":"","sendError":true,"x":450,"y":100,"wires":[["250e15d8.5fbbb2"]]},{"id":"250e15d8.5fbbb2","type":"change","z":"e6662302.c1daf","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"audio/mp3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":100,"wires":[["3d49e9ad.91c25e"]]},{"id":"3d49e9ad.91c25e","type":"http response","z":"e6662302.c1daf","name":"","x":910,"y":100,"wires":[]},{"id":"85191cc5.51cdb","type":"http in","z":"e6662302.c1daf","name":"","url":"/ask","method":"get","upload":false,"swaggerDoc":"","x":220,"y":180,"wires":[["3f63e5c8.3b9742"]]},{"id":"3f63e5c8.3b9742","type":"file in","z":"e6662302.c1daf","name":"","filename":"/tmp/cache_speech/ask.mp3","format":"","sendError":true,"x":440,"y":180,"wires":[["531c0c25.9cd184"]]},{"id":"531c0c25.9cd184","type":"change","z":"e6662302.c1daf","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"audio/mp3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":180,"wires":[["4c8ebce.270ef44"]]},{"id":"4c8ebce.270ef44","type":"http response","z":"e6662302.c1daf","name":"","x":910,"y":180,"wires":[]}]*Code Goes Here*/

    Http endpoint to file in order to cast the url.

    [{"id":"8038887d.f48d38","type":"http in","z":"e6662302.c1daf","name":"","url":"/mp3","method":"get","upload":false,"swaggerDoc":"","x":220,"y":100,"wires":[["1a9dabf8.a0e60c"]]},{"id":"1a9dabf8.a0e60c","type":"file in","z":"e6662302.c1daf","name":"","filename":"/tmp/cache_speech/hello.mp3","format":"","sendError":true,"x":450,"y":100,"wires":[["250e15d8.5fbbb2"]]},{"id":"250e15d8.5fbbb2","type":"change","z":"e6662302.c1daf","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"audio/mp3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":100,"wires":[["3d49e9ad.91c25e"]]},{"id":"3d49e9ad.91c25e","type":"http response","z":"e6662302.c1daf","name":"","x":910,"y":100,"wires":[]},{"id":"85191cc5.51cdb","type":"http in","z":"e6662302.c1daf","name":"","url":"/ask","method":"get","upload":false,"swaggerDoc":"","x":220,"y":180,"wires":[["3f63e5c8.3b9742"]]},{"id":"3f63e5c8.3b9742","type":"file in","z":"e6662302.c1daf","name":"","filename":"/tmp/cache_speech/ask.mp3","format":"","sendError":true,"x":440,"y":180,"wires":[["531c0c25.9cd184"]]},{"id":"531c0c25.9cd184","type":"change","z":"e6662302.c1daf","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"audio/mp3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":180,"wires":[["4c8ebce.270ef44"]]},{"id":"4c8ebce.270ef44","type":"http response","z":"e6662302.c1daf","name":"","x":910,"y":180,"wires":[]}]

     

    here a quick Viideo:

    https://youtu.be/zNpa46YccNg?t=3m36s

  5. Scenario 3 - Build your own intercom with IFTTT, Google Home and Watson

    In the 3rd Scenario I wanted to trigger boardcast externaly via IFTTT.¬† There are many example one could think off e.g email or twitter notification etc. I just use a google home as trigger to send message to different rooms. Like “OK google – Tell Markus, Dinner is ready!” this would than trigger a IFTTT webhook which triggers a Node-RED flow to boardcast the message to one or all Google Homes.¬†In order for IFTTT to reach your PI or Desktop you would need to use a proxy like¬†ngrok or you can use a external Node-RED instance which send the message to you PI via WebSockets or via MQTT – which is what I did.

    IFTTT Google Home and Watson + PI 

    This uses the same setup as above of course in addition we will need to setup a Node-RED and WatsonIoT enviroment in our Bluemix space. We also need to install the Node-RED WatsonIoT add on on our PI/Desktop. Once you have all the compenents installed you will need to register the PI as device in the WioT platform and connect to it – so that you can send and received messages between the Node-RED cloud enviroment¬† and the PI via mqtt messages using WIoT. In the cloud Node-RED enviroment you also will need to setup http end points for the IFTTT Webhook so you can receive messages once Google Home trigger the defined phrase like “Tell Markus”.

     See IFTTT Setup example in this recipe:

    https://developer.ibm.com/recipes/tutorials/using-google-home-ifttt-and-watson-iot-platform/

     

    Short Video:

    https://www.youtube.com/edit?o=U&video_id=0r5mrIKhzjU

     

    Local Node-RED flow:

    [{"id":"8528eb3d.d4ec88","type":"debug","z":"80288b8e.57485","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":310,"y":200,"wires":[]},{"id":"655a8145.32ece","type":"ibmiot in","z":"80288b8e.57485","authentication":"apiKey","apiKey":"6f85d686.96ea","inputType":"evt","logicalInterface":"","ruleId":"","deviceId":"homeraspi","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"IBM IoT","service":"registered","allDevices":"","allApplications":"","allDeviceTypes":true,"allLogicalInterfaces":"","allEvents":true,"allCommands":"","allFormats":true,"qos":0,"x":130,"y":200,"wires":[["8528eb3d.d4ec88","3f9b329e.60332e"]]},{"id":"add4c546.7d041","type":"switch","z":"80288b8e.57485","name":"User","property":"old.user","propertyType":"msg","rules":[{"t":"eq","v":"stephanie","vt":"str"},{"t":"eq","v":"markus","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":450,"y":260,"wires":[["d84db92f.daffb8"],["a90fb96d.acfcc8"],[]]},{"id":"a90fb96d.acfcc8","type":"watson-text-to-speech","z":"80288b8e.57485","name":"TTS","lang":"en-US","langhidden":"en-US","langcustom":"NoCustomisationSetting","langcustomhidden":"","voice":"en-US_MichaelVoice","voicehidden":"en-US_MichaelVoice","format":"audio/mp3","password":"4wHMFxPvalCp","payload-response":false,"default-endpoint":true,"service-endpoint":"https://stream.watsonplatform.net/text-to-speech/api","x":590,"y":340,"wires":[["e2093f05.2974f8","1ac2eaca.4656a5"]]},{"id":"e2093f05.2974f8","type":"function","z":"80288b8e.57485","name":"name file","func":"//generate the filename\nvar d = new Date();\nvar n = d.getTime();\nmsg.file = n + \".mp3\";\nmsg.file = \"ask.mp3\";\nreturn msg;\n","outputs":1,"noerr":0,"x":700,"y":420,"wires":[["33be4acf.cd123e"]]},{"id":"33be4acf.cd123e","type":"function","z":"80288b8e.57485","name":"Save Speech","func":"base = \"/tmp/cache_speech/\";\nmsg.filename = base + msg.file;\nmsg.payload = msg.speech;\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":420,"wires":[["d3107251.8edc","f526321d.dac1c"]]},{"id":"d3107251.8edc","type":"file","z":"80288b8e.57485","name":"SaveSpeech","filename":"","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1050,"y":420,"wires":[]},{"id":"18c79e72.e97532","type":"debug","z":"80288b8e.57485","name":"incomming","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":510,"y":380,"wires":[]},{"id":"eede085e.d91798","type":"chromecast-play","z":"80288b8e.57485","name":"GH mIni","url":"","contentType":"","ip":"192.168.1.206","x":680,"y":480,"wires":[["c6812a09.a481a"]]},{"id":"a16d824b.b87f28","type":"inject","z":"80288b8e.57485","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":320,"y":480,"wires":[["f864ba7a.cf448"]]},{"id":"c6812a09.a481a","type":"debug","z":"80288b8e.57485","name":"","active":true,"console":"false","complete":"false","x":870,"y":480,"wires":[]},{"id":"f864ba7a.cf448","type":"function","z":"80288b8e.57485","name":"WatsonFile","func":"msg.payload = {\n ip_address:'192.168.1.206',\n ip: '192.168.1.206',\n url: 'http://192.168.1.52:1880/ask',\n contentType: 'audio/mp3'\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":523,"y":480,"wires":[["eede085e.d91798","d9235a56.7debe8"]]},{"id":"3f9b329e.60332e","type":"function","z":"80288b8e.57485","name":"Say something","func":"msg.old = {}\nmsg.old = msg.payload\nmsg.old = msg.payload\nmsg.payload = msg.payload.ifttt\nnode.warn(msg.payload )\n\nif(msg.old.mytype == \"tell\")\nmsg.payload = msg.old.about+\"! \"+ msg.old.ifttt\n\nreturn msg;\n","outputs":1,"noerr":0,"x":340,"y":320,"wires":[["add4c546.7d041","18c79e72.e97532"]]},{"id":"8b37b202.d7431","type":"inject","z":"80288b8e.57485","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":320,"wires":[["3f9b329e.60332e"]]},{"id":"f526321d.dac1c","type":"delay","z":"80288b8e.57485","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":320,"y":440,"wires":[["f864ba7a.cf448"]]},{"id":"d9235a56.7debe8","type":"chromecast-play","z":"80288b8e.57485","name":"GH Big","url":"","contentType":"","ip":"192.168.1.51","x":680,"y":540,"wires":[[]]},{"id":"d84db92f.daffb8","type":"watson-text-to-speech","z":"80288b8e.57485","name":"TTS","lang":"en-US","langhidden":"en-US","langcustom":"NoCustomisationSetting","langcustomhidden":"","voice":"en-US_LisaVoice","voicehidden":"en-US_LisaVoice","format":"audio/mp3","password":"4wHMFxPvalCp","payload-response":false,"default-endpoint":true,"service-endpoint":"https://stream.watsonplatform.net/text-to-speech/api","x":590,"y":200,"wires":[["e2093f05.2974f8"]]},{"id":"1ac2eaca.4656a5","type":"debug","z":"80288b8e.57485","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":730,"y":340,"wires":[]},{"id":"6f85d686.96ea","type":"ibmiot","z":"","name":"tpbot space","keepalive":"60","serverName":"","cleansession":true,"appId":"homepi","shared":false}]

    Node-RED flow for the Cloud  envrioment:

    [{"id":"72aa6580.e37ff4","type":"http in","z":"1d42630d.c44f7d","name":"/tell/stephanie","url":"/tell/stephanie","method":"post","swaggerDoc":"","x":122,"y":776,"wires":[["d69c81a3.6b237","a65977c9.7a534","cb2309e.5b051f8"]]},{"id":"d69c81a3.6b237","type":"http response","z":"1d42630d.c44f7d","name":"","x":292,"y":733,"wires":[]},{"id":"a65977c9.7a534","type":"debug","z":"1d42630d.c44f7d","name":"stephanie","active":true,"console":"false","complete":"true","x":302,"y":825,"wires":[]},{"id":"59392fac.a07498","type":"ibmiot out","z":"1d42630d.c44f7d","authentication":"boundService","apiKey":"","outputType":"evt","deviceId":"homeraspi","deviceType":"raspi","eventCommandType":"ghstephanie","format":"json","data":"msg.payload","qos":0,"name":"IBM IoT","service":"registered","x":867,"y":794,"wires":[]},{"id":"7629259d.2c0404","type":"function","z":"1d42630d.c44f7d","name":"Build json","func":"var d = new Date();\ntime = d.toLocaleTimeString();\nnowArray = time.split(':');\ntime = nowArray[0]+' '+nowArray[1];\nvar newmsg ={}\n newmsg.payload ={}\nnewmsg.payload.url=\"https://d34a0ac8.ngrok.io/google-home-notifier?text=Markus,\"+msg.payload\nnewmsg.payload.text = msg.payload \nnewmsg.payload.mytype = msg.mytype \nnewmsg.payload.user=\"stephanie\"\nnewmsg.payload.ts = Date.now()\nnewmsg.payload.ifttt = msg.ifttt\nnewmsg.payload.about=\"stephanie\"\nreturn newmsg;","outputs":1,"noerr":0,"x":702.5,"y":771.5,"wires":[["59392fac.a07498","323fc46b.1a6e5c"]]},{"id":"323fc46b.1a6e5c","type":"debug","z":"1d42630d.c44f7d","name":"","active":true,"console":"false","complete":"true","x":827.5,"y":724.5,"wires":[]},{"id":"13711f83.d769c","type":"function","z":"1d42630d.c44f7d","name":"Build Text","func":"var d = new Date();\ntime = d.toLocaleTimeString();\nnowArray = time.split(':');\ntime = nowArray[0]+' '+nowArray[1];\nvar newmsg ={}\nmsg.method =\"GET\"\nmsg.url=\"https://d34a0ac8.ngrok.io/google-home-notifier?text=Markus,\"+msg.payload\nmsg.ifttt = msg.payload\nmsg.payload = \"text='Stephanie, \"+msg.payload+\"'\" \nmsg.user=\"stephanie\"\n\nreturn msg;","outputs":1,"noerr":0,"x":525,"y":781,"wires":[["7629259d.2c0404"]]},{"id":"ededd7a8.cb6628","type":"inject","z":"1d42630d.c44f7d","name":"","topic":"","payload":"dinner is ready","payloadType":"str","repeat":"","crontab":"","once":false,"x":132,"y":704,"wires":[["cb2309e.5b051f8"]]},{"id":"34af33ab.2fce04","type":"http in","z":"1d42630d.c44f7d","name":"/ask/stephanie","url":"/ask/stephanie","method":"post","swaggerDoc":"","x":134,"y":880,"wires":[["d69c81a3.6b237","6a81c881.cbf7f8"]]},{"id":"cb2309e.5b051f8","type":"function","z":"1d42630d.c44f7d","name":"tell","func":"msg.mytype = \"tell\"\nreturn msg;","outputs":1,"noerr":0,"x":448,"y":729,"wires":[["13711f83.d769c"]]},{"id":"6a81c881.cbf7f8","type":"function","z":"1d42630d.c44f7d","name":"Ask","func":"msg.mytype = \"ask\"\nreturn msg;","outputs":1,"noerr":0,"x":413,"y":880,"wires":[["13711f83.d769c"]]}]
  6. Conclusion

    There are lots of possiblities to use Google Home as boardcasting device and mashup some of its functionality with others like IFTTT.BTW this works also from your Phone so I can Say “Hey Google: Tell Markus I on my way home.” which than gets boardcast to my Google Home.¬†

    I am hoping that Google and Amazon will give us more APIs so that we can actually trigger native functionality of the Device and Services externally without the wakeword etc which will make this really interesting. Please let me know if you have question and share your Node-RED flows and scenarios you came up with. Cheers РMarkus

  7. References

    Youtubes: 

    https://www.youtube.com/playlist?list=PLkgoc309GV1LwmUE8F1bkZANZ4SOd8qXz

    Node-RED :

    Google Cast

    https://www.npmjs.com/package/node-red-contrib-chromecast

    Waton Services nodes

    https://flows.nodered.org/node/node-red-node-watson

    Watson IoT nodes

    https://www.npmjs.com/package/node-red-contrib-scx-ibmiotapp

    Github:

    https://github.com/markusvankempen

    IFTTT Setup recipe

    https://developer.ibm.com/recipes/tutorials/using-google-home-ifttt-and-watson-iot-platform/

     

     

     

     

     

     

Join The Discussion