Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
authoramiraj <amiraj.95@uci.edu>
Mon, 5 Aug 2019 02:58:53 +0000 (19:58 -0700)
committeramiraj <amiraj.95@uci.edu>
Mon, 5 Aug 2019 02:58:53 +0000 (19:58 -0700)
20 files changed:
ColorControl/ColorControls.groovy
ColorTemperature/ColorTemperatures.groovy
Extractor/ExtractorScript.py
GlobalVariables/GlobalVariablesBothApps.groovy [deleted file]
Runner.py
Thermostat/Thermostats.groovy
eventSimulator/colorControlSwitchOffDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/colorControlSwitchOnDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/colorTemperatureSwitchOffDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/colorTemperatureSwitchOffEvent.groovy [new file with mode: 0644]
eventSimulator/colorTemperatureSwitchOnDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/colorTemperatureSwitchOnEvent.groovy [new file with mode: 0644]
eventSimulator/relaySwitchOffDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/relaySwitchOnDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/switchLevelEvent.groovy
eventSimulator/switchLevelOffDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/switchLevelOnDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/switchOffDefaultEvent.groovy [new file with mode: 0644]
eventSimulator/switchOnDefaultEvent.groovy [new file with mode: 0644]
run.sh

index 306ba87db72324ef0a295e879ba0223e9f6ecde0..7a5498053674d6192b89e391c005a221dc561273 100644 (file)
@@ -31,18 +31,16 @@ public class ColorControls {
                this.deviceNumbers = deviceNumbers
                this.colorControls = []
 
-               /*def initHue = Verify.getIntFromList(30, 50, 70)
+               def initHue = Verify.getIntFromList(30, 50)
                this.hue = initHue
-               def initSat = Verify.getIntFromList(40, 50, 60)
+               def initSat = Verify.getIntFromList(40, 50)
                this.saturation = initSat
                def init = Verify.getInt(0,2)
                if (init == 0) {
                        this.color = "red"
-               } else if (init == 1) {
-                       this.color = "green"
                } else {
                        this.color = "blue"
-               }*/
+               }
 
                colorControls.add(new ColorControl(sendEvent, id, label, displayName, this.color, this.hue, this.saturation, this.level, this.currentSwitch, this.colorTemperature))
        }
index 952bfcd86759678e50453bf4d3fa40c3cfc58205..77f01753b04f03a1f4c4892d1905ffbd82ea7e1e 100644 (file)
@@ -25,6 +25,17 @@ public class ColorTemperatures {
                this.deviceNumbers = deviceNumbers
                this.colorTemperatues = []
 
+               def initLevel = Verify.getIntFromList(50, 70)
+               this.level = initLevel 
+               def initTemp = Verify.getIntFromList(10000, 15000)
+               this.colorTemperature = initTemp 
+               def init = Verify.getBoolean()
+               if (init) {
+                       this.currentSwitch = "off"
+               } else {
+                       this.currentSwitch = "on"
+               }
+
                colorTemperatues.add(new ColorTemperature(sendEvent, id, label, displayName, this.level, this.currentSwitch, this.colorTemperature))
        }
 
index 2c53c5653529371ad955017c8283abe584bcfd00..37c294decf2823615df580ceda7af4dfe7c76cb8 100644 (file)
@@ -44,6 +44,8 @@ eventTypeCounterMap =  {'lock': 2,
                                                'thermostatFanMode' : 5,
                                                'thermostatOperatingState' : 5,
                                                'switch' : 2,
+                                               'switch.on' : 1,
+                                               'switch.off' : 1,
                                                'location' : 3,
                                                'mode' : 3,
                                                'acceleration' : 2,
@@ -290,10 +292,8 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "unlock":
-                       event = open("eventSimulator/unlockEvent.groovy", "r")
-                       for line in event:
-                               extractedEvents.write(line)
-                       event.close()
+                        #Don't do anything for this case
+                        counter = counter - 1
                elif eventList[i] == "contact.open":
                        event = open("eventSimulator/contactOpenEvent.groovy", "r")
                        for line in event:
@@ -398,8 +398,6 @@ def ExtractEvents(extractedEvents):
                        event.close()
                elif eventList[i] == "doorState":
                        #Write two events subsequently
-                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n")
-                       extractedEvents.write("\t\t\tif (event == 0) {\n")
                        event = open("eventSimulator/doorOpenEvent.groovy", "r")                        
                        for line in event:
                                extractedEvents.write(line)
@@ -696,6 +694,8 @@ def ExtractEvents(extractedEvents):
                                event = open("eventSimulator/relaySwitchOnEvent.groovy", "r")
                        elif capability == "capability.colorControl":
                                event = open("eventSimulator/colorControlSwitchOnEvent.groovy", "r")
+                       elif capability == "capability.colorTemperature":
+                               event = open("eventSimulator/colorTemperatureSwitchOnEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
@@ -710,6 +710,56 @@ def ExtractEvents(extractedEvents):
                                event = open("eventSimulator/relaySwitchOffEvent.groovy", "r")
                        elif capability == "capability.colorControl":
                                event = open("eventSimulator/colorControlSwitchOffEvent.groovy", "r")
+                       elif capability == "capability.colorTemperature":
+                               event = open("eventSimulator/colorTemperatureSwitchOffEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "switch.on":
+                       #Check which capability
+                       variable = eventVarMap[eventList[i]]
+                       if eventList[i] not in eventVarCounterMap.keys():
+                               eventVarCounterMap[eventList[i]] = 1
+                               eventVarCount = 0
+                       else:
+                               eventVarCount = eventVarCounterMap[eventList[i]]
+                               eventVarCounterMap[eventList[i]] = eventVarCount + 1
+                       capability = capabilityMap[variable[eventVarCount]]
+                       #Write two events subsequently
+                       if capability == "capability.switch":
+                               event = open("eventSimulator/switchOnDefaultEvent.groovy", "r")
+                       elif capability == "capability.switchLevel":
+                               event = open("eventSimulator/switchLevelOnDefaultEvent.groovy", "r")
+                       elif capability == "capability.relaySwitch":
+                               event = open("eventSimulator/relaySwitchOnDefaultEvent.groovy", "r")
+                       elif capability == "capability.colorControl":
+                               event = open("eventSimulator/colorControlSwitchOnDefaultEvent.groovy", "r")
+                       elif capability == "capability.colorTemperature":
+                               event = open("eventSimulator/colorTemperatureSwitchOnDefaultEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "switch.off":
+                       #Check which capability
+                       variable = eventVarMap[eventList[i]]
+                       if eventList[i] not in eventVarCounterMap.keys():
+                               eventVarCounterMap[eventList[i]] = 1
+                               eventVarCount = 0
+                       else:
+                               eventVarCount = eventVarCounterMap[eventList[i]]
+                               eventVarCounterMap[eventList[i]] = eventVarCount + 1
+                       capability = capabilityMap[variable[eventVarCount]]
+                       #Write two events subsequently
+                       if capability == "capability.switch":
+                               event = open("eventSimulator/switchOffDefaultEvent.groovy", "r")
+                       elif capability == "capability.switchLevel":
+                               event = open("eventSimulator/switchLevelOffDefaultEvent.groovy", "r")
+                       elif capability == "capability.relaySwitch":
+                               event = open("eventSimulator/relaySwitchOffDefaultEvent.groovy", "r")
+                       elif capability == "capability.colorControl":
+                               event = open("eventSimulator/colorControlSwitchOffDefaultEvent.groovy", "r")
+                       elif capability == "capability.colorTemperature":
+                               event = open("eventSimulator/colorTemperatureSwitchOffDefaultEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
@@ -928,6 +978,8 @@ def ExtractEvents(extractedEvents):
                                event = open("eventSimulator/musicPlayerLevelEvent.groovy", "r")
                        elif capability == "capability.switchLevel":
                                event = open("eventSimulator/switchLevelEvent.groovy", "r")
+                       elif capability == "capability.colorControl":
+                               event = open("eventSimulator/colorLevelChangeEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
diff --git a/GlobalVariables/GlobalVariablesBothApps.groovy b/GlobalVariables/GlobalVariablesBothApps.groovy
deleted file mode 100644 (file)
index e69de29..0000000
index 8e2db793888869dbbfceb0df17383282fb43caf2..4c02586146cf200d3df9067041407962f613fae4 100644 (file)
--- a/Runner.py
+++ b/Runner.py
@@ -313,22 +313,22 @@ Out.write("}\n")
 Out.write("\n")
 Out.write("@Field def app1\n")
 Out.write("@Field def app2\n")
-Out.write("def initOrder = Verify.getBoolean()\n")
-Out.write("if (initOrder) {\n")
+Out.write("//def initOrder = Verify.getBoolean()\n")
+Out.write("//if (initOrder) {\n")
 Out.write("\tapp1 = new App1(this)\n")
 Out.write("\tapp2 = new App2(this)\n")
-Out.write("} else {\n")
-Out.write("\tapp2 = new App2(this)\n")
-Out.write("\tapp1 = new App1(this)\n")
-Out.write("}\n\n")
-Out.write("def installOrder = Verify.getBoolean()\n")
-Out.write("if (installOrder) {\n")
+Out.write("//} else {\n")
+Out.write("\t//app2 = new App2(this)\n")
+Out.write("\t//app1 = new App1(this)\n")
+Out.write("//}\n\n")
+Out.write("//def installOrder = Verify.getBoolean()\n")
+Out.write("//if (installOrder) {\n")
 Out.write("\tapp1.installed()\n")
 Out.write("\tapp2.installed()\n")
-Out.write("} else {\n")
-Out.write("\tapp2.installed()\n")
-Out.write("\tapp1.installed()\n")
-Out.write("}\n\n")
+Out.write("//} else {\n")
+Out.write("\t//app2.installed()\n")
+Out.write("\t//app1.installed()\n")
+Out.write("//}\n\n")
 for line in eventSimulator:
        Out.write(line)
 Out.close()
index b2abdcbe2ed6366f039f961675aa246a3b42f5e9..59d6bcae99c3ebf95208d97f16c974aabda5538a 100644 (file)
@@ -46,19 +46,19 @@ public class Thermostats{
                this.deviceNumbers = deviceNumbers
                this.thermostats = []
 
-               /*def initTemperature = Verify.getIntFromList(60, 66, 70)
+               def initTemperature = Verify.getIntFromList(60, 66)
                this.temperature = initTemperature
                this.currentTemperature = initTemperature
                
-               def initCoolingSetpoint = Verify.getIntFromList(70, 80, 90)
+               def initCoolingSetpoint = Verify.getIntFromList(70, 80)
                this.currentCoolingSetpoint = initCoolingSetpoint
                this.coolingSetpoint = initCoolingSetpoint
                
-               def initHeatingSetpoint = Verify.getIntFromList(20, 35, 50)
+               def initHeatingSetpoint = Verify.getIntFromList(35, 50)
                this.currentHeatingSetpoint = initHeatingSetpoint
                this.heatingSetpoint = initHeatingSetpoint
                
-               def initThermostatSetpoint = Verify.getIntFromList(50, 60, 70)
+               def initThermostatSetpoint = Verify.getIntFromList(50, 60)
                this.thermostatSetpoint = initThermostatSetpoint
                
                def initFanMode = Verify.getInt(0,4)
@@ -100,7 +100,7 @@ public class Thermostats{
                        this.thermostatMode = "off"
                        this.currentThermostatMode = "off"
                        this.thermostatLatestMode = "off"
-               }*/
+               }
 
                thermostats.add(new Thermostat(sendEvent, id, label, displayName, this.temperature, this.currentCoolingSetpoint, 
                                                this.currentHeatingSetpoint, this.coolingSetpoint, this.thermostatSetpoint, this.heatingSetpoint, this.coolingSetpointRange,
diff --git a/eventSimulator/colorControlSwitchOffDefaultEvent.groovy b/eventSimulator/colorControlSwitchOffDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..0787970
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorControlObject.setValue([name: "switch.off", value: "off", deviceId: "colorControlID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/colorControlSwitchOnDefaultEvent.groovy b/eventSimulator/colorControlSwitchOnDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..9f2c849
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorControlObject.setValue([name: "switch.on", value: "on", deviceId: "colorControlID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/colorTemperatureSwitchOffDefaultEvent.groovy b/eventSimulator/colorTemperatureSwitchOffDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..b78ba5b
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorTemperatureObject.setValue([name: "switch.off", value: "off", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/colorTemperatureSwitchOffEvent.groovy b/eventSimulator/colorTemperatureSwitchOffEvent.groovy
new file mode 100644 (file)
index 0000000..add53cb
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorTemperatureObject.setValue([name: "switch", value: "off", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/colorTemperatureSwitchOnDefaultEvent.groovy b/eventSimulator/colorTemperatureSwitchOnDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..0d2a0d6
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorTemperatureObject.setValue([name: "switch.on", value: "on", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/colorTemperatureSwitchOnEvent.groovy b/eventSimulator/colorTemperatureSwitchOnEvent.groovy
new file mode 100644 (file)
index 0000000..c64a841
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorTemperatureObject.setValue([name: "switch", value: "on", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/relaySwitchOffDefaultEvent.groovy b/eventSimulator/relaySwitchOffDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..4b1f86e
--- /dev/null
@@ -0,0 +1,2 @@
+                       relaySwitchObject.setValue([name: "switch.off", value: "off", deviceId: "relaySwitchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/relaySwitchOnDefaultEvent.groovy b/eventSimulator/relaySwitchOnDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..b8a63e2
--- /dev/null
@@ -0,0 +1,2 @@
+                       relaySwitchObject.setValue([name: "switch.on", value: "on", deviceId: "relaySwitchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
index 1cd0c6cced378a499a91766f44c730aae8a72be4..177164a500f36113cdced5428517032ac73406fd 100644 (file)
@@ -1,2 +1,2 @@
                        switchLevelObject.setValue([name: "level", value: "45"/*A number between 0 to 100*/, deviceId: "switchLevelID0", descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/switchLevelOffDefaultEvent.groovy b/eventSimulator/switchLevelOffDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..1a7d43c
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchLevelObject.setValue([name: "switch.off", value: "off", deviceId: "switchLevelID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/switchLevelOnDefaultEvent.groovy b/eventSimulator/switchLevelOnDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..bd44730
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchLevelObject.setValue([name: "switch.on", value: "on", deviceId: "switchLevelID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/switchOffDefaultEvent.groovy b/eventSimulator/switchOffDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..d10deb1
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchObject.setValue([name: "switch.off", value: "off", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/switchOnDefaultEvent.groovy b/eventSimulator/switchOnDefaultEvent.groovy
new file mode 100644 (file)
index 0000000..a25c74f
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchObject.setValue([name: "switch.on", value: "on", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/run.sh b/run.sh
index d77af37608a2679ba4ecc430cbca06b17162cb3f..019ba29f014528e07fb6ba2bc11ae0caf166a675 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -1,7 +1,9 @@
 #!/bin/bash
 
 # Device conflict
-python ModelCheck.py ../jpf-core/ ../logs/thermostats/ ../smartapps/ appLists/device-interaction/thermostatsAppList appLists/device-interaction/thermostatsAppList2
+python ModelCheck.py ../jpf-core/ ../logs/nonHueLights/ ../smartapps/ appLists/device-interaction/nonHueLightsAppList appLists/device-interaction/nonHueLightsAppList2
+#python ModelCheck.py ../jpf-core/ ../logs/hueLights/ ../smartapps/ appLists/device-interaction/hueLightsAppList
+#python ModelCheck.py ../jpf-core/ ../logs/thermostats/ ../smartapps/ appLists/device-interaction/thermostatsAppList appLists/device-interaction/thermostatsAppList2
 #python ModelCheck.py ../jpf-core/ ../logs/alarms/ ../smartapps/ appLists/device-interaction/alarmsAppList appLists/device-interaction/alarmsAppList2
 #python ModelCheck.py ../jpf-core/ ../logs/locks/ ../smartapps/ appLists/device-interaction/locksAppList appLists/device-interaction/locksAppList2
 #python ModelCheck.py ../jpf-core/ ../logs/musicPlayers/ ../smartapps/ appLists/device-interaction/musicPlayersAppList