From 10fb53de0ba946526faacfa107a674cb95f379c2 Mon Sep 17 00:00:00 2001 From: Juan Pablo Risso Date: Mon, 14 Jan 2019 12:21:38 -0500 Subject: [PATCH] WWST-2086 - New weather API fix (#3869) * WWST-2086 - New weather API fix * Remove duplicated location request --- .../smartweather-station-tile.groovy | 4 ++-- .../severe-weather-alert.src/severe-weather-alert.groovy | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy b/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy index 81efe704..66b0119c 100644 --- a/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy +++ b/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy @@ -271,7 +271,7 @@ def poll() { } // Alerts - def alerts = getTwcAlerts(zipCode) + def alerts = getTwcAlerts("${loc.latitude},${loc.longitude}") if (alerts) { alerts.each {alert -> def msg = alert.headlineText @@ -379,4 +379,4 @@ private estimateLux(obs, sunriseDate, sunsetDate) { } } lux -} \ No newline at end of file +} diff --git a/smartapps/smartthings/severe-weather-alert.src/severe-weather-alert.groovy b/smartapps/smartthings/severe-weather-alert.src/severe-weather-alert.groovy index a26a656b..86620280 100644 --- a/smartapps/smartthings/severe-weather-alert.src/severe-weather-alert.groovy +++ b/smartapps/smartthings/severe-weather-alert.src/severe-weather-alert.groovy @@ -81,7 +81,8 @@ def checkForSevereWeather() { if(!(zipcodeIsValid())) { log.warn "Severe Weather Alert: Invalid zipcode entered, defaulting to location's zipcode" } - alerts = getTwcAlerts(zipCode) + def zipToLocation = getTwcLocation("$zipCode").location + alerts = getTwcAlerts("${zipToLocation.latitude},${zipToLocation.longitude}") } else { log.warn "Severe Weather Alert: Location is not defined" } @@ -116,7 +117,7 @@ def locationIsDefined() { } def zipcodeIsValid() { - zipcode && zipcode.isNumber() && zipcode.size() == 5 + zipCode && zipCode.isNumber() && zipCode.size() == 5 } private send(message) {