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 if (sentMode == "night") {
+ this.mode = "night"
+ this.locationMode = "night"
+ } else {
+ this.mode = sentMode
+ this.locationMode = sentMode
+ }
sendEvent(eventDataMap)
}
}