Skip to content

Commit

Permalink
Merge pull request #3 from Inversion-NL/Dev
Browse files Browse the repository at this point in the history
version 0.0.3
  • Loading branch information
Inversion-NL authored and Inversion-NL committed May 13, 2016
2 parents 4e4cebe + a94daf9 commit 9696e26
Show file tree
Hide file tree
Showing 7 changed files with 734 additions and 248 deletions.
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
## nl.inversion.wunderground
Weather Underground app for Homey
##Weather Underground app for Homey

# Features
Want to trigger your blinds when it's hot outside?
Want to close your windows screen when the wind picks up?
Want to be notified when the levels of UV become high risk?
Weather Underground app helps you accomplish these!


# Flow triggers:
#Flow triggers
* Temperature has changed
* Humidity has changed
* Temperature is above an certain degree of Celcius/Fahrenheit
* Temperature is below an certain degree of Celcius/Fahrenheit
* Humidity is above an certain degree of Celcius/Fahrenheit
* Humidity is below an certain degree of Celcius/Fahrenheit
* Humidity is above an certain percentage
* Humidity is below an certain percentage
* UV is above an certain threshold
* UV is below an certain threshold
* Wind is above an certain speed
* Wind is below an certain speed
* Wind gust is above an certain speed
* Wind gust is below an certain speed


# Flow conditions:
#Flow conditions
* Temperature is above an certain degree of Celcius/Fahrenheit
* Temperature is below an certain degree of Celcius/Fahrenheit
* Humidity is above an certain degree of Celcius/Fahrenheit
* Humidity is below an certain degree of Celcius/Fahrenheit
* UV is above an certain threshold
* UV is below an certain threshold
* Wind is above an certain speed
* Wind is below an certain speed
* Wind gust is above an certain speed
* Wind gust is below an certain speed


# Insights:
#Insights
* Temperature
* Humidity
* Feels like
Expand All @@ -42,10 +49,21 @@ Weather Underground app helps you accomplish these!
* Precepation for today


# Future functions:
#Settings
* You can use your own API key, (available here: https://www.wunderground.com/weather/api it's free!) so you can update up to every 10 minutes.
If you don't have a key the app uses my key and will update every 60 minutes.
* Use Homey's location or a custom location
* Celsius and Fahrenheit support


#Future functions
* Read Weather forecast
* Trigger/condition on current weather condition (Cloudy, Raining etc)
* Trigger on weather alerts
* Average/high/low temperature on this date
* Triggers and conditions for precipation 1hr/today
* Much more!
* Much more!


#Source
https://github.com/Inversion-NL/nl.inversion.wunderground
44 changes: 13 additions & 31 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,24 @@ module.exports = [
{
description: 'Test wunderground connection',
method: 'POST',
path: '/test/connection/',
path: '/get/weather/',
fn: function(callback, args) {
Homey.log("");
Homey.log("API: Incoming POST on /test/wunderground/");

var Wunderground = require('wundergroundnode');
var wundergroundKey = args.body.wundergroundKey;
var wunderground = new Wunderground(wundergroundKey);
var address = "Netherlands/Amsterdam";

if (wundergroundKey == "" || wundergroundKey == null) {
Homey.log("API: Weather underground key is empty, using Inversion key");
wundergroundKey = Homey.env.WUNDERGROUND_KEY;
}
Homey.app.testWU(callback, args);
}
},

{
description: 'Get Homey\'s location',
method: 'POST',
path: '/get/location/',
fn: function(callback, args) {
Homey.log("");
Homey.log("API: Incoming POST on /get/location/");

// Get weather data
wunderground.conditions().request(address, function(err, response) {

if (err) {
// Catch error
callback (response, false);
return Homey.log("API: Wunderground request error: " + response);
} else {
Homey.log("API: Weather response received");
// Return weather request
Homey.log("temp: " + response.current_observation.temp_c)
var temp = response.current_observation.temp_c;
var city = response.current_observation.display_location.city;
var country = response.current_observation.display_location.country;

var data = {'temp' : temp, 'city' : city, 'country' : country};
Homey.log(data);

callback (data, true);
}
});
Homey.app.getlocation(callback, args);
}
}
]
Loading

0 comments on commit 9696e26

Please sign in to comment.