projects
/
smartthings-infrastructure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Infrastructure compatible with 2 types of switches.(Normal switches and otherVsGeneri...
[smartthings-infrastructure.git]
/
EnergyMeter
/
EnergyMeter.groovy
diff --git
a/EnergyMeter/EnergyMeter.groovy
b/EnergyMeter/EnergyMeter.groovy
index c4eca238f66d6d13e23c209ea9688882523e243e..83f2283c3bdae185c2f27dd7ae8373717c863dbe 100644
(file)
--- a/
EnergyMeter/EnergyMeter.groovy
+++ b/
EnergyMeter/EnergyMeter.groovy
@@
-8,12
+8,14
@@
public class EnergyMeter {
private String displayName
private int energy
private int currentEnergy
private String displayName
private int energy
private int currentEnergy
+ private String status
- EnergyMeter(String id, String label, String displayName, int energy) {
+ EnergyMeter(String id, String label, String displayName, int energy
, String status
) {
this.id = id
this.label = label
this.displayName = displayName
this.energy = energy
this.id = id
this.label = label
this.displayName = displayName
this.energy = energy
+ this.status = status
}
//By Model Checker
}
//By Model Checker
@@
-23,6
+25,20
@@
public class EnergyMeter {
this.currentEnergy = value.toInteger()
}
this.currentEnergy = value.toInteger()
}
+ def reset() {
+ if (status != "on") {
+ status = "on"
+ println("the energy meter is on!")
+ }
+ }
+
+ def off() {
+ if (status != "off") {
+ status = "off"
+ println("the energy meter is off!")
+ }
+ }
+
def currentValue(String deviceFeature) {
if (deviceFeature == "energy") {
return energy
def currentValue(String deviceFeature) {
if (deviceFeature == "energy") {
return energy