ok change of plans.. i implemented the weather (it only gets daily precip forecase in inches)
I added an option to select your weather device either darksky or openweather etc and it gets the daily rain forecase from there ie rainToday.. take alook at the new code
here is the bulk of the code
def weatherPage() {
dynamicPage(name: 'weatherPage', title: 'Weather settings') {
section("Location to get weather forecast and conditions:") {
input(name: 'zipcode', type: 'text', title: "Zipcode default location: ${getDefaultLocation()}", required: false, submitOnChange: true)
input "weatherDevice", "capability.relativeHumidityMeasurement", title: "Weather Device (ie darksky or openweather) to get rain forecase from?", required: false
input 'isRain', 'bool', title: 'Enable Rain check:', metadata: [values: ['true', 'false']]
input 'rainDelay', 'decimal', title: 'inches of rain that will delay watering, default: 0.2', required: false
input 'isSeason', 'bool', title: 'Enable Seasonal Weather Adjustment:', metadata: [values: ['true', 'false']]
}
}
}
//capture today's total rainfall - scheduled for just before midnight each day
def getRainToday() {
log.debug "Current Weather Device to get precip info = $weatherDevice"
if (weatherDevice)
{
def rainToday = weatherDevice.currentValue("rainToday")
log.debug "rainToday = $rainToday"
float TRain = 0.0
TRain = rainToday.toFloat()
if (TRain > 25.0) TRain = 25.0
else if (TRain < 0.0) TRain = 0.0
log.debug "getRainToday(): ${rainToday} / ${TRain}"
int day = getWeekDay() // what day is it today?
// log.debug "got day = $day"
if (day == 7) day = 0 // adjust: state.Rain order is Su,Mo,Tu,We,Th,Fr,Sa
state.Rain[day] = TRain as Float // store today's total rainfall
}
// def conditionsData = getConditions()
else {
note('warning', "${app.label}: Please select an openweather or darksky weather device that has a daily rain forecase", 'a')
}
}