Skip to content

Instantly share code, notes, and snippets.

@neuman
Created February 26, 2014 06:09
Show Gist options
  • Save neuman/9224425 to your computer and use it in GitHub Desktop.
Save neuman/9224425 to your computer and use it in GitHub Desktop.
Shower Time Tasker JS
showScene('Tester');
mediaVol(15);
say("Good morning Eric, welcome to "+global('DAYW')+". Let me check the weather.");
//getLocation( 'net' );
//var coords = global('LOCN').split(",");
var http = new XMLHttpRequest();
//flashLong('http://api.openweathermap.org/data/2.5/find?lat='+coords[0]+'&lon='+coords[1]+'&units=imperial&mode=json');
//http.open("GET",'http://api.openweathermap.org/data/2.5/find?lat='+coords[0]+'&lon='+coords[1]+'&units=imperial&mode=json&type=like',false);
http.open("GET",'http://api.openweathermap.org/data/2.5/find?q=brooklyn&units=imperial&mode=json&type=like',false);
http.send();
var json = http.responseText;
var weather = JSON.parse(json);
var city = weather.list[0];
say(city.weather[0].description+" and "+Math.round(city.main.temp)+" degrees now in "+city.name+".");
say("Enjoy your shower! I'll let you know when it's been ten minutes.")
loadApp("Spotify");
wait(5000);
performTask('playspotify');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment