Infrastructure now works for: locks, alarms, thermostats, and non-hue lights.
authoramiraj <amiraj.95@uci.edu>
Sat, 3 Aug 2019 20:24:19 +0000 (13:24 -0700)
committeramiraj <amiraj.95@uci.edu>
Sat, 3 Aug 2019 20:24:19 +0000 (13:24 -0700)
AccelerationSensor/AccelerationSensor.groovy
AccelerationSensor/AccelerationSensors.groovy
ColorControl/ColorControl.groovy
ColorControl/ColorControls.groovy
Event/Event.groovy
Extractor/Extractor.groovy
SwitchLevel/SwitchLevel.groovy
SwitchLevel/SwitchLevels.groovy
Variables and events for each device

index 78a9bed..fcc1688 100644 (file)
@@ -2,6 +2,9 @@
 package AccelerationSensor
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class AccelerationSensor {
        private String id
        private String label
@@ -9,8 +12,6 @@ public class AccelerationSensor {
        private String acceleration
        private String currentAcceleration
        private String accelerationLatestValue
-       private List states = []
-       private List timeOfStates = []
 
        AccelerationSensor(String id, String label, String displayName, String acceleration, String accelerationLatestValue) {
                this.id = id
@@ -26,18 +27,90 @@ public class AccelerationSensor {
                this.accelerationLatestValue = value
                this.acceleration = value
                this.currentAcceleration = value
-               this.states.add(value)
-               this.timeOfStates.add(System.currentTimeMillis())
        }
 
-       def statesSince(String info, Date dateObj) {
-               def List happenedStates = []
-               def sinceThen = dateObj.time
-               for (int i = 0;i < timeOfStates.size();i++) {
-                       if (timeOfStates[i]>=sinceThen)
-                               happenedStates.add(states[i])
+       def statesSince() {
+               def evtActive = [[name: "acceleration", value: "active", deviceId: "accelerationSensorID0", descriptionText: "",
+                                 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'],
+                                [name: "acceleration.active", value: "active", deviceId: "accelerationSensorID0", descriptionText: "",
+                                 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def evtInactive = [[name: "acceleration", value: "inactive", deviceId: "accelerationSensorID0", descriptionText: "",
+                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'],
+                                  [name: "acceleration.inactive", value: "inactive", deviceId: "accelerationSensorID0", descriptionText: "",
+                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def init = Verify.getInt(0,4)
+               def evtToSend = []
+               if (init == 0) {//return empty set
+                       return evtToSend
+               } else if (init == 1) {//send one active event
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 2) {//send two active events
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 3) {//send one inactive event
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 4) {//send two inactive events
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               }
+       }
+
+       def eventsSince() {
+               def evtActive = [[name: "acceleration", value: "active", deviceId: "accelerationSensorID0", descriptionText: "",
+                                 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'],
+                                [name: "acceleration.active", value: "active", deviceId: "accelerationSensorID0", descriptionText: "",
+                                 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def evtInactive = [[name: "acceleration", value: "inactive", deviceId: "accelerationSensorID0", descriptionText: "",
+                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'],
+                                  [name: "acceleration.inactive", value: "inactive", deviceId: "accelerationSensorID0", descriptionText: "",
+                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def init = Verify.getInt(0,4)
+               def evtToSend = []
+               if (init == 0) {//return empty set
+                       return evtToSend
+               } else if (init == 1) {//send one active event
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 2) {//send two active events
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 3) {//send one inactive event
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 4) {//send two inactive events
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
                }
-               return happenedStates
        }
 
        
index bf24508..7df4347 100644 (file)
@@ -47,6 +47,15 @@ public class AccelerationSensors {
                }
        }
 
+       //methods
+       def eventsSince(Date dateObj) {
+               return accelerationSensors[0].eventsSince()
+       }
+               
+       def statesSince(String info, Date dateObj) {
+               return accelerationSensors[0].statesSince()
+       }
+
        //Methods for closures
        def count(Closure Input) {
                accelerationSensors.count(Input)
@@ -76,10 +85,6 @@ public class AccelerationSensors {
                accelerationSensors[0].latestValue(deviceFeature)//It is called if we have only one device
        }
 
-       def statesSince(String info, Date dateObj) {
-               return accelerationSensors[0].statesSince(info, dateObj)
-       }
-
        def getAt(int ix) {
                accelerationSensors[ix]
        }
index 4d6eaf7..cd33e8e 100644 (file)
@@ -9,10 +9,14 @@ public class ColorControl {
        private String label
        private String displayName
        private String color
+       private String currentColor
        private String currentSwitch
        private int level
+       private int currentLevel
        private int hue
+       private int currentHue
        private int saturation
+       private int currentSaturation
        private int colorTemperature
        
        ColorControl(Closure sendEvent, String id, String label, String displayName, String color, int hue, int saturation, int level, String currentSwitch, int colorTemperature) {
@@ -20,9 +24,13 @@ public class ColorControl {
                this.label = label
                this.displayName = displayName
                this.color = color
+               this.currentColor = color
                this.hue = hue
+               this.currentHue = hue
                this.saturation = saturation
+               this.currentSaturation = saturation
                this.level = level
+               this.currentLevel = level
                this.currentSwitch = currentSwitch
                this.colorTemperature = colorTemperature
                this.sendEvent = sendEvent
@@ -32,14 +40,18 @@ public class ColorControl {
        def setValue(String value, String name) {
                if ((name == "color") && (value != this.color)) {
                        this.color = value
+                       this.currentColor = value
                        println("the color of the light is changed to $value!")
                } else if ((name == "hue") && (value != this.hue)) {
                        this.hue = value.toInteger()
+                       this.currentHue = value.toInteger()
                        println("The hue level of the light is changed to $value!")
                } else if ((name == "saturation") && (value != this.saturation)) {
                        this.saturation = value.toInteger()
+                       this.currentSaturation = value.toInteger()
                        println("The saturation level of the light is changed to $value!")
                } else if ((name == "level") && (value != this.level)) {
+                       this.currentLevel = value.toInteger()
                        this.level = value.toInteger()
                        println("The level of the light is changed to $value!")
                } else if ((name == "currentSwitch") && (value != this.currentSwitch)) {
@@ -54,6 +66,7 @@ public class ColorControl {
        //methods
        def setColor(String color) {
                if (color != this.color) {
+                       this.currentColor = color
                        this.color = color
                        println("The color of the light is changed to $color!")
                        sendEvent([name: "color", value: "$color", deviceId: this.id, descriptionText: "",
@@ -64,6 +77,7 @@ public class ColorControl {
        def setHue(int hue) {
                if (hue != this.hue) {
                        this.hue = hue
+                       this.currentHue = hue
                        println("The hue level of the light is changed to $hue!")
                        sendEvent([name: "hue", value: "$hue", deviceId: this.id, descriptionText: "",
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
@@ -72,6 +86,7 @@ public class ColorControl {
 
        def setSaturation(int saturation) {
                if (saturation != this.saturation) {
+                       this.currentSaturation = saturation
                        this.saturation = saturation
                        println("The saturation level of the light is changed to $saturation!")
                        sendEvent([name: "saturation", value: "$saturation", deviceId: this.id, descriptionText: "",
@@ -81,6 +96,7 @@ public class ColorControl {
 
        def setLevel(int level) {
                if (level != this.level) {
+                       this.currentLevel = level
                        this.level = level
                        println("The level of the light is changed to $level!")
                        sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
index 5262e91..5122f6b 100644 (file)
@@ -15,10 +15,14 @@ public class ColorControls {
        private String label = "colorControl0"
        private String displayName = "colorControl0"
        private String color = "red"
+       private String currentColor = "red"
        private String currentSwitch = "off"
        private int level = 50
+       private int currentLevel = 50
        private int hue = 50
+       private int currentHue = 50
        private int saturation = 50
+       private int currentSaturation = 50
        private int colorTemperature = 15000
        
 
@@ -67,6 +71,7 @@ public class ColorControls {
        def setValue(LinkedHashMap eventDataMap) {
                if (eventDataMap["name"] == "color") {
                        if (eventDataMap["value"] != colorControls[0].color) {
+                               this.currentColor = eventDataMap["value"]
                                this.color = eventDataMap["value"]
                                colorControls[0].setValue(eventDataMap["value"], "color")
                                sendEvent(eventDataMap)
@@ -74,12 +79,14 @@ public class ColorControls {
                } else if (eventDataMap["name"] == "hue") {
                        if (eventDataMap["value"].toInteger() != colorControls[0].hue) {
                                this.hue = eventDataMap["value"].toInteger()
+                               this.currentHue = eventDataMap["value"].toInteger()
                                colorControls[0].setValue(eventDataMap["value"], "hue")
                                sendEvent(eventDataMap)
                        }
                } else if (eventDataMap["name"] == "saturation") {
                        if (eventDataMap["value"].toInteger() != colorControls[0].saturation) {
                                this.saturation = eventDataMap["value"].toInteger()
+                               this.currentSaturation = eventDataMap["value"].toInteger()
                                colorControls[0].setValue(eventDataMap["value"], "saturation")
                                sendEvent(eventDataMap)
                        }
@@ -97,6 +104,7 @@ public class ColorControls {
                        }
                } else if (eventDataMap["name"] == "level") {
                        if (eventDataMap["value"].toInteger() != colorControls[0].level) {
+                               this.currentLevel = eventDataMap["value"].toInteger() 
                                this.level = eventDataMap["value"].toInteger()
                                colorControls[0].setValue(eventDataMap["value"], "level")
                                sendEvent(eventDataMap)
@@ -108,6 +116,7 @@ public class ColorControls {
        //methods
        def setColor(String color) {
                if (color != this.color) {
+                       this.currentColor = color
                        this.color = color
                        colorControls[0].setColor(color)                        
                }
@@ -115,13 +124,15 @@ public class ColorControls {
 
        def setHue(int hue) {
                if (hue != this.hue) {
-                       this.hue = hue  
+                       this.hue = hue
+                       this.currentHue = hue
                        colorControls[0].setHue(hue)
                }
        }
 
        def setSaturation(int saturation) {
                if (saturation != this.saturation) {
+                       this.currentSaturation = saturation
                        this.saturation = saturation
                        colorControls[0].setSaturation(saturation)                      
                }       
@@ -129,6 +140,7 @@ public class ColorControls {
 
        def setLevel(int level) {
                if (level != this.level) {
+                       this.currentLevel = level
                        this.level = level
                        colorControls[0].setLevel(level)
                }
index 816ea92..60d7276 100644 (file)
@@ -13,6 +13,7 @@ public class Event {
        private String unit
        private String data
        private int integerValue
+       private double doubleValue
        private List integerValues = ["battery", "hue", "saturation", "energy", "level", "temperature", 
                                      "heatingSetpoint", "coolingSetpoint", "thermostatSetpoint", "illuminance"]
        
@@ -27,7 +28,9 @@ public class Event {
                this.unit = unit
                this.data = data
                this.displayed = displayed
-               if (integerValues.contains(name))
+               if (integerValues.contains(name)) {
                        this.integerValue = value.toInteger()
+                       this.doubleValue = Double.parseDouble(value);           
+               }
        }
 }
index 75341c0..e954203 100644 (file)
@@ -70,6 +70,10 @@ import Valve.Valve
 import Valve.Valves
 import MobilePresence.MobilePresence
 import MobilePresence.MobilePresences
+import ColorTemperature.ColorTemperature
+import ColorTemperature.ColorTemperatures
+import Button.Button
+import Button.Buttons
 import Timer.SimulatedTimer
 
 //GlobalVariables
@@ -244,7 +248,7 @@ def timeToday(String time, Object timeZone) {
 @Field def sleepSensorObject0
 @Field def sleepSensorObject1
 @Field def sleepSensorObject2
-//Global Object for class sleep sensor!
+//Global Object for class step sensor!
 @Field stepSensorObjects = 0
 @Field def stepSensorObject0
 @Field def stepSensorObject1
@@ -259,7 +263,7 @@ def timeToday(String time, Object timeZone) {
 @Field def temperatureMeasurementObject0
 @Field def temperatureMeasurementObject1
 @Field def temperatureMeasurementObject2
-//Global Object for class temperature measurement!
+//Global Object for class water sensor!
 @Field waterSensorObjects = 0
 @Field def waterSensorObject0
 @Field def waterSensorObject1
@@ -269,12 +273,21 @@ def timeToday(String time, Object timeZone) {
 @Field def valveObject0
 @Field def valveObject1
 @Field def valveObject2
-//Global Object for class valve!
+//Global Object for class mobile presence!
 @Field mobilePresenceObjects = 0
 @Field def mobilePresenceObject0
 @Field def mobilePresenceObject1
 @Field def mobilePresenceObject2
-
+//Global Object for class color temperature!
+@Field colorTemperatureObjects = 0
+@Field def colorTemperatureObject0
+@Field def colorTemperatureObject1
+@Field def colorTemperatureObject2
+//Global Object for class button!
+@Field buttonObjects = 0
+@Field def buttonObject0
+@Field def buttonObject1
+@Field def buttonObject2
 
 
 //Global variables
@@ -455,6 +468,41 @@ def input(LinkedHashMap metaData) {
                                extractedObjectsConstructorApp2.append(metaData['name']+" = obj.alarmObject\n")
                        }
                        break
+               case "capability.button":
+                       globalObjects.eachLine { line ->
+                               if(line.contains("buttonObject")){
+                                       contains = 1
+                               }
+                       }
+
+                       if (contains == 0)
+                               globalObjects.append("@Field def buttonObject = new Buttons(sendEvent, 1)\n")
+
+                       if (buttonObjects == 0) {
+                               buttonObject0 = metaData['name']
+                               this[buttonObject0] = new Buttons({}, 1)
+                       } else if (buttonObjects == 1) {
+                               buttonObject1 = metaData['name']
+                               this[buttonObject1] = new Buttons({}, 1)
+                       } else if (buttonObjects == 2) {
+                               buttonObject2 = metaData['name']
+                               this[buttonObject2] = new Buttons({}, 1)
+                       }
+
+                       buttonObjects=buttonObjects+1
+
+                       settings.put(metaData['name'], new Buttons({}, 1))
+
+                       if (App == "App1") {
+                               extractedObjectsApp1.append("//Object for class Button!\n")
+                               extractedObjectsApp1.append("def "+metaData['name']+"\n")
+                               extractedObjectsConstructorApp1.append(metaData['name']+" = obj.buttonObject\n")                
+                       } else {
+                               extractedObjectsApp2.append("//Object for class Button!\n")
+                               extractedObjectsApp2.append("def "+metaData['name']+"\n")
+                               extractedObjectsConstructorApp2.append(metaData['name']+" = obj.buttonObject\n")
+                       }
+                       break
                case "capability.battery":
                        globalObjects.eachLine { line ->
                                if(line.contains("batteryObject")){
@@ -560,6 +608,41 @@ def input(LinkedHashMap metaData) {
                                extractedObjectsConstructorApp2.append(metaData['name']+" = obj.carbonMonoxideDetectorObject\n")
                        }
                        break
+               case "capability.colorTemperature":
+                       globalObjects.eachLine { line ->
+                               if(line.contains("colorTemperatureObject")){
+                                       contains = 1
+                               }
+                       }
+
+                       if (contains == 0)
+                               globalObjects.append("@Field def colorTemperatureObject = new ColorTemperatures(sendEvent, 1)\n")
+
+                       if (colorTemperatureObjects == 0) {
+                               colorTemperatureObject0 = metaData['name']
+                               this[colorTemperatureObject0] = new ColorTemperatures({}, 1)
+                       } else if (colorTemperatureObjects == 1) {
+                               colorTemperatureObject1 = metaData['name']
+                               this[colorTemperatureObject1] = new ColorTemperatures({}, 1)
+                       } else if (colorTemperatureObjects == 2) {
+                               colorTemperatureObject2 = metaData['name']
+                               this[colorTemperatureObject2] = new ColorTemperatures({}, 1)
+                       }
+
+                       colorTemperatureObjects=colorTemperatureObjects+1
+
+                       settings.put(metaData['name'], new ColorTemperatures({}, 1))
+
+                       if (App == "App1") {
+                               extractedObjectsApp1.append("//Object for class color temperature!\n")
+                               extractedObjectsApp1.append("def "+metaData['name']+"\n")
+                               extractedObjectsConstructorApp1.append(metaData['name']+" = obj.colorTemperatureObject\n")              
+                       } else {
+                               extractedObjectsApp2.append("//Object for class color control!\n")
+                               extractedObjectsApp2.append("def "+metaData['name']+"\n")
+                               extractedObjectsConstructorApp2.append(metaData['name']+" = obj.colorTemperatureObject\n")
+                       }
+                       break
                case "capability.colorControl":
                        globalObjects.eachLine { line ->
                                if(line.contains("colorControlObject")){
index 8782365..24bd7bf 100644 (file)
@@ -108,4 +108,21 @@ public class SwitchLevel {
                        this.rate = value.toInteger()
                }
        }
+
+
+       def currentValue(String deviceFeature) {
+               if (deviceFeature == "level") {
+                       return level
+               } else if (deviceFeature == "switch") {
+                       return switchState
+               }
+       }
+
+       def latestValue(String deviceFeature) {
+               if (deviceFeature == "level") {
+                       return level
+               } else if (deviceFeature == "switch") {
+                       return switchState
+               }
+       }
 }
index 490e52d..1bae6a1 100644 (file)
@@ -123,6 +123,15 @@ public class SwitchLevels {
                }
        }
 
+       def currentValue(String deviceFeature) {
+               switchLevels[0].currentValue(deviceFeature)
+       }
+       
+       def latestValue(String deviceFeature) {
+               switchLevels[0].latestValue(deviceFeature)
+       }
+       
+
        def getAt(int ix) {
                switchLevels[ix]
        }
index 66e3f51..9594b89 100644 (file)
@@ -247,6 +247,10 @@ switchObject.setValue([name: "switch", value: "off", deviceId: "switchID0", desc
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 switchObject.setValue([name: "switch", value: "on", deviceId: "switchID0", descriptionText: "",
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+switchObject.setValue([name: "switch.off", value: "off", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+switchObject.setValue([name: "switch.on", value: "on", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 /////
 /*events*/
 //
@@ -363,6 +367,10 @@ colorControlObject.setValue([name: "switch", value: "on", deviceId: "colorContro
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 colorControlObject.setValue([name: "switch", value: "off", deviceId: "colorControlID0", descriptionText: "",
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+colorControlObject.setValue([name: "switch.on", value: "on", deviceId: "colorControlID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+colorControlObject.setValue([name: "switch.off", value: "off", deviceId: "colorControlID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 colorControlObject.setValue([name: "colorTemperature", value: "50", deviceId: "colorControlID0", descriptionText: "",
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 /*events*/
@@ -417,6 +425,10 @@ relaySwitchObject.setValue([name: "switch", value: "off", deviceId: "relaySwitch
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 relaySwitchObject.setValue([name: "switch", value: "on", deviceId: "relaySwitchID0", descriptionText: "",
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+relaySwitchObject.setValue([name: "switch.off", value: "off", deviceId: "relaySwitchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+relaySwitchObject.setValue([name: "switch.on", value: "on", deviceId: "relaySwitchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 /////
 /*events*/
 //
@@ -459,6 +471,10 @@ switchLevelObject.setValue([name: "switch", value: "on", deviceId: "switchLevelI
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 switchLevelObject.setValue([name: "switch", value: "off", deviceId: "switchLevelID0", descriptionText: "",
 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+switchLevelObject.setValue([name: "switch.on", value: "on", deviceId: "switchLevelID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+switchLevelObject.setValue([name: "switch.off", value: "off", deviceId: "switchLevelID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
 /////
 /*events*/
 //
@@ -503,3 +519,37 @@ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "
 /////
 /*events*/
 //
+-------------------------------------------------------------------------------
+
+
+//For color temperature:
+int colorTemperature
+String switchState
+/*events*/
+colorTemperatureObject.setValue([name: "switch", value: "off", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+colorTemperatureObject.setValue([name: "switch", value: "on", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+colorTemperatureObject.setValue([name: "switch.off", value: "off", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+colorTemperatureObject.setValue([name: "switch.on", value: "on", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+colorTemperatureObject.setValue([name: "colorTemperature", value: "13000", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+/////
+/*events*/
+//
+-------------------------------------------------------------------------------
+
+
+//For button:
+String button
+/*events*/
+buttonObject.setValue([name: "button", value: "held", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"buttonNumber": 1}'])
+buttonObject.setValue([name: "button", value: "push", deviceId: "switchID0", descriptionText: "",
+displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"buttonNumber": 1}'])
+/////
+/*events*/
+//
+