sendEventSmartThings(eventDataMap)
}
} else if (deviceIntValueSmartThing.containsKey(name)) {
- if (!value.equals(deviceIntValueSmartThing.get(name))) {
- deviceIntValueSmartThing.put(name, value)
+ if (!value.toInteger().equals(deviceIntValueSmartThing.get(name))) {
+ deviceIntValueSmartThing.put(name, value.toInteger())
println("the $name of the $displayNameSmartThing with id:$tmpID is triggered to $value!")
sendEventSmartThings(eventDataMap)
}
}
def sendCurrentValue() {
- def evtTemp = [[name: labelSmartThing, value: deviceIntValueSmartThing.get(labelSmartThing), deviceId: idSmartThing, descriptionText: "",
+ def evtTemp = [[name: labelSmartThing, value: deviceIntValueSmartThing.get(labelSmartThing).toString(), deviceId: idSmartThing, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
def init = Verify.getInt(0,1)
def evtToSend = []
if (!deviceIntValueSmartThing.get(feature).equals(newValue)) {
deviceIntValueSmartThing.put(feature, newValue)
println("$feature of the $displayNameSmartThing with id:$idSmartThing is changed to $newValue!")
- sendEventSmartThings([name: feature, value: newValue, deviceId: idSmartThing, descriptionText: "",
+ sendEventSmartThings([name: feature, value: newValue.toString(), deviceId: idSmartThing, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
// Methods to return values
- def getProperty(String currentProperty) {
+ def propertyMissing(String currentProperty) {
String property = currentProperty
if (property.contains("current")) // Check to see if we have currentXXX or xxx
property = property.substring(7,8).toLowerCase()+property.substring(8);
def currentValue(String deviceFeature) {
if (deviceValueSmartThing.containsKey(deviceFeature)) {
- return deviceValueSmartThing.get(deviceFeature).toString()
+ return deviceValueSmartThing.get(deviceFeature)
} else if (deviceIntValueSmartThing.containsKey(deviceFeature)) {
- return deviceIntValueSmartThing.get(deviceFeature).getValue()
+ return deviceIntValueSmartThing.get(deviceFeature)
} else {
println("Wrong device feature is sent to this method!")
}