Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetTwc functionality, remove "float" #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions IrrigationSchedulerApp.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -286,27 +286,24 @@ def wasWetYesterday() {

def isWet() {

def todaysWeather = getWeatherFeature("conditions", zipcode)
def todaysPrecip = (todaysWeather?.current_observation?.precip_today_in)
def todaysInches = todaysPrecip ? safeToFloat(todaysPrecip) : 0
def todaysWeather = getTwcConditions(zipcode)
def todaysPrecip = (todaysWeather?.precip6Hour)
def todaysInches = todaysPrecip
log.info("Today's percipitation for ${zipcode}: ${todaysInches} in")
return todaysInches
}

def isStormy() {

def forecastWeather = getWeatherFeature("forecast", zipcode)
def forecastPrecip=forecastWeather.forecast.simpleforecast.forecastday.qpf_allday.in?.toArray()
def forecastInches = forecastPrecip ? safeToFloat(forecastPrecip[0]) : 0
def forecastPrecip = getTwcForecast(zipcode).qpf[1]
def forecastInches = forecastPrecip
log.info("Forecast percipitation for $zipcode: $forecastInches in")
return forecastInches
}

def isHot() {

def forecastWeather = getWeatherFeature("forecast", zipcode)
def todaysTemps=forecastWeather.forecast.simpleforecast.forecastday.high.fahrenheit?.toArray()
def todaysHighTemp = todaysTemps ? safeToFloat(todaysTemps[0]) : 50
def todaysHighTemp = getTwcConditions(zipcode).temperatureMax24Hour
log.info("Forecast high temperature for $zipcode: $todaysHighTemp F")
return todaysHighTemp
}
Expand Down