Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
Bugfix: API key wasn't being used correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jschlackman committed Sep 13, 2017
1 parent 172a8bd commit 0f79f22
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,19 +288,21 @@ private airNowCategory() {
} else {
requestPath = 'observation/zipCode/current/'
}


log.debug("Getting AirNow data: ${requestPath}")

// Set up the AirNow API query
def params = [
uri: 'http://www.airnowapi.org/aq/',
path: requestPath,
contentType: 'application/json',
query: [format:'application/json', zipCode: airZip, distance: 25, API_KEY: airNowKey]
query: [format:'application/json', zipCode: airZip, distance: 25, API_KEY: appSettings.airNowKey]
]

try {
// Send query to the AirNow API
httpGet(params) {resp ->
state.aqi = resp.data
state.aqi = resp.data
// Print the AQI numbers and categories for both PM2.5 and O3 to the debug log.
log.debug("${resp.data[0].ParameterName}: ${resp.data[0].AQI}, ${resp.data[0].Category.Name} (${resp.data[0].Category.Number})")
log.debug("${resp.data[1].ParameterName}: ${resp.data[1].AQI}, ${resp.data[1].Category.Name} (${resp.data[1].Category.Number})")
Expand All @@ -322,8 +324,10 @@ private airNowCategory() {

}
catch (e) {
log.error("error: $e")
log.error("Could not retrieve AQI: $e")
// AQI information could not be retrieved
result = ["name": "Unavailable", "number": 0]
}

return result
}
}

0 comments on commit 0f79f22

Please sign in to comment.