node-red-node-openweathermap
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -12,3 +12,4 @@ { | ||
"latitude": "Latitude", | ||
"longitude": "Longitude" | ||
"longitude": "Longitude", | ||
"apikey": "API Key" | ||
}, | ||
@@ -15,0 +16,0 @@ "placeholder": { |
{ | ||
"name" : "node-red-node-openweathermap", | ||
"version" : "0.1.0", | ||
"version" : "0.1.1", | ||
"description" : "A Node-RED node that gets the weather report from openweathermap", | ||
@@ -5,0 +5,0 @@ "dependencies" : { |
@@ -20,3 +20,6 @@ node-red-node-openweathermap | ||
**Note:** An API key is required to use these nodes. To obtain an API key | ||
go to <a href="http://openweathermap.org/appid" target="_new">OpenWeatherMap</a>. | ||
### Input Node | ||
@@ -23,0 +26,0 @@ |
@@ -50,5 +50,5 @@ /** | ||
if (node.lat && node.lon) { | ||
url = "http://api.openweathermap.org/data/2.5/weather?lat=" + node.lat + "&lon=" + node.lon; | ||
url = "http://api.openweathermap.org/data/2.5/weather?lat=" + node.lat + "&lon=" + node.lon + "&APPID=" + node.credentials.apikey; | ||
} else if (node.city && node.country) { | ||
url = "http://api.openweathermap.org/data/2.5/weather?q=" + node.city + "," + node.country; | ||
url = "http://api.openweathermap.org/data/2.5/weather?q=" + node.city + "," + node.country + "&APPID=" + node.credentials.apikey; | ||
} | ||
@@ -130,2 +130,3 @@ | ||
var lon; | ||
if ((!node.credentials) || (!node.credentials.hasOwnProperty("apikey"))) { this.error("No API Key set"); } | ||
@@ -175,2 +176,3 @@ this.interval_id = setInterval( function() { | ||
var lon; | ||
if ((!node.credentials) || (!node.credentials.hasOwnProperty("apikey"))) { this.error("No API Key set"); } | ||
@@ -205,5 +207,13 @@ this.on('input', function(msg) { | ||
RED.nodes.registerType("openweathermap",OpenWeatherMapQueryNode); | ||
RED.nodes.registerType("openweathermap in",OpenWeatherMapInputNode); | ||
RED.nodes.registerType("openweathermap",OpenWeatherMapQueryNode,{ | ||
credentials: { | ||
apikey: {type:"password"} | ||
} | ||
}); | ||
RED.nodes.registerType("openweathermap in",OpenWeatherMapInputNode,{ | ||
credentials: { | ||
apikey: {type:"password"} | ||
} | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
37891
238
64