{"globals":[{"key":"deviceId","type":"string"},{"key":"forecastAPIKey","type":"string"},{"key":"particleAPIKey","type":"string"}],"triggers":[{"type":"virtualButton","meta":{"category":"trigger","name":"virtualButton","label":"Virtual Button","x":120,"y":40,"uiId":"BkpgAWZm"},"config":{},"key":"57438cb1ae5a2f01002c9565-rkOSC-WQ","outputIds":[["H1mfXzbm"]]},{"type":"timer","meta":{"category":"trigger","name":"timer","label":"Timer","x":320,"y":40,"uiId":"H1IVJXW7"},"config":{"seconds":120},"key":"31c1de5021f211e689ec6753fb7ff5a3","outputIds":[["H1mfXzbm"]]}],"nodes":[{"type":"HttpNode","meta":{"category":"data","name":"http","label":"Get Weather","x":120,"y":160},"config":{"method":"GET","uriTemplate":"https://api.forecast.io/forecast/{{ globals.forecastAPIKey }}/39.1119359,-84.51254","responsePath":"data.weather","headerInfo":[],"bodyTemplate":null},"id":"H1mfXzbm","outputIds":[["ryd-7QGm"]]},{"type":"HttpNode","meta":{"category":"data","name":"http","label":"Set Text","x":120,"y":360},"config":{"method":"POST","uriTemplate":"https://api.particle.io/v1/devices/{{globals.deviceId}}/setText","responsePath":"data.particle","headerInfo":[{"key":"Authorization","valueTemplate":"Bearer {{ globals.particleAPIKey }}"},{"key":"content-type","valueTemplate":"application/json"}],"bodyTemplate":"{{ text }}"},"id":"SyTufQG7","outputIds":[["SJAv7QG7"]]},{"type":"RawFunctionNode","meta":{"category":"logic","name":"function","label":"Create Text","x":120,"y":260},"config":{"script":"// Get local time string in hours and minutes, e.g. \"4:02 PM\".\nvar timeString = payload.time.toLocaleTimeString(\n \"en-US\",\n {\n timeZone: \"America/New_York\",\n hour: 'numeric',\n minute: '2-digit'\n }\n);\n\n// Get chance of precipitation for the day.\nvar precip = (payload.data.weather.body.daily.data[0].precipProbability * 100) + '%';\n\n// Build Line 1.\nvar line1 = timeString;\n\n// LCD lines are 16 characters. Pad the string so the precipitation\n// probability is right aligned.\nfor(var i = timeString.length; i < 16 - precip.length; i++) {\n line1 += ' ';\n}\nline1 += precip;\n\n// Get current temperature and high for the day.\nvar currentTemp = payload.data.weather.body.currently.temperature.toString();\nvar highTemp = payload.data.weather.body.daily.data[0].temperatureMax.toString();\n\n// Build Line 2.\nvar line2 = currentTemp;\n\n// LCD lines are 16 characters. Pad the string so the current\n// temp is left aligned and the high temp is right aligned.\nfor(var i = currentTemp.length; i < 16 - highTemp.length; i++) {\n line2 += ' ';\n}\nline2 += highTemp;\n\nvar arg = { L1 : line1, L2 : line2 };\n\n// Particle expects a payload that looks like { \"arg\" : \"custom payload\" }.\npayload.text = JSON.stringify({ arg: JSON.stringify(arg) });"},"id":"ryd-7QGm","outputIds":[["SyTufQG7"]]},{"type":"DebugNode","meta":{"category":"output","name":"debug","label":"Debug","x":120,"y":460},"config":{"message":""},"id":"SJAv7QG7","outputIds":[]}],"name":"Weather Updater","enabled":true,"description":"","applicationId":"57438c9e4f9a04010057591a","_type":"flow","_exportDate":"2016-05-24T22:36:31.731Z"}