projects
/
smartthings-infrastructure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changes in classes: new concept for latest value + all types of events generated...
[smartthings-infrastructure.git]
/
RelaySwitch
/
RelaySwitches.groovy
diff --git
a/RelaySwitch/RelaySwitches.groovy
b/RelaySwitch/RelaySwitches.groovy
index afb3ace98a00990b18e161a32b9bbdede20ad54a..4a3df4ff4fa4d010cc0bfa9dc4aba915c1b4a313 100644
(file)
--- a/
RelaySwitch/RelaySwitches.groovy
+++ b/
RelaySwitch/RelaySwitches.groovy
@@
-38,6
+38,9
@@
public class RelaySwitches {
def find(Closure Input) {
relaySwitches.find(Input)
}
def find(Closure Input) {
relaySwitches.find(Input)
}
+ def sort(Closure Input) {
+ relaySwitches.sort(Input)
+ }
def collect(Closure Input) {
relaySwitches.collect(Input)
}
def collect(Closure Input) {
relaySwitches.collect(Input)
}
@@
-45,40
+48,40
@@
public class RelaySwitches {
//By Apps
def on() {
if (switchState != "on") {
//By Apps
def on() {
if (switchState != "on") {
- relaySwitches[0].on()
- switchLatestValue = switchState
+ switchLatestValue = "on"
switchState = "on"
currentSwitch = "on"
switchState = "on"
currentSwitch = "on"
+ relaySwitches[0].on()
}
}
def on(LinkedHashMap metaData) {
if (switchState != "on") {
def task = timers.runAfter(metaData["delay"]) {
}
}
def on(LinkedHashMap metaData) {
if (switchState != "on") {
def task = timers.runAfter(metaData["delay"]) {
- relaySwitches[0].on()
- switchLatestValue = switchState
+ switchLatestValue = "on"
switchState = "on"
currentSwitch = "on"
switchState = "on"
currentSwitch = "on"
+ relaySwitches[0].on()
}
}
}
def off() {
if (switchState != "off") {
}
}
}
def off() {
if (switchState != "off") {
- relaySwitches[0].off()
- switchLatestValue = switchState
+ switchLatestValue = "off"
switchState = "off"
currentSwitch = "off"
switchState = "off"
currentSwitch = "off"
+ relaySwitches[0].off()
}
}
def off(LinkedHashMap metaData) {
if (switchState != "off") {
def task = timers.runAfter(metaData["delay"]) {
}
}
def off(LinkedHashMap metaData) {
if (switchState != "off") {
def task = timers.runAfter(metaData["delay"]) {
- relaySwitches[0].off()
- switchLatestValue = switchState
+ switchLatestValue = "off"
switchState = "off"
currentSwitch = "off"
switchState = "off"
currentSwitch = "off"
+ relaySwitches[0].off()
}
}
}
}
}
}
@@
-86,9
+89,9
@@
public class RelaySwitches {
//By Model Checker
def setValue(LinkedHashMap eventDataMap) {
if (eventDataMap["value"] != relaySwitches[0].switchState) {
//By Model Checker
def setValue(LinkedHashMap eventDataMap) {
if (eventDataMap["value"] != relaySwitches[0].switchState) {
+ this.switchState = eventDataMap["value"]
+ this.switchLatestValue = eventDataMap["value"]
relaySwitches[0].setValue(eventDataMap["value"])
relaySwitches[0].setValue(eventDataMap["value"])
- this.switchState = relaySwitches[0].switchState
- this.switchLatestValue = relaySwitches[0].switchLatestValue
sendEvent(eventDataMap)
}
}
sendEvent(eventDataMap)
}
}