WWST-2086 - New weather API fix (#3869)

* WWST-2086 - New weather API fix

* Remove duplicated location request
This commit is contained in:
Juan Pablo Risso
2019-01-14 12:21:38 -05:00
committed by Bob Florian
parent a0f72fac84
commit 10fb53de0b
2 changed files with 5 additions and 4 deletions

View File

@@ -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
}
}

View File

@@ -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) {