Skip to content

Commit 99adb71

Browse files
marstorpworkingmonk
authored andcommitted
C2C-3 Review and fix Rachio Integration (SmartThingsCommunity#3361)
Update default value for watering valve to be off Update calculation of rainDelay to prevent negative days
1 parent 616c25d commit 99adb71

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

devicetypes/rachio/rachio-iro2-controller.src/rachio-iro2-controller.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ metadata {
7878
tiles (scale: 2){
7979
multiAttributeTile(name: "valveTile", type: "generic", width: 6, height: 4) {
8080
tileAttribute("device.watering", key: "PRIMARY_CONTROL" ) {
81-
attributeState "on", label: 'Watering', action: "close", icon: "st.valves.water.open", backgroundColor: "#00a0dc", nextState: "off"
8281
attributeState "off", label: 'Off', action: "runAllZones", icon: "st.valves.water.closed", backgroundColor: "#ffffff", nextState:"on"
8382
attributeState "offline", label: 'Offline', icon: "st.valves.water.closed", backgroundColor: "#cccccc"
8483
attributeState "standby", label: 'Standby Mode', icon: "st.valves.water.closed", backgroundColor: "#cccccc"
84+
attributeState "on", label: 'Watering', action: "close", icon: "st.valves.water.open", backgroundColor: "#00a0dc", nextState: "off"
8585
}
8686
tileAttribute("device.curZoneRunStatus", key: "SECONDARY_CONTROL") {
8787
attributeState("default", label:'${currentValue}')

devicetypes/rachio/rachio-iro2-zone.src/rachio-iro2-zone.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ metadata {
8686
tiles (scale: 2){
8787
multiAttributeTile(name: "valveTile", type: "generic", width: 6, height: 4) {
8888
tileAttribute("device.watering", key: "PRIMARY_CONTROL" ) {
89-
attributeState "on", label: 'Watering', action: "close", icon: "st.valves.water.open", backgroundColor: "#00a0dc", nextState: "updating"
9089
attributeState "off", label: 'Off', action: "open", icon: "st.valves.water.closed", backgroundColor: "#ffffff", nextState:"updating"
9190
attributeState "offline", label: 'Offline', icon: "st.valves.water.closed", backgroundColor: "#cccccc"
9291
attributeState "disabled", label: 'Disabled', icon: "st.valves.water.closed", backgroundColor: "#cccccc"
9392
attributeState "standby", label: 'Standby Mode', icon: "st.valves.water.closed", backgroundColor: "#cccccc"
93+
attributeState "on", label: 'Watering', action: "close", icon: "st.valves.water.open", backgroundColor: "#00a0dc", nextState: "updating"
9494
attributeState "updating", label:"Working"
9595
}
9696
tileAttribute("device.zoneRunStatus", key: "SECONDARY_CONTROL") {

smartapps/rachio/rachio-connect.src/rachio-connect.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,9 +1281,12 @@ def getCurrentRainDelay(res) {
12811281
//log.debug("getCurrentRainDelay($devId)...")
12821282
// convert to configured rain delay to days.
12831283
//def ret = (res?.rainDelayExpirationDate || res?.rainDelayStartDate) ? (res?.rainDelayExpirationDate - res?.rainDelayStartDate)/(26*60*60*1000) : 0
1284+
def value = 0
12841285
def rainDelayStartDate = res?.rainDelayStartDate ?: (new Date().getTime())
1285-
def ret = (res?.rainDelayExpirationDate) ? (res?.rainDelayExpirationDate - rainDelayStartDate)/(26*60*60*1000) : 0
1286-
def value = (long) Math.floor(ret + 0.5d)
1286+
if(res?.rainDelayExpirationDate && (rainDelayStartDate < res.rainDelayExpirationDate)) {
1287+
value = (res.rainDelayExpirationDate - rainDelayStartDate)/(26*60*60*1000)
1288+
value = (long) Math.floor(value + 0.5d)
1289+
}
12871290
return value
12881291
}
12891292

0 commit comments

Comments
 (0)