WWST-2086 - New weather API fix (#3869)
* WWST-2086 - New weather API fix * Remove duplicated location request
This commit is contained in:
committed by
Bob Florian
parent
a0f72fac84
commit
10fb53de0b
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user