Changes in classes: new concept for latest value + all types of events generated...
[smartthings-infrastructure.git] / Methods / eventHandler.groovy
index b838418bf64c12cbba30b99e4b4804d8fa919686..ca13fa3c5e3d13bf2390c920f0abeb95284f648c 100644 (file)
@@ -13,14 +13,24 @@ def eventHandler(LinkedHashMap eventDataMap) {
        for (int i = 0;i < app2.eventList.size();i++) {
                if (app2.eventList[i] == name) {
                        def event = new Event(value, name, deviceId, descriptionText, displayed, linkText, linkText, isStateChange, unit, data)
-                       app2.functionList[i](event)
+                       if (app2.functionList[i] instanceof String) {
+                               String toCall = app2.functionList[i]
+                               app2."$toCall"(event)
+                       }
+                       else
+                               app2.functionList[i](event)
                }
        }
 
        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)
-                       app1.functionList[i](event)
+                       if (app1.functionList[i] instanceof String) {
+                               String toCall = app1.functionList[i]
+                               app1."$toCall"(event)
+                       }
+                       else
+                               app1.functionList[i](event)
                }
        }
 }