forked from loverso-smartthings/smart_sprinkler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update IrrigationSchedulerApp.groovy
Fixes bug to allow irrigation if no zip code is entered as a preference.
- Loading branch information
Showing
1 changed file
with
30 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ definition( | |
namespace: "d8adrvn/smart_sprinkler", | ||
author: "[email protected] and [email protected]", | ||
description: "Schedule sprinklers to run unless there is rain.", | ||
category: "Green Living", | ||
version: "2.93", | ||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/water_moisture.png", | ||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/[email protected]" | ||
|
@@ -35,7 +34,7 @@ definition( | |
preferences { | ||
page(name: "schedulePage", title: "Schedule", nextPage: "sprinklerPage", uninstall: true) { | ||
section("App configruation...") { | ||
label title: "Choose an title for App", required: true, defaultValue: "Irrigation Scheduler" | ||
label name: "label", title: "Choose an title for App", required: true, defaultValue: "Irrigation Scheduler" | ||
input "isNotificationEnabled", "boolean", title: "Send Push Notification To Report Status At Irrigation Start", description: "Do You Want To Receive Push Notifications?", defaultValue: "true", required: false | ||
} | ||
|
||
|
@@ -140,6 +139,8 @@ def scheduling() { | |
|
||
def waterTimeOneStart() { | ||
state.currentTimerIx = 0 | ||
log.info (title: $title) | ||
log.info (label: $label) | ||
scheduleCheck() | ||
} | ||
def waterTimeTwoStart() { | ||
|
@@ -215,34 +216,35 @@ def daysSince() { | |
} | ||
|
||
def isRainDelay() { | ||
if (zipcode) { | ||
def rainGauge = 0 | ||
|
||
def rainGauge = 0 | ||
|
||
if (isYesterdaysRainEnabled.equals("true")) { | ||
rainGauge = rainGauge + wasWetYesterday() | ||
} | ||
|
||
if (isTodaysRainEnabled.equals("true")) { | ||
rainGauge = rainGauge + isWet() | ||
} | ||
|
||
if (isForecastRainEnabled.equals("true")) { | ||
rainGauge = rainGauge + isStormy() | ||
} | ||
|
||
log.info ("Virtual rain gauge reads $rainGauge in") | ||
if (rainGauge > (wetThreshold?.toFloat() ?: 0.5)) { | ||
if (isNotificationEnabled.equals("true")) { | ||
sendPush("Skipping watering today due to precipitation.") | ||
} | ||
for(s in switches) { | ||
if("rainDelayed" in s.supportedCommands.collect { it.name }) { | ||
s.rainDelayed() | ||
log.trace "Watering is rain delayed for $s" | ||
} | ||
if (isYesterdaysRainEnabled.equals("true")) { | ||
rainGauge = rainGauge + wasWetYesterday() | ||
} | ||
return true | ||
} | ||
|
||
if (isTodaysRainEnabled.equals("true")) { | ||
rainGauge = rainGauge + isWet() | ||
} | ||
|
||
if (isForecastRainEnabled.equals("true")) { | ||
rainGauge = rainGauge + isStormy() | ||
} | ||
|
||
log.info ("Virtual rain gauge reads $rainGauge in") | ||
if (rainGauge > (wetThreshold?.toFloat() ?: 0.5)) { | ||
if (isNotificationEnabled.equals("true")) { | ||
sendPush("Skipping watering today due to precipitation.") | ||
} | ||
for(s in switches) { | ||
if("rainDelayed" in s.supportedCommands.collect { it.name }) { | ||
s.rainDelayed() | ||
log.info "Watering is rain delayed for $s" | ||
} | ||
} | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
|