Changing the writes to the fields into real String values (the listener needs real...
[smartthings-infrastructure.git] / Location / LocationVar.groovy
index eeaa9472c381f35eb5350a349bc67eb0c55b6f67..e2cf09b65f50a6d30c7b34ba99ebc0292c83ea4b 100755 (executable)
@@ -53,8 +53,16 @@ class LocationVar {
                if (this.mode != eventDataMap['value']) {
                        def sentMode = eventDataMap['value']
                        println("The location is changed to $sentMode!")
-                       this.mode = sentMode
-                       this.locationMode = sentMode
+                       if (sentMode == "home") {
+                               this.mode = "home"
+                               this.locationMode = "home"
+                       } else if (sentMode == "away") {
+                               this.mode = "away"
+                               this.locationMode = "away"
+                       } else {
+                               this.mode = "night"
+                               this.locationMode = "night"
+                       }
                        sendEvent(eventDataMap)
                }
        }