Use find-my-iPhone node to determine current location weather

Use find-my-iPhone node to determine current location's weather. Extract temp info. Determine temp thresholds for the day and make recommendations via text messages.

[{"id":"ed57abef.bc5028","type":"http in","z":"c36eeb3d.63ea88","name":"","url":"/audio","method":"get","swaggerDoc":"","x":223.318115234375,"y":383.8636169433594,"wires":[["7a4c4c3d.bec114"]]},{"id":"a02ddf2b.cf0138","type":"http response","z":"c36eeb3d.63ea88","name":"","x":645.863603591919,"y":392.1363334655762,"wires":[]},{"id":"7a4c4c3d.bec114","type":"template","z":"c36eeb3d.63ea88","name":"","field":"","fieldType":"msg","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n<head>\n  <title>IBM Watson - Text To Speech</title>\n  <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js\"></script>\n  \n  <script type=\"text/javascript\">\n    var socketaddy = \"ws://\" + window.location.host + \"/ws/audio\";\n\n    $(document).ready(function(){\n      var output = document.getElementById('output')\n      $('#output').on('playing', function () {\n          $('#text').text('Playing audio.')\n          \n      });\n      $('#output').on('ended', function () {\n          $('#text').text('Waiting for audio...')\n          \n      });\n      sock = new WebSocket(socketaddy);\n      sock.onopen = function(){\n          $('#text').text('Waiting for audio...');\n          console.log(\"Connected websocket\");\n      };\n      sock.onerror = function(){ \n          console.log(\"Websocket error\"); \n      };\n      sock.onclose = function () {\n          $('#text').text('Not connected. Refresh the page?')\n      }\n      sock.onmessage = function(evt){\n        console.log(\"Websocket message\", evt); \n        output.src = window.URL.createObjectURL(evt.data);\n        output.play();\n      };\n    });\n  </script>\n  \n</head>\n<body style=\"font-size: 56px; font-family: helvetica; text-align: center; margin-top: 100px;\">\n  <div id=\"text\">Connecting...</div>\n  <audio id=\"output\"></audio>\n</body>\n</html>","x":440.318115234375,"y":390.8636169433594,"wires":[["a02ddf2b.cf0138"]]},{"id":"f7bf5c51.82973","type":"find-my-iphone","z":"c36eeb3d.63ea88","x":182.66668701171875,"y":642.0001220703125,"wires":[["9a0d66c8.b42ee","81073abe.2eb9e"]]},{"id":"263495a2.5cfcc2","type":"inject","z":"c36eeb3d.63ea88","name":"Check weather every 3hrs","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":193.66671752929688,"y":528.33349609375,"wires":[["f7bf5c51.82973"]]},{"id":"9a0d66c8.b42ee","type":"function","z":"c36eeb3d.63ea88","name":"Weather API URL","func":"var url = \"https://twcservice.mybluemix.net/api/weather/v1/geocode/\"+msg.payload.location.latitude+\"/\"+msg.payload.location.longitude+\"/observations.json?language=en-US\";\nmsg.url = url;\n\nreturn msg;","outputs":1,"noerr":0,"x":496.666748046875,"y":501.500244140625,"wires":[["e44c50b3.a8cf6"]]},{"id":"a0f081be.2176a","type":"debug","z":"c36eeb3d.63ea88","name":"","active":false,"console":"false","complete":"payload","x":769.000244140625,"y":593.3336181640625,"wires":[]},{"id":"e44c50b3.a8cf6","type":"http request","z":"c36eeb3d.63ea88","name":"Get Current Weather","method":"GET","ret":"obj","url":"","tls":"","x":495.83331298828125,"y":598.5834350585938,"wires":[["a0f081be.2176a","a5f4ae69.151f9","348455aa.efdeba"]]},{"id":"1f96dd26.a2c943","type":"debug","z":"c36eeb3d.63ea88","name":"Weather channel temperature today","active":false,"console":"false","complete":"payload","x":1079.1666259765625,"y":662.9168090820312,"wires":[]},{"id":"2418cd1b.91722a","type":"template","z":"c36eeb3d.63ea88","name":"Weather Channel Temperature in Fahrenheit","field":"payload","fieldType":"msg","format":"text","syntax":"mustache","template":"Temperature now from Weather Channel: {{payload}} degree Fahrenheit!","x":717.547119140625,"y":662.655029296875,"wires":[["1f96dd26.a2c943"]]},{"id":"a5f4ae69.151f9","type":"function","z":"c36eeb3d.63ea88","name":"Get Temperature data from Weather rest api","func":"return {payload:msg.payload.observation.temp};","outputs":1,"noerr":0,"x":551.0232543945312,"y":724.5361328125,"wires":[["2418cd1b.91722a","f2cf90e6.613258"]]},{"id":"f2cf90e6.613258","type":"switch","z":"c36eeb3d.63ea88","name":"temp thresh","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"45","vt":"str"},{"t":"gt","v":"75","vt":"str"},{"t":"btwn","v":"45","vt":"num","v2":"75","v2t":"num"}],"checkall":"true","outputs":3,"x":470.2852783203125,"y":863.5833740234375,"wires":[["414afddb.f1dc64"],["d95989a3.b8168"],["ae379285.54f1"]]},{"id":"414afddb.f1dc64","type":"template","z":"c36eeb3d.63ea88","name":"Cold","field":"","fieldType":"msg","syntax":"mustache","template":"Today's temperature is winter like. Wear a jacket.","x":653.856689453125,"y":813.6546630859375,"wires":[["69611264.71108c","f7d9dc74.9dbd28"]]},{"id":"d95989a3.b8168","type":"template","z":"c36eeb3d.63ea88","name":"Hot","field":"","fieldType":"msg","syntax":"mustache","template":"Temperature is hot! Don't forget your sunglasses and sunscreen.","x":653.9044189453125,"y":861.9761962890625,"wires":[["69611264.71108c","f7d9dc74.9dbd28"]]},{"id":"69611264.71108c","type":"watson-translate","z":"c36eeb3d.63ea88","name":"","action":"translate","basemodel":"ar-en","domain":"conversational","srclang":"en","destlang":"es","password":"","custom":"","domainhidden":"conversational","srclanghidden":"en","destlanghidden":"es","basemodelhidden":"","customhidden":"","filetype":"forcedglossary","trainid":"","x":921.356689453125,"y":808.8689575195312,"wires":[["77d2c90a.2d6348","7609d9cc.5158d"]]},{"id":"ae379285.54f1","type":"template","z":"c36eeb3d.63ea88","name":"Pleasant","field":"","fieldType":"msg","syntax":"mustache","template":"Beautiful day. Carry a light jacket and enjoy.","x":664.9758911132812,"y":917.7262573242188,"wires":[["69611264.71108c","f7d9dc74.9dbd28"]]},{"id":"77d2c90a.2d6348","type":"debug","z":"c36eeb3d.63ea88","name":"","active":true,"console":"false","complete":"false","x":1109.856689453125,"y":758.5833740234375,"wires":[]},{"id":"7609d9cc.5158d","type":"watson-text-to-speech","z":"c36eeb3d.63ea88","name":"","lang":"es-ES","langhidden":"es-ES","voice":"es-ES_LauraVoice","voicehidden":"","password":"","x":1117.1424560546875,"y":847.1190795898438,"wires":[["17372d87.c62782"]]},{"id":"66e3f2d1.10cbcc","type":"websocket out","z":"c36eeb3d.63ea88","name":"","server":"fb9b878.e5907f8","client":"","x":1340.2333984375,"y":809.846435546875,"wires":[]},{"id":"17372d87.c62782","type":"function","z":"c36eeb3d.63ea88","name":"","func":"msg.payload = msg.speech;\nreturn msg;","outputs":1,"noerr":0,"x":1285.460693359375,"y":874.1646118164062,"wires":[["66e3f2d1.10cbcc"]]},{"id":"f7d9dc74.9dbd28","type":"twilio out","z":"c36eeb3d.63ea88","service":"_ext_","twilio":"28d95132.eaf816","from":"","number":"+19132192690","name":"Text weather recommendation","x":955.642333984375,"y":886.7024536132812,"wires":[]},{"id":"81073abe.2eb9e","type":"debug","z":"c36eeb3d.63ea88","name":"","active":false,"console":"false","complete":"false","x":175.16668701171875,"y":751.5001220703125,"wires":[]},{"id":"348455aa.efdeba","type":"ibmiot out","z":"c36eeb3d.63ea88","authentication":"boundService","apiKey":"","outputType":"evt","deviceId":"Weather1","deviceType":"WeatherDevice","eventCommandType":"update","format":"json","data":"temp:10","qos":0,"name":"Send to IBM IoT","service":"registered","x":773.5,"y":515.8333129882812,"wires":[]},{"id":"fb9b878.e5907f8","type":"websocket-listener","path":"/ws/audio","wholemsg":"false"},{"id":"28d95132.eaf816","type":"twilio-api","z":"c36eeb3d.63ea88","sid":"AC61faf1dccaf9f583834c797d1aeb3f17","from":"+1(816) 535-0561 ","name":"SMS"}]

Flow Info

Created 8 years, 1 month ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x4)
  • function (x3)
  • http in (x1)
  • http request (x1)
  • http response (x1)
  • inject (x1)
  • switch (x1)
  • template (x5)
  • websocket out (x1)
  • websocket-listener (x1)
Other
  • find-my-iphone (x1)
  • ibmiot out (x1)
  • twilio out (x1)
  • twilio-api (x1)
  • watson-text-to-speech (x1)
  • watson-translate (x1)

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option