edit
[smartthings-infrastructure.git] / Methods / eventHandler.groovy
index ca13fa3c5e3d13bf2390c920f0abeb95284f648c..59bb059fe9086f4f9b7dfa82ef55c024e37765d8 100644 (file)
@@ -11,7 +11,8 @@ def eventHandler(LinkedHashMap eventDataMap) {
        def data = eventDataMap["data"]
 
        for (int i = 0;i < app2.eventList.size();i++) {
-               if (app2.eventList[i] == name) {
+               if (app2.eventList[i] == name &&
+                   (app2.valueList[i] == "" || app2.valueList[i] == value)) {
                        def event = new Event(value, name, deviceId, descriptionText, displayed, linkText, linkText, isStateChange, unit, data)
                        if (app2.functionList[i] instanceof String) {
                                String toCall = app2.functionList[i]
@@ -23,8 +24,9 @@ def eventHandler(LinkedHashMap eventDataMap) {
        }
 
        for (int i = 0;i < app1.eventList.size();i++) {
-               if (app1.eventList[i] == name) {
-                       def event = new Event(value, name, deviceId, descriptionText, displayed, linkText, linkText, isStateChange, unit, data)
+               if (app1.eventList[i] == name &&
+                   (app1.valueList[i] == "" || app1.valueList[i] == value)) {
+                        def event = new Event(value, name, deviceId, descriptionText, displayed, linkText, linkText, isStateChange, unit, data)
                        if (app1.functionList[i] instanceof String) {
                                String toCall = app1.functionList[i]
                                app1."$toCall"(event)