Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
authoramiraj <amiraj.95@uci.edu>
Thu, 1 Aug 2019 18:26:19 +0000 (11:26 -0700)
committeramiraj <amiraj.95@uci.edu>
Thu, 1 Aug 2019 18:26:19 +0000 (11:26 -0700)
90 files changed:
AccelerationSensor/AccelerationSensors.groovy
Alarm/Alarms.groovy
Battery/Batteries.groovy
BeaconSensor/BeaconSensors.groovy
CarbonMonoxideDetector/CarbonMonoxideDetectors.groovy
ColorControl/ColorControls.groovy
ContactSensor/ContactSensors.groovy
DoorControl/DoorControls.groovy
EnergyMeter/EnergyMeters.groovy
Extractor/App1/App1.groovy [deleted file]
Extractor/App2/App2.groovy [deleted file]
Extractor/ExtractorScript.py
IlluminanceMeasurement/IlluminanceMeasurements.groovy
ImageCapture/ImageCaptures.groovy
Lock/Lock.groovy
Lock/Locks.groovy
MotionSensor/MotionSensors.groovy
MusicPlayer/MusicPlayer.groovy
MusicPlayer/MusicPlayers.groovy
PowerMeter/PowerMeters.groovy
PresenceSensor/PresenceSensors.groovy
RelativeHumidityMeasurement/RelativeHumidityMeasurements.groovy
RelaySwitch/RelaySwitches.groovy
SleepSensor/SleepSensors.groovy
SmokeDetector/SmokeDetectors.groovy
SpeechSynthesis/SpeechSynthesises.groovy
StepSensor/StepSensors.groovy
Switch/Switches.groovy
SwitchLevel/SwitchLevels.groovy
TemperatureMeasurement/TemperatureMeasurements.groovy
Thermostat/Thermostats.groovy
Valve/Valves.groovy
WaterSensor/WaterSensors.groovy
debug.sh [new file with mode: 0755]
eventSimulator/alarmBothEvent.groovy [new file with mode: 0644]
eventSimulator/alarmOffEvent.groovy [new file with mode: 0644]
eventSimulator/alarmSirenEvent.groovy [new file with mode: 0644]
eventSimulator/alarmStrobeEvent.groovy [new file with mode: 0644]
eventSimulator/batteryBatteryEvent.groovy [new file with mode: 0644]
eventSimulator/batteryChargeEvent.groovy [deleted file]
eventSimulator/contactDefaultClosedEvent.groovy [new file with mode: 0644]
eventSimulator/contactDefaultOpenEvent.groovy [new file with mode: 0644]
eventSimulator/coolingSetpointEvent.groovy [new file with mode: 0644]
eventSimulator/energyMeterEvent.groovy [new file with mode: 0644]
eventSimulator/eventSimulator.groovy
eventSimulator/heatingSetpointEvent.groovy [new file with mode: 0644]
eventSimulator/humidityMeasurementEvent.groovy [new file with mode: 0644]
eventSimulator/illuminanceMeasurementEvent.groovy [new file with mode: 0644]
eventSimulator/lockEvent.groovy [deleted file]
eventSimulator/lockLockedEvent.groovy [new file with mode: 0644]
eventSimulator/lockUnlockedEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerLevelEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerMutedEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerPausedEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerPlayingEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerStoppedEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerTrackDataEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerTrackDescriptionEvent.groovy [new file with mode: 0644]
eventSimulator/musicPlayerUnmutedEvent.groovy [new file with mode: 0644]
eventSimulator/powerMeterEvent.groovy [new file with mode: 0644]
eventSimulator/presencePresencePresentEvent.groovy [new file with mode: 0644]
eventSimulator/relaySwitchOffEvent.groovy [new file with mode: 0644]
eventSimulator/relaySwitchOnEvent.groovy [new file with mode: 0644]
eventSimulator/sleepNotSleepingEvent.groovy [new file with mode: 0644]
eventSimulator/sleepSleepingEvent.groovy [new file with mode: 0644]
eventSimulator/smokeDetectorBatteryEvent.groovy [new file with mode: 0644]
eventSimulator/stepGoalEvent.groovy [new file with mode: 0644]
eventSimulator/stepStepsEvent.groovy [new file with mode: 0644]
eventSimulator/switchLevelEvent.groovy [new file with mode: 0644]
eventSimulator/switchLevelOffEvent.groovy [new file with mode: 0644]
eventSimulator/switchLevelOnEvent.groovy [new file with mode: 0644]
eventSimulator/temperatureEvent.groovy [new file with mode: 0644]
eventSimulator/temperatureMeasurementEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatAutoFanModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatCirculateFanModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatFanCirculateFanModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatFanOnFanModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatOnFanModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatOperatingStateAutoEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatOperatingStateCoolEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatOperatingStateEmergencyHeatEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatOperatingStateHeatEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatOperatingStateOffEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatSetpointEvent.groovy [new file with mode: 0644]
eventSimulator/valveClosedEvent.groovy [new file with mode: 0644]
eventSimulator/valveOpenEvent.groovy [new file with mode: 0644]
eventSimulator/waterDryEvent.groovy [new file with mode: 0644]
eventSimulator/waterWetEvent.groovy [new file with mode: 0644]
main.groovy [deleted file]
run.sh

index d7a9f99275d7892b676b8bbee4a9472064af2051..bf24508f6eaa6d0064a55864d42123d79b1564f2 100644 (file)
@@ -25,14 +25,14 @@ public class AccelerationSensors {
                this.deviceNumbers = deviceNumbers
                this.accelerationSensors = []
 
-               def init = Verify.getBoolean()
+               /*def init = Verify.getBoolean()
                if (init) {
                        this.acceleration = "inactive"
                        this.accelerationLatestValue = "inactive"
                } else {
                        this.acceleration = "active"
                        this.accelerationLatestValue = "active"
-               }
+               }*/
                accelerationSensors.add(new AccelerationSensor(id, label, displayName, this.acceleration, this.accelerationLatestValue))
        }
 
index 3e0842dcab40702150ddbff4c5f10dcbfb55fabb..30c55d9b537ac70d6e9a7a3c3507b6da344914e2 100644 (file)
@@ -25,7 +25,7 @@ public class Alarms {
                this.deviceNumbers = deviceNumbers
                this.alarms = []
 
-               def init = Verify.getBoolean()
+               /*def init = Verify.getBoolean()
                if (init) {
                        this.alarm = "off"
                        this.currentAlarm = "off"
@@ -34,7 +34,7 @@ public class Alarms {
                        this.alarm = "on"
                        this.currentAlarm = "on"
                        this.alarmLatestValue = "on"
-               }
+               }*/
                alarms.add(new Alarm(sendEvent, id, label, displayName, this.alarm, this.currentAlarm, this.alarmLatestValue))
        }
                
index 36a203f2f996d3664062498f5646258c6fa0d130..d7d8f1b348e314ae440019b989d6a4d74ac6e9d6 100644 (file)
@@ -24,8 +24,8 @@ public class Batteries {
                this.deviceNumbers = deviceNumbers
                this.batteries = []
 
-               def init = Verify.getIntFromList(30, 50, 70)
-               this.battery = init
+               //def init = Verify.getIntFromList(30, 50, 70)
+               //this.battery = init
 
                batteries.add(new Battery(id, label, displayName, this.battery))
        }
index a36a4a487f9c536752ac0d9af9ca2de4459007b7..0e9996f89fde3e8e42b785deb42bc0ece00df485 100644 (file)
@@ -24,14 +24,14 @@ public class BeaconSensors {
                this.deviceNumbers = deviceNumbers
                this.beaconSensors = []
 
-               def init = Verify.getBoolean()
+               /*def init = Verify.getBoolean()
                if (init) {
                        this.presence = "not present"
                        this.presenceLatestValue = "not present"
                } else {
                        this.presence = "present"
                        this.presenceLatestValue = "present"
-               }
+               }*/
                beaconSensors.add(new BeaconSensor(id, label, displayName, this.presence, this.presenceLatestValue))
        }
 
index 34495521cd156907f92ef1374f5276be29085ecc..21aa5921e70436446e84caf2b5dca80c093c5f57 100644 (file)
@@ -24,7 +24,7 @@ public class CarbonMonoxideDetectors {
                this.deviceNumbers = deviceNumbers
                this.carbonMonoxideDetectors = []
                
-               def init = Verify.getInt(0,2)
+               /*def init = Verify.getInt(0,2)
                if (init == 0) {
                        this.carbonMonoxide = "clear"
                        this.carbonMonoxideLatestValue = "clear"
@@ -34,7 +34,7 @@ public class CarbonMonoxideDetectors {
                } else {
                        this.carbonMonoxide = "tested"
                        this.carbonMonoxideLatestValue = "tested"               
-               }
+               }*/
                carbonMonoxideDetectors.add(new CarbonMonoxideDetector(id, label, displayName, this.currentCarbonMonoxideValue, this.carbonMonoxideLatestValue))
        }
 
index 74964fe0cf131e6eff15e310f998ed85a6583a9e..5b29f55e54eb51d83ebe1e13a7d8f0545eeff57b 100644 (file)
@@ -27,7 +27,7 @@ public class ColorControls {
                this.deviceNumbers = deviceNumbers
                this.colorControls = []
 
-               def initHue = Verify.getIntFromList(30, 50, 70)
+               /*def initHue = Verify.getIntFromList(30, 50, 70)
                this.hue = initHue
                def initSat = Verify.getIntFromList(40, 50, 60)
                this.saturation = initSat
@@ -38,7 +38,7 @@ public class ColorControls {
                        this.color = "green"
                } else {
                        this.color = "blue"
-               }
+               }*/
 
                colorControls.add(new ColorControl(id, label, displayName, this.color, this.hue, this.saturation, this.level, this.currentSwitch, this.colorTemperature))
        }
index ca55a0914f511eff6c92d04f550dbe0a6eecd02a..c691853aad4c3ea157ff65cc8b90ac4ff290f3f0 100644 (file)
@@ -25,7 +25,7 @@ public class ContactSensors {
                this.deviceNumbers = deviceNumbers
                this.contacts = []
 
-               def initSensor = Verify.getBoolean()
+               /*def initSensor = Verify.getBoolean()
                if (initSensor) {
                        this.contactState = "closed"
                        this.currentContact = "closed"
@@ -41,7 +41,7 @@ public class ContactSensors {
                        this.alarmState = "armed"
                } else {
                        this.alarmState = "not armed"
-               }
+               }*/
                contacts.add(new ContactSensor(id, label, displayName, this.contactState, this.currentContact, this.alarmState, this.latestValue))
        }
 
index d47d7d46898517bb77a59468942618e9faacb4b0..ac6decc59c64343620a1f696cca6c5322a53c8cc 100644 (file)
@@ -24,14 +24,14 @@ public class DoorControls {
                this.deviceNumbers = deviceNumbers
                this.doorControls = []
                
-               def init = Verify.getBoolean()
+               /*def init = Verify.getBoolean()
                if (init) {
                        this.doorState = "closed"
                        this.doorLatestValue = "closed"
                } else {
                        this.doorState = "open"
                        this.doorLatestValue = "open"
-               }
+               }*/
                doorControls.add(new DoorControl(sendEvent, id, label, displayName, this.doorState, this.doorLatestValue))
        }
 
index 296cdaad7b5e820e1838990846eeaaeb8918d308..907ec6680065932c3f48f59e65cbc1e5e660b17f 100644 (file)
@@ -23,8 +23,8 @@ public class EnergyMeters {
                this.deviceNumbers = deviceNumbers
                this.energyMeters = []
 
-               def init = Verify.getIntFromList(30, 50, 70)
-               this.energy = init
+               //def init = Verify.getIntFromList(30, 50, 70)
+               //this.energy = init
 
                energyMeters.add(new EnergyMeter(id, label, displayName, this.energy))
        }
diff --git a/Extractor/App1/App1.groovy b/Extractor/App1/App1.groovy
deleted file mode 100644 (file)
index b41e7a6..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- *     Color Coordinator 
- *  Version 1.1.1 - 11/9/16
- *  By Michael Struck
- *
- *  1.0.0 - Initial release
- *  1.1.0 - Fixed issue where master can be part of slaves. This causes a loop that impacts SmartThings. 
- *  1.1.1 - Fix NPE being thrown for slave/master inputs being empty.
- *
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- *  in compliance with the License. You may obtain a copy of the License at:
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
- *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
- *  for the specific language governing permissions and limitations under the License.
- *
- */
-definition(
-       name: "Color Coordinator",
-       namespace: "MichaelStruck",
-       author: "Michael Struck",
-       description: "Ties multiple colored lights to one specific light's settings",
-       category: "Convenience",
-       iconUrl: "https://raw.githubusercontent.com/MichaelStruck/SmartThings/master/Other-SmartApps/ColorCoordinator/CC.png",
-       iconX2Url: "https://raw.githubusercontent.com/MichaelStruck/SmartThings/master/Other-SmartApps/ColorCoordinator/CC@2x.png"
-)
-
-preferences {
-       page name: "mainPage"
-}
-
-def mainPage() {
-       section("Master Light") {
-               input "master", "capability.colorControl", title: "Colored Light", required: true
-       }
-       section("Lights that follow the master settings") {
-               input "slaves", "capability.colorControl", title: "Colored Lights",  multiple: true, required: true, submitOnChange: true
-       }
-       section([mobileOnly:true], "Options") {
-               input "randomYes", "bool",title: "When Master Turned On, Randomize Color", defaultValue: false
-               href "pageAbout", title: "About ${textAppName()}", description: "Tap to get application version, license and instructions"
-        }
-       
-       dynamicPage(name: "mainPage", title: "", install: true, uninstall: false) {
-       def masterInList = slaves?.id?.find{it==master?.id}
-        if (masterInList) {
-               section ("**WARNING**"){
-                       paragraph "You have included the Master Light in the Slave Group. This will cause a loop in execution. Please remove this device from the Slave Group.", image: "https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/img/caution.png"
-               }
-        }
-        
-       page(name: "pageAbout", title: "About ${textAppName()}", uninstall: true) {
-                       section {
-                               paragraph "${textVersion()}\n${textCopyright()}\n\n${textLicense()}\n"
-                       }
-                       section("Instructions") {
-                               paragraph textHelp()
-                       }
-                       section("Tap button below to remove application"){
-                       }
-               }
-               
-       }
-}
-
-def installed() {   
-       init() 
-}
-
-def updated(){
-       unsubscribe()
-    init()
-}
-
-def init() {
-    subscribe(master, "switch", onOffHandler)
-    subscribe(master, "level", colorHandler)
-    subscribe(master, "hue", colorHandler)
-    subscribe(master, "saturation", colorHandler)
-    subscribe(master, "colorTemperature", tempHandler)
-}
-//-----------------------------------
-def onOffHandler(evt){
-       if (slaves && master) {
-               if (!slaves?.id.find{it==master?.id}){
-               if (master?.currentValue("switch") == "on"){
-                   if (randomYes) getRandomColorMaster()
-                               else slaves?.on()
-               }
-               else {
-                   slaves?.off()  
-               }
-               }
-       }
-}
-
-def colorHandler(evt) {
-       if (slaves && master) {
-               if (!slaves?.id?.find{it==master?.id} && master?.currentValue("switch") == "on"){
-                       log.debug "Changing Slave units H,S,L"
-               def dimLevel = master?.currentValue("level")
-               def hueLevel = master?.currentValue("hue")
-               def saturationLevel = master.currentValue("saturation")
-                       def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
-               slaves?.setColor(newValue)
-               try {
-                       log.debug "Changing Slave color temp"
-                       def tempLevel = master?.currentValue("colorTemperature")
-                       slaves?.setColorTemperature(tempLevel)
-               }
-                       catch (e){
-                       log.debug "Color temp for master --"
-               }
-               }
-       }
-}
-
-def getRandomColorMaster(){
-    def hueLevel = Math.floor(Math.random() *1000)
-    def saturationLevel = Math.floor(Math.random() * 100)
-    def dimLevel = master?.currentValue("level")
-       def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
-    log.debug hueLevel
-    log.debug saturationLevel
-    master.setColor(newValue)
-    slaves?.setColor(newValue)   
-}
-
-def tempHandler(evt){
-       if (slaves && master) {
-           if (!slaves?.id?.find{it==master?.id} && master?.currentValue("switch") == "on"){
-               if (evt.value != "--") {
-                   log.debug "Changing Slave color temp based on Master change"
-                   def tempLevel = master.currentValue("colorTemperature")
-                   slaves?.setColorTemperature(tempLevel)
-               }
-               }
-       }
-}
-
-//Version/Copyright/Information/Help
-
-private def textAppName() {
-       def text = "Color Coordinator"
-}      
-
-private def textVersion() {
-    def text = "Version 1.1.1 (12/13/2016)"
-}
-
-private def textCopyright() {
-    def text = "Copyright Â© 2016 Michael Struck"
-}
-
-private def textLicense() {
-    def text =
-               "Licensed under the Apache License, Version 2.0 (the 'License'); "+
-               "you may not use this file except in compliance with the License. "+
-               "You may obtain a copy of the License at"+
-               "\n\n"+
-               "    http://www.apache.org/licenses/LICENSE-2.0"+
-               "\n\n"+
-               "Unless required by applicable law or agreed to in writing, software "+
-               "distributed under the License is distributed on an 'AS IS' BASIS, "+
-               "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. "+
-               "See the License for the specific language governing permissions and "+
-               "limitations under the License."
-}
-
-private def textHelp() {
-       def text =
-       "This application will allow you to control the settings of multiple colored lights with one control. " +
-        "Simply choose a master control light, and then choose the lights that will follow the settings of the master, "+
-        "including on/off conditions, hue, saturation, level and color temperature. Also includes a random color feature."
-}
-
diff --git a/Extractor/App2/App2.groovy b/Extractor/App2/App2.groovy
deleted file mode 100644 (file)
index 3c4c9d1..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
- *  Medicine Management - Contact Sensor
- *
- *  Copyright 2016 Jim Mangione
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- *  in compliance with the License. You may obtain a copy of the License at:
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
- *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
- *  for the specific language governing permissions and limitations under the License.
- *
- * Logic: 
- * --- Send notification at the medicine reminder time IF draw wasn't alread opened in past 60 minutes
- * --- If draw still isn't open 10 minutes AFTER reminder time, LED will turn RED.
- * --- ----- Once draw IS open, LED will return back to it's original color
- *
- */
-import groovy.time.TimeCategory 
-
-definition(
-    name: "Medicine Management - Contact Sensor",
-    namespace: "MangioneImagery",
-    author: "Jim Mangione",
-    description: "This supports devices with capabilities of ContactSensor and ColorControl (LED). It sends an in-app and ambient light notification if you forget to open the drawer or cabinet where meds are stored. A reminder will be set to a single time per day. If the draw or cabinet isn't opened within 60 minutes of that reminder, an in-app message will be sent. If the draw or cabinet still isn't opened after an additional 10 minutes, then an LED light turns red until the draw or cabinet is opened",
-    category: "Health & Wellness",
-    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
-    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
-    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
-
-
-preferences {
-
-       section("My Medicine Draw/Cabinet"){
-               input "deviceContactSensor", "capability.contactSensor", title: "Opened Sensor" 
-       } 
-
-    section("Remind me to take my medicine at"){
-        input "reminderTime", "time", title: "Time"
-    }
-    
-    // NOTE: Use REAL device - virtual device causes compilation errors
-    section("My LED Light"){
-       input "deviceLight", "capability.colorControl", title: "Smart light"
-    }
-
-}
-
-def installed() {
-       log.debug "Installed with settings: ${settings}"
-       
-       initialize()
-}
-
-def updated() {
-       log.debug "Updated with settings: ${settings}"
-
-       unsubscribe()
-        
-       initialize()
-}
-
-def initialize() {
-
-    // will stop LED notification incase it was set by med reminder
-    subscribe(deviceContactSensor, "contact", contactHandler)
-
-    // how many minutes to look in the past from the reminder time, for an open draw
-    state.minutesToCheckOpenDraw = 60
-    
-    // is true when LED notification is set after exceeding 10 minutes past reminder time
-    state.ledNotificationTriggered = false
-    
-    // Set a timer to run once a day to notify if draw wasn't opened yet
-    schedule(reminderTime, checkOpenDrawInPast)
-   
-}
-
-// Should turn off any LED notification on OPEN state
-def contactHandler(evt){
-       if (evt.value == "open") {
-        // if LED notification triggered, reset it.
-        log.debug "Cabinet opened"
-        if (state.ledNotificationTriggered) {
-            resetLEDNotification()
-        }
-       }
-}
-
-// If the draw was NOT opened within 60 minutes of the timer send notification out.
-def checkOpenDrawInPast(){
-       log.debug "Checking past 60 minutes of activity from $reminderTime"
-    
-    // check activity of sensor for past 60 minutes for any OPENED status
-    def cabinetOpened = isOpened(state.minutesToCheckOpenDraw)
-       log.debug "Cabinet found opened: $cabinetOpened"
-    
-    // if it's opened, then do nothing and assume they took their meds
-    if (!cabinetOpened) {    
-       sendNotification("Hi, please remember to take your meds in the cabinet")
-       
-       // if no open activity, send out notification and set new reminder    
-        def reminderTimePlus10 = new Date(now() + (10 * 60000))
-
-        // needs to be scheduled if draw wasn't already opened
-        runOnce(reminderTimePlus10, checkOpenDrawAfterReminder)
-    }
-}
-
-// If the draw was NOT opened after 10 minutes past reminder, use LED notification
-def checkOpenDrawAfterReminder(){
-       log.debug "Checking additional 10 minutes of activity from $reminderTime"
-    
-    // check activity of sensor for past 10 minutes for any OPENED status
-    def cabinetOpened = isOpened(10)    
-    
-       log.debug "Cabinet found opened: $cabinetOpened"
-        
-    // if no open activity, blink lights
-    if (!cabinetOpened) {
-       log.debug "Set LED to Notification color"
-        setLEDNotification()
-    }
-    
-}
-
-// Helper function for sending out an app notification
-def sendNotification(msg){
-        log.debug "Message Sent: $msg"
-        sendPush(msg)
-}
-
-// Check if the sensor has been opened since the minutes entered
-// Return true if opened found, else false.
-def isOpened(minutes){
-    // query last X minutes of activity log    
-    def previousDateTime = new Date(now() - (minutes * 60000))
-    
-    // capture all events recorded
-    def evts = deviceContactSensor.eventsSince(previousDateTime)   
-    def cabinetOpened = false
-    if (evts.size() > 0) {
-        evts.each{
-            if(it.value == "open") {
-                cabinetOpened = true 
-            }
-        }
-       }
-    
-    return cabinetOpened
-}
-
-// Saves current color and sets the light to RED
-def setLEDNotification(){
-
-       state.ledNotificationTriggered = true
-    
-       // turn light back off when reset is called if it was originally off
-       state.ledState = deviceLight.currentValue("switch")
-
-       // set light to RED and store original color until stopped    
-    state.origColor = deviceLight.currentValue("hue")
-    deviceLight.on()
-    deviceLight.setHue(100)
-    
-    log.debug "LED set to RED. Original color stored: $state.origColor"
-
-}
-
-// Sets the color back to the original saved color
-def resetLEDNotification(){
-
-       state.ledNotificationTriggered = false
-    
-    // return color to original
-    log.debug "Reset LED color to: $state.origColor"
-    if (state.origColor != null) {
-       deviceLight.setHue(state.origColor)
-    }
-    
-    // if the light was turned on just for the notification, turn it back off now
-    if (state.ledState == "off") {
-       deviceLight.off()
-    }
-
-}
index 5bd867aa2ad37cce06b06b4f020de1428144f8ad..c37c2b80b1a929733cce28c8c7f31a1109c8fda7 100644 (file)
@@ -3,7 +3,9 @@ readyToReturn = 0
 ToReturn = ""
 eventList = []
 eventVarMap = {}
+eventVarCounterMap = {}
 capabilityMap = {}
+capabilityList = []
 app1Capabilities = []
 app2Capabilities = []
 app1Subscribe = False
@@ -62,13 +64,14 @@ def ExtractFunctions(F, appName):
                
                #Check input capability
                if (Temp == "input"):
-                       Temp = GetToken(F) #Get '"'
+                       while Temp != "\"":
+                               Temp = GetToken(F)
                        variable = GetToken(F)
                        Temp = GetToken(F) #Get '"'
                        Temp = GetToken(F) #Get ','
-                       Temp = GetToken(F) #Get '"'
-                       Temp = GetToken(F) #Get capability...
-                       capability = Temp
+                       while Temp != "\"":
+                               Temp = GetToken(F)
+                       capability = GetToken(F)
                        capabilityMap[variable] = capability
                
                #Check subscribed events
@@ -84,10 +87,23 @@ def ExtractFunctions(F, appName):
                        while (Temp != "\"" and Temp != "app" and Temp != "location"):
                                Temp = GetToken(F)
                        if Temp == "\"":
-                               Temp = GetToken(F)
-                       if Temp not in eventList:
+                               Temp = GetToken(F)              
+                       if Temp == "app" or Temp == "location":
+                               if Temp not in eventList:
+                                       eventList.append(Temp)
+                       elif Temp not in eventList or (variable in capabilityMap.keys() and capabilityMap[variable] not in capabilityList):
+                               # We do not repeat the same capability twice
+                               capability = capabilityMap[variable]
+                               capabilityList.append(capability)
                                eventList.append(Temp)
-                               eventVarMap[Temp] = variable
+                               if Temp in eventVarMap.keys():
+                                       listOfEvents = eventVarMap[Temp]
+                                       listOfEvents.append(variable)
+                               else:
+                                       eventVarMap[Temp] = [variable]
+                       #print "DEBUG: %s - %s" % (variable, Temp)
+                       #print capabilityMap
+                       #print eventList
 
                #Check and analyze capabilities for physical interaction
                AnalyzeCapabilities(Temp, appName, F)
@@ -98,7 +114,6 @@ def ExtractFunctions(F, appName):
        AnalyzePhysicalInteraction(app1Capabilities, app2Capabilities)
        AnalyzePhysicalInteraction(app2Capabilities, app1Capabilities)
 
-
 def AnalyzeCapabilities(Temp, appName, F):
                        #Illuminance related
        if (Temp == "capability.switch" or
@@ -152,16 +167,26 @@ def ExtractEvents(extractedEvents):
        global eventList
        global eventVarMap
        global capabilityMap
+       global eventVarCounterMap
        extractedEvents.write("while(true) {\n")
        extractedEvents.write("\tdef eventNumber = Verify.getInt(0,%d)\n" % (len(eventList) - 1))
        extractedEvents.write("\tswitch(eventNumber) {\n")
        for i in range(len(eventList)):
                extractedEvents.write("\t\tcase %d:\n" % i)
                if eventList[i] == "lock":
-                       event = open("eventSimulator/lockEvent.groovy", "r")
+                       #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/lockLockedEvent.groovy", "r")                      
                        for line in event:
-                               extractedEvents.write(line)
+                               extractedEvents.write("\t\t" + line)
                        event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/lockUnlockedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
                elif eventList[i] == "unlock":
                        event = open("eventSimulator/unlockEvent.groovy", "r")
                        for line in event:
@@ -201,20 +226,56 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t}\n")
-               elif eventList[i] == "presence":
+               elif eventList[i] == "water":
                        #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/presencePresentEvent.groovy", "r")                 
+                       event = open("eventSimulator/waterDryEvent.groovy", "r")                        
                        for line in event:
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t} else {\n")
-                       event = open("eventSimulator/presenceLeftEvent.groovy", "r")
+                       event = open("eventSimulator/waterWetEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "presence":
+                       #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 three events subsequently
+                       if capability == "capability.presenceSensor":
+                               extractedEvents.write("\t\t\tdef event = Verify.getInt(0,2)\n")
+                       elif capability == "capability.beacon":
+                               extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       if capability == "capability.presenceSensor":
+                               event = open("eventSimulator/presencePresentEvent.groovy", "r")
+                       elif capability == "capability.beacon":
+                               event = open("eventSimulator/beaconPresentEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 1) {\n")
+                       if capability == "capability.presenceSensor":
+                               event = open("eventSimulator/presenceLeftEvent.groovy", "r")
+                       elif capability == "capability.beacon":
+                               event = open("eventSimulator/beaconLeftEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+               elif eventList[i] == "presence.present": #Case for Touched event
+                       event = open("eventSimulator/presencePresencePresentEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
                elif eventList[i] == "doorState":
                        #Write two events subsequently
                        extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n")
@@ -265,8 +326,13 @@ def ExtractEvents(extractedEvents):
                elif eventList[i] == "carbonMonoxide":
                        #Check which capability
                        variable = eventVarMap[eventList[i]]
-                       capability = capabilityMap[variable]
-
+                       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 three events subsequently
                        extractedEvents.write("\t\t\tdef event = Verify.getInt(0,2)\n")
                        extractedEvents.write("\t\t\tif (event == 0) {\n")                      
@@ -295,7 +361,19 @@ def ExtractEvents(extractedEvents):
                        event.close()
                        extractedEvents.write("\t\t\t}\n")
                elif eventList[i] == "battery":
-                       event = open("eventSimulator/batteryChargeEvent.groovy", "r")
+                       #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]]
+                       if capability == "capability.smokeDetector":
+                               event = open("eventSimulator/smokeDetectorBatteryEvent.groovy", "r")
+                       elif capability == "capability.battery":
+                               event = open("eventSimulator/batteryBatteryEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
@@ -328,16 +406,93 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "thermostatFanMode":
+                       #Write five events subsequently
+                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,4)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       event = open("eventSimulator/thermostatAutoFanModeEvent.groovy", "r")                   
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 1) {\n")
+                       event = open("eventSimulator/thermostatFanCirculateFanModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 2) {\n")
+                       event = open("eventSimulator/thermostatCirculateFanModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 3) {\n")
+                       event = open("eventSimulator/thermostatFanOnFanModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/thermostatOnFanModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "thermostatOperatingState":
+                       #Write five events subsequently
+                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,4)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       event = open("eventSimulator/thermostatOperatingStateAutoEvent.groovy", "r")                    
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 1) {\n")
+                       event = open("eventSimulator/thermostatOperatingStateCoolEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 2) {\n")
+                       event = open("eventSimulator/thermostatOperatingStateOffEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 3) {\n")
+                       event = open("eventSimulator/thermostatOperatingStateEmergencyHeatEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/thermostatOperatingStateHeatEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
                elif eventList[i] == "switch":
+                       #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
                        extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n")
                        extractedEvents.write("\t\t\tif (event == 0) {\n")
-                       event = open("eventSimulator/switchOnEvent.groovy", "r")                        
+                       if capability == "capability.switch":
+                               event = open("eventSimulator/switchOnEvent.groovy", "r")
+                       elif capability == "capability.switchLevel":
+                               event = open("eventSimulator/switchLevelOnEvent.groovy", "r")
+                       elif capability == "capability.relaySwitch":
+                               event = open("eventSimulator/relaySwitchOnEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t} else {\n")
-                       event = open("eventSimulator/switchOffEvent.groovy", "r")
+                       if capability == "capability.switch":
+                               event = open("eventSimulator/switchOffEvent.groovy", "r")
+                       elif capability == "capability.switchLevel":
+                               event = open("eventSimulator/switchLevelOffEvent.groovy", "r")
+                       elif capability == "capability.relaySwitch":
+                               event = open("eventSimulator/relaySwitchOffEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write("\t\t" + line)
                        event.close()
@@ -375,36 +530,211 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t}\n")
-               elif eventList[i] == "beacon":
+               elif eventList[i] == "sleeping":
                        #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/beaconPresenceEvent.groovy", "r")                  
+                       event = open("eventSimulator/sleepSleepingEvent.groovy", "r")                   
                        for line in event:
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t} else {\n")
-                       event = open("eventSimulator/beaconLeftEvent.groovy", "r")
+                       event = open("eventSimulator/sleepNotSleepingEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "goal":
+                       event = open("eventSimulator/stepGoalEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "steps":
+                       event = open("eventSimulator/stepStepsEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
                elif eventList[i] == "color":
-                       event = open("eventSimulator/colorChangeEvent.groovy", "r")
+                       event = open("eventSimulator/colorChangedEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "hue":
-                       event = open("eventSimulator/hueChangeEvent.groovy", "r")
+                       event = open("eventSimulator/hueChangedEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "saturation":
-                       event = open("eventSimulator/saturationChangeEvent.groovy", "r")
+                       event = open("eventSimulator/saturationChangedEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
-
+               elif eventList[i] == "energy":
+                       event = open("eventSimulator/energyMeterEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "power":
+                       event = open("eventSimulator/powerMeterEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "illuminance":
+                       event = open("eventSimulator/illuminanceMeasurementEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "humidity":
+                       event = open("eventSimulator/humidityMeasurementEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "alarm":
+                       #Write four events subsequently
+                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,3)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       event = open("eventSimulator/alarmBothEvent.groovy", "r")                       
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 1) {\n")
+                       event = open("eventSimulator/alarmSirenEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 2) {\n")
+                       event = open("eventSimulator/alarmStrobeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/alarmOffEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "contact":
+                       #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
+                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       if capability == "capability.contactSensor":
+                               event = open("eventSimulator/contactDefaultClosedEvent.groovy", "r")
+                       elif capability == "capability.valve":
+                               event = open("eventSimulator/valveClosedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       if capability == "capability.contactSensor":
+                               event = open("eventSimulator/contactDefaultOpenEvent.groovy", "r")
+                       elif capability == "capability.valve":
+                               event = open("eventSimulator/valveOpenEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "status":
+                       #Write three events subsequently
+                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,2)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       event = open("eventSimulator/musicPlayerPlayingEvent.groovy", "r")                      
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else if (event == 1) {\n")
+                       event = open("eventSimulator/musicPlayerStoppedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/musicPlayerPausedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "level":
+                       #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]]
+                       if capability == "capability.musicPlayer":
+                               event = open("eventSimulator/musicPlayerLevelEvent.groovy", "r")
+                       elif capability == "capability.switchLevel":
+                               event = open("eventSimulator/switchLevelEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "trackDescription":
+                       event = open("eventSimulator/musicPlayerTrackDescriptionEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "trackData":
+                       event = open("eventSimulator/musicPlayerTrackDataEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "mute":
+                       #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/musicPlayerUnmutedEvent.groovy", "r")                      
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/musicPlayerMutedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
+               elif eventList[i] == "temperature":
+                       #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]]
+                       if capability == "capability.thermostat":
+                               event = open("eventSimulator/temperatureEvent.groovy", "r")
+                       elif capability == "capability.temperatureMeasurement":
+                               event = open("eventSimulator/temperatureMeasurementEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "heatingSetpoint":
+                       event = open("eventSimulator/heatingSetpointEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "coolingSetpoint":
+                       event = open("eventSimulator/coolingSetpointEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventList[i] == "thermostatSetpoint":
+                       event = open("eventSimulator/thermostatSetpointEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       
                ###TODO: Add more events later
                extractedEvents.write("\t\t\tbreak\n")
        extractedEvents.write("\t}\n")
@@ -418,6 +748,10 @@ def CheckIfOnlyTouchEvents():
                if item != "nfcTouch" and item != "app":
                        onlyTouchEvents = False
        if onlyTouchEvents is True and app1Subscribe is True and app2Subscribe is True:
+               # Write error log file
+               extractError = open("appCreationError.log", "w+")
+               extractError.write("Direct-Direct Interaction detected: we are skipping this pair...\n")
+               extractError.close()
                raise Exception("\n\nDirect-Direct Interaction detected: we are skipping this pair...\n\n")
 
 
index 6d4e38da6bb70f35691069f2413d2a7e8e9b266a..6f7637479a8d54a22796deb1536885d374abcbd0 100644 (file)
@@ -2,6 +2,9 @@
 package IlluminanceMeasurement
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class IlluminanceMeasurements {
        private int deviceNumbers
        private List illuminanceMeasurements
@@ -20,6 +23,9 @@ public class IlluminanceMeasurements {
                this.deviceNumbers = deviceNumbers
                this.illuminanceMeasurements = []
 
+               //def init = Verify.getIntFromList(40000, 50000, 60000)
+               //this.illuminance = init
+
                illuminanceMeasurements.add(new IlluminanceMeasurement(id, label, displayName, this.illuminance))
        }
 
index 691a8515b7310df0f13a9f2617acc5342720588e..3b97a87b0e533f8a600969b1fd59e2e5993afb09 100644 (file)
@@ -23,12 +23,12 @@ public class ImageCaptures {
                this.deviceNumbers = deviceNumbers
                this.imageCaptureSensors = []
 
-               def initAlarm = Verify.getBoolean()
+               /*def initAlarm = Verify.getBoolean()
                if (initAlarm) {
                        this.alarmState = "armed"
                } else {
                        this.alarmState = "not armed"
-               }
+               }*/
                imageCaptureSensors.add(new ImageCapture(id, label, displayName, this.image, this.alarmState))
        }
 
index 0271050af9dd100f9bedc0c430caa4fe3ea8a765..4b84497003b6696d86c74eacdcc6567f32766919 100644 (file)
@@ -28,6 +28,10 @@ public class Lock {
        def lock() {
                if (lockState != "locked") {
                        println("the door with id:$id is locked!")
+<<<<<<< HEAD
+=======
+                       //this.lockLatestValue = this.lockState
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                        this.lockLatestValue = "locked"
                        this.lockState = "locked"
                        this.currentLock = "locked"
@@ -42,6 +46,10 @@ public class Lock {
                if (lockState != "locked") {
                        def task = timers.runAfter(metaData["delay"]) {
                                println("the door with id:$id is locked!")
+<<<<<<< HEAD
+=======
+                               //this.lockLatestValue = this.lockState
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                                this.lockLatestValue = "locked"
                                this.lockState = "locked"
                                this.currentLock = "locked"
@@ -56,6 +64,10 @@ public class Lock {
        def unlock() {
                if (lockState != "unlocked") {
                        println("the door with id:$id is unlocked!")
+<<<<<<< HEAD
+=======
+                       //this.lockLatestValue = this.lockState
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                        this.lockLatestValue = "unlocked"
                        this.lockState = "unlocked"
                        this.currentLock = "unlocked"
@@ -63,8 +75,11 @@ public class Lock {
                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                        sendEvent([name: "lock", value: "unlocked", deviceId: this.id, descriptionText: "",
                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+<<<<<<< HEAD
                        sendEvent([name: "lock.unlocked", value: "unlocked", deviceId: this.id, descriptionText: "",
                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+=======
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                }
        }
 
@@ -72,6 +87,7 @@ public class Lock {
                if (lockState != "unlocked") {
                        def task = timers.runAfter(metaData["delay"]) {
                                println("the door with id:$id is locked!")
+<<<<<<< HEAD
                                this.lockLatestValue = "unlocked"
                                this.lockState = "unlocked"
                                this.currentLock = "unlocked"
@@ -81,6 +97,16 @@ public class Lock {
                                          displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                                sendEvent([name: "lock.unlocked", value: "unlocked", deviceId: this.id, descriptionText: "",
                                          displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])                             
+=======
+                               //this.lockLatestValue = this.lockState
+                               this.lockLatestValue = "locked"
+                               this.lockState = "locked"
+                               this.currentLock = "locked"
+                               sendEvent([name: "unlock", value: "unlocked", deviceId: this.id, descriptionText: "",
+                                         displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+                               sendEvent([name: "lock", value: "unlocked", deviceId: this.id, descriptionText: "",
+                                               displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                        }
                }
        }
index 409058f6fe90b87e9fde1f61733562c1dc9971c9..8b73dc55ac20e393cd311655c2ddd4f03a2859c9 100644 (file)
@@ -39,30 +39,33 @@ public class Locks{
        //By Apps
        def lock() {
                if (lockState != "locked") {
-                       locks[0].lock()
-                       lockLatestValue = lockState
+                       //lockLatestValue = lockState
+                       lockLatestValue = "locked"
                        lockState = "locked"
                        currentLock = "locked"
+                       locks[0].lock()
                }
        }
 
        def lock(LinkedHashMap metaData) {
                if (lockState != "locked") {
                        def task = timers.runAfter(metaData["delay"]) {
-                               locks[0].lock()
-                               lockLatestValue = lockState
+                               //lockLatestValue = lockState
+                               lockLatestValue = "locked"
                                lockState = "locked"
                                currentLock = "locked"
+                               locks[0].lock()
                        }
                }
        }
 
        def unlock() {
                if (lockState != "unlocked") {
-                       locks[0].unlock()
-                       lockLatestValue = lockState
+                       //lockLatestValue = lockState
+                       lockLatestValue = "unlocked"
                        lockState = "unlocked"
                        currentLock = "unlocked"
+                       locks[0].unlock()
                }
        }
 
@@ -70,10 +73,11 @@ public class Locks{
        def unlock(LinkedHashMap metaData) {
                if (lockState != "unlocked") {
                        def task = timers.runAfter(metaData["delay"]) {
-                               locks[0].unlock()
-                               lockLatestValue = lockState
+                               //lockLatestValue = lockState
+                               lockLatestValue = "unlocked"
                                lockState = "unlocked"
                                currentLock = "unlocked"
+                               locks[0].unlock()
                        }
                }
        }
index 340e124e19d4484b124109b78d09defc7551d351..52034d9521b50b2823b4d40be65c9566cb06ea86 100644 (file)
@@ -24,14 +24,14 @@ public class MotionSensors {
                this.deviceNumbers = deviceNumbers
                this.motionSensors = []
 
-               def init = Verify.getBoolean()
+               /*def init = Verify.getBoolean()
                if (init) {
                        this.motion = "inactive"
                        this.motionLatestValue = "inactive"
                } else {
                        this.motion = "active"
                        this.motionLatestValue = "active"
-               }
+               }*/
                motionSensors.add(new MotionSensor(id, label, displayName, this.motion, this.motionLatestValue))
        }
 
index 05faf93a7e6b3b9808a158a06e69fcd35628a1d3..236b52888a1470d1b00260bdd727aff63240a338 100644 (file)
@@ -14,6 +14,7 @@ public class MusicPlayer {
        private int trackNumber
        private String trackData
        private String trackDescription
+       def sendEvent
        
        MusicPlayer(Closure sendEvent, String id, String label, String displayName, int level, String mute, String status, int trackNumber, String trackData, String trackDescription) {
                this.sendEvent = sendEvent
index d423e5ce5f8ccfbb052bf1d1b570ae925806ec67..486feeac79a9f468c945db62ec22eb3081d44322 100644 (file)
@@ -28,21 +28,40 @@ public class MusicPlayers {
                this.deviceNumbers = deviceNumbers
                this.musicPlayers = []
 
-               def initLevel = Verify.getIntFromList(10, 20, 30)
+               /*def initLevel = Verify.getIntFromList(10, 20, 30)
                this.level = initLevel
                def initMute = Verify.getBoolean()
                if (initMute) {
                        this.mute = "unmuted"
                } else {
-                       this.mute = "mute"
+                       this.mute = "muted"
                }
-               def initStatus = Verify.getBoolean()
-               if (initStatus) {
+               def initStatus = Verify.getInt(0,2)
+               if (initStatus == 0) {
                        this.status = "paused"
-               } else {
+               } else if (initStatus == 1) {
                        this.status = "playing"
+               } else {
+                       this.status = "stopped"
                }
+<<<<<<< HEAD
 
+=======
+               def initTrack = Verify.getIntFromList(1, 2, 3)
+               this.trackNumber = initTrack 
+               def initData = Verify.getBoolean()
+               if (initData) {
+                       this.trackData = "someTrack"
+               } else {
+                       this.trackData = "someOtherTrack"
+               }
+               def initDesc = Verify.getBoolean()
+               if (initDesc) {
+                       this.trackDescription = "someDescriptions"
+               } else {
+                       this.trackDescription = "someOtherDescriptions"
+               }*/
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                musicPlayers.add(new MusicPlayer(sendEvent, id, label, displayName, this.level, this.mute, this.status, this.trackNumber, this.trackData, this.trackDescription))
        }
 
index fe400ffc78ee1b9e03fcf2bff5bd86546a81c7f0..836218299f018ae5026547b9e1f34629535c838f 100644 (file)
@@ -2,6 +2,9 @@
 package PowerMeter
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class PowerMeters {
        private int deviceNumbers
        private List powerMeters
@@ -20,6 +23,9 @@ public class PowerMeters {
                this.deviceNumbers = deviceNumbers
                this.powerMeters = []
 
+               //def init = Verify.getIntFromList(30, 50, 70)
+               //this.power = init
+
                powerMeters.add(new PowerMeter(id, label, displayName, this.power))
        }
 
index bec4edb1c3883e802352f2201acfcd18d72c2fcc..ec24f3b0c675ebf8433a0a42b279701a5ae9c2ae 100644 (file)
@@ -23,14 +23,14 @@ public class PresenceSensors {
                this.sendEvent = sendEvent              
                this.deviceNumbers = deviceNumbers
                this.presenceSensors = []
-               def init = Verify.getBoolean()
+               /*def init = Verify.getBoolean()
                if (init) {
                        this.presence = "not present"
                        this.presenceLatestValue = "not present"
                } else {
                        this.presence = "present"
                        this.presenceLatestValue = "present"
-               }
+               }*/
 
                presenceSensors.add(new PresenceSensor(id, label, displayName, this.presence, this.presenceLatestValue))
        }
index da416c1745c1f488985968dd59f2c40ede5db0bd..7bee67627e85557eb190e36908c7c0001747396d 100644 (file)
@@ -2,6 +2,9 @@
 package RelativeHumidityMeasurement
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class RelativeHumidityMeasurements {
        private int deviceNumbers
        private List humidityMeasurements
@@ -20,6 +23,9 @@ public class RelativeHumidityMeasurements {
                this.deviceNumbers = deviceNumbers
                this.humidityMeasurements = []
 
+               //def init = Verify.getIntFromList(30, 50, 70)
+               //this.humidity = init
+
                humidityMeasurements.add(new RelativeHumidityMeasurement(id, label, displayName, this.humidity))
        }
 
index 4a3df4ff4fa4d010cc0bfa9dc4aba915c1b4a313..e7b6e0080bd68b95e0d4a67f3cb214165e9076d0 100644 (file)
@@ -2,6 +2,9 @@
 package RelaySwitch
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class RelaySwitches {
        int deviceNumbers       
        List relaySwitches
@@ -22,6 +25,16 @@ public class RelaySwitches {
                this.deviceNumbers = deviceNumbers
                this.relaySwitches = []
 
+               /*def init = Verify.getBoolean()
+               if (init) {
+                       this.switchState = "off"
+                       this.currentSwitch = "off"
+                       this.switchLatestValue = "off"
+               } else {
+                       this.switchState = "on"
+                       this.currentSwitch = "on"
+                       this.switchLatestValue = "on"
+               }*/
                relaySwitches.add(new RelaySwitch(sendEvent, id, label, displayName, this.switchState, this.currentSwitch, this.switchLatestValue))
        }
 
index 884053cc6dad2ba80430d6d9c06b37194fbc9025..fc26621c1f1d586a8d2632987ef05b75c7b849dc 100644 (file)
@@ -2,6 +2,9 @@
 package SleepSensor
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class SleepSensors {
        private int deviceNumbers
        private List sleepSensors
@@ -19,6 +22,12 @@ public class SleepSensors {
                this.deviceNumbers = deviceNumbers
                this.sleepSensors = []
 
+               /*def init = Verify.getBoolean()
+               if (init) {
+                       this.sleeping = "sleeping"
+               } else {
+                       this.sleeping = "not sleeping"
+               }*/
                sleepSensors.add(new SleepSensor(id, label, displayName, this.sleeping))
        }
 
index d2a9290744b79363fe8fb92b1b6037fd461aaa0a..94c6176d2e79272524931b0b7a8bee1ce1a45736 100644 (file)
@@ -29,12 +29,17 @@ public class SmokeDetectors {
                this.deviceNumbers = deviceNumbers
                this.smokeDetectors = []
 
+<<<<<<< HEAD
                def initBattery = Verify.getIntFromList(30, 50, 70)
                this.battery = initBattery
                this.batteryLatestValue = initBattery
 
                def initSmoke = Verify.getInt(0,2)
                if (initSmoke == 0) {
+=======
+               /*def init = Verify.getInt(0,2)
+               if (init == 0) {
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                        this.currentSmokeValue = "clear"
                        this.smokeLatestValue = "clear"
                } else if (initSmoke == 1) {
@@ -43,6 +48,7 @@ public class SmokeDetectors {
                } else {
                        this.currentSmokeValue = "tested"
                        this.smokeLatestValue = "tested"                
+<<<<<<< HEAD
                }
 
                def initCarbonMonoxide = Verify.getInt(0,2)
@@ -58,6 +64,10 @@ public class SmokeDetectors {
                }
                smokeDetectors.add(new SmokeDetector(id, label, displayName, this.currentSmokeValue, this.smokeLatestValue, this.currentCarbonMonoxideValue,
                                                      this.carbonMonoxideLatestValue, this.battery))
+=======
+               }*/
+               smokeDetectors.add(new SmokeDetector(id, label, displayName, this.currentSmokeValue, this.smokeLatestValue))
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
        }
 
        //By Model Checker
index df2528e0a5133cae58c773769ea3eb75596d04d3..2a125987d1806787f72821694a14bda378ab40fd 100644 (file)
@@ -22,8 +22,8 @@ public class SpeechSynthesises {
                this.deviceNumbers = deviceNumbers
                this.speechSynthesises = []
 
-               def init = Verify.getIntFromList(30, 50, 70)
-               this.level = init
+               //def init = Verify.getIntFromList(30, 50, 70)
+               //this.level = init
 
                speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level))
        }
index ea5fd3ddef41962ec5629151d1dce6cd7f86acdd..021db256317e3006a4bf8b86ecbf2d3f8305604e 100644 (file)
@@ -2,6 +2,9 @@
 package StepSensor
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class StepSensors {
        private int deviceNumbers
        private List stepSensors
@@ -20,6 +23,11 @@ public class StepSensors {
                this.deviceNumbers = deviceNumbers
                this.stepSensors = []
 
+               /*def initGoal = Verify.getIntFromList(1000, 2000, 3000)
+               this.goal = initGoal
+               def initSteps = Verify.getIntFromList(0, 1, 2)
+               this.steps = initSteps*/
+
                stepSensors.add(new StepSensor(id, label, displayName, this.steps, this.goal))
        }
 
index 44a275cd4bebfeb9f702d1c6bfdeea34607937c3..5a2754042f05a585db006b4cf0326bcc38e457af 100644 (file)
@@ -26,7 +26,7 @@ public class Switches {
                this.deviceNumbers = deviceNumbers
                this.switches = []
 
-               def initLevel = Verify.getIntFromList(30, 50, 70)
+               /*def initLevel = Verify.getIntFromList(30, 50, 70)
                this.currentLevel = initLevel
                def init = Verify.getBoolean()
                if (init) {
@@ -37,7 +37,7 @@ public class Switches {
                        this.switchState = "on"
                        this.currentSwitch = "on"
                        this.switchLatestValue = "on"
-               }
+               }*/
 
                switches.add(new Switch(sendEvent, id, label, displayName, this.switchState, this.currentSwitch, this.currentLevel, this.switchLatestValue))
        }
index daa025bb68fa78bcf92a648db386c0b4e31ac42c..591611a6e8394be165e964960d50e86805dfd3ac 100644 (file)
@@ -2,6 +2,9 @@
 package SwitchLevel
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class SwitchLevels {
        int deviceNumbers       
        List switchLevels
@@ -24,6 +27,18 @@ public class SwitchLevels {
                this.deviceNumbers = deviceNumbers
                this.switchLevels = []
 
+               /*def initLevel = Verify.getIntFromList(30, 50, 70)
+               this.level = initLevel
+               def init = Verify.getBoolean()
+               if (init) {
+                       this.switchState = "off"
+                       this.currentSwitch = "off"
+                       this.switchLatestValue = "off"
+               } else {
+                       this.switchState = "on"
+                       this.currentSwitch = "on"
+                       this.switchLatestValue = "on"
+               }*/
                switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, this.level, this.switchState, this.switchLatestValue))
        }
 
index 3f3c634e0cdef34a1fae451d3a3ed9767c8f94b0..20d1f5af01bd44c3dd2259eff76a0a8e044edd86 100644 (file)
@@ -2,6 +2,9 @@
 package TemperatureMeasurement
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class TemperatureMeasurements {
        private int deviceNumbers
        private List temperatureMeasurements
@@ -12,15 +15,19 @@ public class TemperatureMeasurements {
        private String label = "temperatureMeasurement0"
        private String displayName = "temperatureMeasurement0"
        private int temperature = 50
+<<<<<<< HEAD
        private int currentTemperature = 50
 
+=======
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
        
-
-               
        TemperatureMeasurements(Closure sendEvent, int deviceNumbers) {
                this.sendEvent = sendEvent              
                this.deviceNumbers = deviceNumbers
                this.temperatureMeasurements = []
+
+               //def initTemp = Verify.getIntFromList(30, 50, 70)
+               //this.temperature = initTemp
        
                temperatureMeasurements.add(new TemperatureMeasurement(id, label, displayName, this.temperature))
        }
index d8f7adaff9a9e14d69d32fa48f9f30f2b9471d60..80a643b6a5ae0be8fbdaa4961f354e617254fab2 100644 (file)
@@ -46,7 +46,7 @@ public class Thermostats{
                this.deviceNumbers = deviceNumbers
                this.thermostats = []
 
-               def initTemperature = Verify.getIntFromList(60, 66, 70)
+               /*def initTemperature = Verify.getIntFromList(60, 66, 70)
                this.temperature = initTemperature
                this.currentTemperature = initTemperature
                
@@ -99,8 +99,12 @@ public class Thermostats{
                } else {
                        this.thermostatMode = "off"
                        this.currentThermostatMode = "off"
+<<<<<<< HEAD
                        this.thermostatLatestMode = "off"
                }
+=======
+               }*/
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
 
                thermostats.add(new Thermostat(sendEvent, id, label, displayName, this.temperature, this.currentCoolingSetpoint, 
                                                this.currentHeatingSetpoint, this.coolingSetpoint, this.thermostatSetpoint, this.heatingSetpoint, this.coolingSetpointRange,
index e5d0559bcd88b7bbe42b3ec930731448caf67254..0bf0bbce18669e7b7f7489028ff0fe949417bb04 100644 (file)
@@ -2,6 +2,9 @@
 package Valve
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class Valves {
        int deviceNumbers       
        List valves
@@ -21,6 +24,14 @@ public class Valves {
                this.deviceNumbers = deviceNumbers
                this.valves = []
                
+               /*def init = Verify.getBoolean()
+               if (init) {
+                       this.valve = "closed"
+                       this.valveLatestValue = "closed"
+               } else {
+                       this.valve = "open"
+                       this.valveLatestValue = "open"
+               }*/
                valves.add(new Valve(sendEvent, id, label, displayName, this.valve, this.valveLatestValue))
        }
 
index 0e7357bff9a05c1f7558edd5040a16b6c8a3218c..bb8aac0ce22c906faf3cfc593c01765ee6d54a50 100644 (file)
@@ -2,6 +2,9 @@
 package WaterSensor
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class WaterSensors {
        private int deviceNumbers
        private List waterSensors
@@ -19,6 +22,12 @@ public class WaterSensors {
                this.deviceNumbers = deviceNumbers
                this.waterSensors = []
 
+               /*def init = Verify.getBoolean()
+               if (init) {
+                       this.water = "dry"
+               } else {
+                       this.water = "wet"
+               }*/
                waterSensors.add(new WaterSensor(id, label, displayName, this.water))
        }
 
diff --git a/debug.sh b/debug.sh
new file mode 100755 (executable)
index 0000000..5811a27
--- /dev/null
+++ b/debug.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+java -classpath bin/main:lib/jpf.jar:../jpf-core/lib/groovy-2.5.7/:../jpf-core/lib/groovy-dateutil-2.5.7/:../jpf-core/lib/groovy-json-2.5.7/ main
diff --git a/eventSimulator/alarmBothEvent.groovy b/eventSimulator/alarmBothEvent.groovy
new file mode 100644 (file)
index 0000000..03ca061
--- /dev/null
@@ -0,0 +1,2 @@
+                       alarmObject.setValue([name: "alarm", value: "both", deviceId: "alarmID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/alarmOffEvent.groovy b/eventSimulator/alarmOffEvent.groovy
new file mode 100644 (file)
index 0000000..6862af9
--- /dev/null
@@ -0,0 +1,2 @@
+                       alarmObject.setValue([name: "alarm", value: "off", deviceId: "alarmID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/alarmSirenEvent.groovy b/eventSimulator/alarmSirenEvent.groovy
new file mode 100644 (file)
index 0000000..b3efa58
--- /dev/null
@@ -0,0 +1,2 @@
+                       alarmObject.setValue([name: "alarm", value: "siren", deviceId: "alarmID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/alarmStrobeEvent.groovy b/eventSimulator/alarmStrobeEvent.groovy
new file mode 100644 (file)
index 0000000..cdb5fdf
--- /dev/null
@@ -0,0 +1,2 @@
+                       alarmObject.setValue([name: "alarm", value: "strobe", deviceId: "alarmID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/batteryBatteryEvent.groovy b/eventSimulator/batteryBatteryEvent.groovy
new file mode 100644 (file)
index 0000000..ebf4a78
--- /dev/null
@@ -0,0 +1,2 @@
+                       batteryObject.setValue([name: "battery", value: "50"/*number between 0 to 100 as a string*/, deviceId: "batteryID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/batteryChargeEvent.groovy b/eventSimulator/batteryChargeEvent.groovy
deleted file mode 100644 (file)
index 889fe85..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-                       smokeDetectorObject.setValue([name: "battery", value: "5", deviceId: "smokeDetectorID0", descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/contactDefaultClosedEvent.groovy b/eventSimulator/contactDefaultClosedEvent.groovy
new file mode 100644 (file)
index 0000000..0b74952
--- /dev/null
@@ -0,0 +1,2 @@
+                       contactObject.setValue([name: "contact", value: "closed", deviceId: "contactSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/contactDefaultOpenEvent.groovy b/eventSimulator/contactDefaultOpenEvent.groovy
new file mode 100644 (file)
index 0000000..71c81c5
--- /dev/null
@@ -0,0 +1,2 @@
+                       contactObject.setValue([name: "contact", value: "open", deviceId: "contactSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
diff --git a/eventSimulator/coolingSetpointEvent.groovy b/eventSimulator/coolingSetpointEvent.groovy
new file mode 100644 (file)
index 0000000..bfc0869
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "coolingSetpoint", value: "60", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/energyMeterEvent.groovy b/eventSimulator/energyMeterEvent.groovy
new file mode 100644 (file)
index 0000000..597f372
--- /dev/null
@@ -0,0 +1,2 @@
+                       energyMeterObject.setValue([name: "energy", value: "45"/*A number between 0 to 100 as a charge*/, deviceId: "energyMeterID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index 0a047739aa821ee8434030d7fbcf8dc68fe31728..393f9bd1fbbbc769d776ad69c819b1b2aff36409 100644 (file)
@@ -4,10 +4,16 @@ while(true) {
                case 0:
                        def event = Verify.getInt(0,1)
                        if (event == 0) {
+<<<<<<< HEAD
                                        switchObject.setValue([name: "switch", value: "on", deviceId: "switchID0", descriptionText: "",
                                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                        } else {
                                        switchObject.setValue([name: "switch", value: "off", deviceId: "switchID0", descriptionText: "",
+=======
+                                       lockObject.setValue([name: "lock", value: "locked", deviceId: "lockID0", descriptionText: "",
+                                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])                       } else {
+                                       lockObject.setValue([name: "lock", value: "unlocked", deviceId: "lockID0", descriptionText: "",
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                        }
                        break
@@ -22,8 +28,13 @@ while(true) {
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                        break
                case 4:
+<<<<<<< HEAD
                        break
                case 5:
+=======
+                       appObject.setValue([name: "Touched", value: "touched", deviceId: "touchedSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+>>>>>>> a02c9807815a35c0f57241ee6510a3d312499049
                        break
        }
 }
diff --git a/eventSimulator/heatingSetpointEvent.groovy b/eventSimulator/heatingSetpointEvent.groovy
new file mode 100644 (file)
index 0000000..7c2f189
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "heatingSetpoint", value: "40", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/humidityMeasurementEvent.groovy b/eventSimulator/humidityMeasurementEvent.groovy
new file mode 100644 (file)
index 0000000..bcfe170
--- /dev/null
@@ -0,0 +1,2 @@
+                       humidityMeasurementObject.setValue([name: "humidity", value: "70"/*A number between 0 to 100 as a charge*/, deviceId: "humidityMeasurementID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/illuminanceMeasurementEvent.groovy b/eventSimulator/illuminanceMeasurementEvent.groovy
new file mode 100644 (file)
index 0000000..de15937
--- /dev/null
@@ -0,0 +1,2 @@
+                       illuminanceMeasurementObject.setValue([name: "illuminance", value: "70"/*A number between 0 to 100 as a charge*/, deviceId: "illuminanceMeasurementID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/lockEvent.groovy b/eventSimulator/lockEvent.groovy
deleted file mode 100644 (file)
index e208c90..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-                       lockObject.setValue([name: "lock", value: "locked", deviceId: "lockID0", descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/lockLockedEvent.groovy b/eventSimulator/lockLockedEvent.groovy
new file mode 100644 (file)
index 0000000..e208c90
--- /dev/null
@@ -0,0 +1,2 @@
+                       lockObject.setValue([name: "lock", value: "locked", deviceId: "lockID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/lockUnlockedEvent.groovy b/eventSimulator/lockUnlockedEvent.groovy
new file mode 100644 (file)
index 0000000..7ce594b
--- /dev/null
@@ -0,0 +1,2 @@
+                       lockObject.setValue([name: "lock", value: "unlocked", deviceId: "lockID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerLevelEvent.groovy b/eventSimulator/musicPlayerLevelEvent.groovy
new file mode 100644 (file)
index 0000000..8f520cf
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "level", value: "36"/*A number between 0 to 100 as a charge*/, deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerMutedEvent.groovy b/eventSimulator/musicPlayerMutedEvent.groovy
new file mode 100644 (file)
index 0000000..d642662
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "mute", value: "muted", deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerPausedEvent.groovy b/eventSimulator/musicPlayerPausedEvent.groovy
new file mode 100644 (file)
index 0000000..19bcc3d
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "status", value: "paused", deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerPlayingEvent.groovy b/eventSimulator/musicPlayerPlayingEvent.groovy
new file mode 100644 (file)
index 0000000..a703e3a
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "status", value: "playing", deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerStoppedEvent.groovy b/eventSimulator/musicPlayerStoppedEvent.groovy
new file mode 100644 (file)
index 0000000..24f4146
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "status", value: "stopped", deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerTrackDataEvent.groovy b/eventSimulator/musicPlayerTrackDataEvent.groovy
new file mode 100644 (file)
index 0000000..3be6fcb
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "trackData", value: "someTrack", deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerTrackDescriptionEvent.groovy b/eventSimulator/musicPlayerTrackDescriptionEvent.groovy
new file mode 100644 (file)
index 0000000..64fd491
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "trackDescription", value: "someDescriptions", deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/musicPlayerUnmutedEvent.groovy b/eventSimulator/musicPlayerUnmutedEvent.groovy
new file mode 100644 (file)
index 0000000..7c2f924
--- /dev/null
@@ -0,0 +1,2 @@
+                       musicPlayerObject.setValue([name: "mute", value: "umuted", deviceId: "musicPlayerID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/powerMeterEvent.groovy b/eventSimulator/powerMeterEvent.groovy
new file mode 100644 (file)
index 0000000..2fdf6dd
--- /dev/null
@@ -0,0 +1,2 @@
+                       powerMeterObject.setValue([name: "power", value: "70"/*A number between 0 to 100 as a charge*/, deviceId: "powerMeterID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/presencePresencePresentEvent.groovy b/eventSimulator/presencePresencePresentEvent.groovy
new file mode 100644 (file)
index 0000000..33b6892
--- /dev/null
@@ -0,0 +1,2 @@
+                       presenceSensorObject.setValue([name: "presence.present", value: "presence.present", deviceId: "presenceSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"presence":"1","dni":"mobile0"}'])
diff --git a/eventSimulator/relaySwitchOffEvent.groovy b/eventSimulator/relaySwitchOffEvent.groovy
new file mode 100644 (file)
index 0000000..89009c6
--- /dev/null
@@ -0,0 +1,2 @@
+                       relaySwitchObject.setValue([name: "switch", value: "on", deviceId: "relaySwitchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/relaySwitchOnEvent.groovy b/eventSimulator/relaySwitchOnEvent.groovy
new file mode 100644 (file)
index 0000000..96a5bee
--- /dev/null
@@ -0,0 +1,2 @@
+                       relaySwitchObject.setValue([name: "switch", value: "off", deviceId: "relaySwitchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/sleepNotSleepingEvent.groovy b/eventSimulator/sleepNotSleepingEvent.groovy
new file mode 100644 (file)
index 0000000..2abc19a
--- /dev/null
@@ -0,0 +1,2 @@
+                       sleepSensorObject.setValue([name: "sleeping", value: "not sleeping", deviceId: "sleepSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/sleepSleepingEvent.groovy b/eventSimulator/sleepSleepingEvent.groovy
new file mode 100644 (file)
index 0000000..0b77e7d
--- /dev/null
@@ -0,0 +1,2 @@
+                       sleepSensorObject.setValue([name: "sleeping", value: "sleeping", deviceId: "sleepSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/smokeDetectorBatteryEvent.groovy b/eventSimulator/smokeDetectorBatteryEvent.groovy
new file mode 100644 (file)
index 0000000..0bc041c
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "battery", value: "5"/*A number between 0 to 100 as a charge*/, deviceId: "smokeDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/stepGoalEvent.groovy b/eventSimulator/stepGoalEvent.groovy
new file mode 100644 (file)
index 0000000..de1ee84
--- /dev/null
@@ -0,0 +1,2 @@
+                       stepSensorObject.setValue([name: "goal", value: "100"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/stepStepsEvent.groovy b/eventSimulator/stepStepsEvent.groovy
new file mode 100644 (file)
index 0000000..bd9a683
--- /dev/null
@@ -0,0 +1,2 @@
+                       stepSensorObject.setValue([name: "steps", value: "46"/*A number*/, deviceId: "stepSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/switchLevelEvent.groovy b/eventSimulator/switchLevelEvent.groovy
new file mode 100644 (file)
index 0000000..1cd0c6c
--- /dev/null
@@ -0,0 +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"}'])
diff --git a/eventSimulator/switchLevelOffEvent.groovy b/eventSimulator/switchLevelOffEvent.groovy
new file mode 100644 (file)
index 0000000..6f02dcf
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchLevelObject.setValue([name: "switch", value: "off", deviceId: "switchLevelID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/switchLevelOnEvent.groovy b/eventSimulator/switchLevelOnEvent.groovy
new file mode 100644 (file)
index 0000000..2d534c9
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchLevelObject.setValue([name: "switch", value: "on", deviceId: "switchLevelID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/temperatureEvent.groovy b/eventSimulator/temperatureEvent.groovy
new file mode 100644 (file)
index 0000000..d044685
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "temperature", value: "55", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/temperatureMeasurementEvent.groovy b/eventSimulator/temperatureMeasurementEvent.groovy
new file mode 100644 (file)
index 0000000..b8bce76
--- /dev/null
@@ -0,0 +1,2 @@
+                       temperatureMeasurementObject.setValue([name: "temperature", value: "45"/*A number between 0 to 100*/, deviceId: "temperatureMeasurementID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatAutoFanModeEvent.groovy b/eventSimulator/thermostatAutoFanModeEvent.groovy
new file mode 100644 (file)
index 0000000..40d3de8
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatFanMode", value: "auto", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatCirculateFanModeEvent.groovy b/eventSimulator/thermostatCirculateFanModeEvent.groovy
new file mode 100644 (file)
index 0000000..d1aeb18
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatFanMode", value: "circulate", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatFanCirculateFanModeEvent.groovy b/eventSimulator/thermostatFanCirculateFanModeEvent.groovy
new file mode 100644 (file)
index 0000000..2812058
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatFanMode", value: "fanCirculate", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatFanOnFanModeEvent.groovy b/eventSimulator/thermostatFanOnFanModeEvent.groovy
new file mode 100644 (file)
index 0000000..102067e
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatFanMode", value: "fanOn", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatOnFanModeEvent.groovy b/eventSimulator/thermostatOnFanModeEvent.groovy
new file mode 100644 (file)
index 0000000..0a8806b
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatFanMode", value: "on", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatOperatingStateAutoEvent.groovy b/eventSimulator/thermostatOperatingStateAutoEvent.groovy
new file mode 100644 (file)
index 0000000..8ec6866
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatOperatingState", value: "auto", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatOperatingStateCoolEvent.groovy b/eventSimulator/thermostatOperatingStateCoolEvent.groovy
new file mode 100644 (file)
index 0000000..d281296
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatOperatingState", value: "cool", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatOperatingStateEmergencyHeatEvent.groovy b/eventSimulator/thermostatOperatingStateEmergencyHeatEvent.groovy
new file mode 100644 (file)
index 0000000..c2f0499
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatOperatingState", value: "emergencyHeat", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatOperatingStateHeatEvent.groovy b/eventSimulator/thermostatOperatingStateHeatEvent.groovy
new file mode 100644 (file)
index 0000000..a16c9e5
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatOperatingState", value: "heat", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatOperatingStateOffEvent.groovy b/eventSimulator/thermostatOperatingStateOffEvent.groovy
new file mode 100644 (file)
index 0000000..c15f7d7
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatOperatingState", value: "off", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/thermostatSetpointEvent.groovy b/eventSimulator/thermostatSetpointEvent.groovy
new file mode 100644 (file)
index 0000000..b6ced73
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatSetpoint", value: "50", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/valveClosedEvent.groovy b/eventSimulator/valveClosedEvent.groovy
new file mode 100644 (file)
index 0000000..bc0e45f
--- /dev/null
@@ -0,0 +1,2 @@
+                       valveObject.setValue([name: "contact", value: "closed", deviceId: "valveID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/valveOpenEvent.groovy b/eventSimulator/valveOpenEvent.groovy
new file mode 100644 (file)
index 0000000..8cee49b
--- /dev/null
@@ -0,0 +1,2 @@
+                       valveObject.setValue([name: "contact", value: "open", deviceId: "valveID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/waterDryEvent.groovy b/eventSimulator/waterDryEvent.groovy
new file mode 100644 (file)
index 0000000..ff6d624
--- /dev/null
@@ -0,0 +1,2 @@
+                       waterSensorObject.setValue([name: "water", value: "dry", deviceId: "waterSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/waterWetEvent.groovy b/eventSimulator/waterWetEvent.groovy
new file mode 100644 (file)
index 0000000..7a134f2
--- /dev/null
@@ -0,0 +1,2 @@
+                       waterSensorObject.setValue([name: "water", value: "wet", deviceId: "waterSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/main.groovy b/main.groovy
deleted file mode 100644 (file)
index 953f33f..0000000
+++ /dev/null
@@ -1,1107 +0,0 @@
-//Infrastructure for SmartThings Application
-//Importing Libraries
-import groovy.transform.Field
-import groovy.json.JsonSlurper
-
-//Importing Classes
-import ContactSensor.ContactSensor
-import ContactSensor.ContactSensors
-import DoorControl.DoorControl
-import DoorControl.DoorControls
-import Lock.Lock
-import Lock.Locks
-import Thermostat.Thermostat
-import Thermostat.Thermostats
-import Switch.Switch
-import Switch.Switches
-import PresenceSensor.PresenceSensor
-import PresenceSensor.PresenceSensors
-import Logger.Logger
-import Location.LocationVar
-import Location.Phrase
-import appTouch.Touched
-import NfcTouch.NfcTouch
-import AeonKeyFob.AeonKeyFob
-import AeonKeyFob.AeonKeyFobs
-import MusicPlayer.MusicPlayer
-import MusicPlayer.MusicPlayers
-import MotionSensor.MotionSensor
-import MotionSensor.MotionSensors
-import ImageCapture.ImageCapture
-import ImageCapture.ImageCaptures
-import SmokeDetector.SmokeDetector
-import SmokeDetector.SmokeDetectors
-import Alarm.Alarm
-import Alarm.Alarms
-import SpeechSynthesis.SpeechSynthesis
-import SpeechSynthesis.SpeechSynthesises
-import AccelerationSensor.AccelerationSensor
-import AccelerationSensor.AccelerationSensors
-import Battery.Battery
-import Battery.Batteries
-import BeaconSensor.BeaconSensor
-import BeaconSensor.BeaconSensors
-import CarbonMonoxideDetector.CarbonMonoxideDetector
-import CarbonMonoxideDetector.CarbonMonoxideDetectors
-import ColorControl.ColorControl
-import ColorControl.ColorControls
-import EnergyMeter.EnergyMeter
-import EnergyMeter.EnergyMeters
-import IlluminanceMeasurement.IlluminanceMeasurement
-import IlluminanceMeasurement.IlluminanceMeasurements
-import PowerMeter.PowerMeter
-import PowerMeter.PowerMeters
-import RelativeHumidityMeasurement.RelativeHumidityMeasurement
-import RelativeHumidityMeasurement.RelativeHumidityMeasurements
-import RelaySwitch.RelaySwitch
-import RelaySwitch.RelaySwitches
-import SleepSensor.SleepSensor
-import SleepSensor.SleepSensors
-import StepSensor.StepSensor
-import StepSensor.StepSensors
-import SwitchLevel.SwitchLevel
-import SwitchLevel.SwitchLevels
-import TemperatureMeasurement.TemperatureMeasurement
-import TemperatureMeasurement.TemperatureMeasurements
-import WaterSensor.WaterSensor
-import WaterSensor.WaterSensors
-import Valve.Valve
-import Valve.Valves
-import MobilePresence.MobilePresence
-import MobilePresence.MobilePresences
-import Event.Event
-import Timer.SimulatedTimer
-
-//JPF's Verify API
-import gov.nasa.jpf.vm.Verify
-
-//Global eventHandler
-/////////////////////////////////////////////////////////////////////
-def eventHandler(LinkedHashMap eventDataMap) {
-       def value = eventDataMap["value"]
-       def name = eventDataMap["name"]
-       def deviceId = eventDataMap["deviceId"]
-       def descriptionText = eventDataMap["descriptionText"]
-       def displayed = eventDataMap["displayed"]
-       def linkText = eventDataMap["linkText"]
-       def isStateChange = eventDataMap["isStateChange"]
-       def unit = eventDataMap["unit"]
-       def data = eventDataMap["data"]
-
-       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)
-                       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)
-                       if (app1.functionList[i] instanceof String) {
-                               String toCall = app1.functionList[i]
-                               app1."$toCall"(event)
-                       }
-                       else
-                               app1.functionList[i](event)
-               }
-       }
-}
-
-//GlobalVariables for both Apps
-//Create a global variable for send event
-@Field def sendEvent = {eventDataMap -> 
-                       eventHandler(eventDataMap)
-                       }
-//Object for location
-@Field def locationObject = new LocationVar(sendEvent)
-//Object for touch to call function
-@Field def appObject = new Touched(sendEvent, 0)
-//Create a global list for events
-//@Field def evt = []
-//Global Object for class Touch Sensor!
-@Field def touchSensorObject = new NfcTouch(sendEvent, 1)
-//Global Object for class switch!
-@Field def switchObject = new Switches(sendEvent, 1)
-//Global Object for class lock!
-@Field def lockObject = new Locks(sendEvent, 1)
-//Global Object for class door control!
-@Field def doorControlObject = new DoorControls(sendEvent, 1)
-//Global Object for class contact sensor!
-@Field def contactObject = new ContactSensors(sendEvent, 1)
-//Global Object for class presence sensor!
-@Field def presenceSensorObject = new PresenceSensors(sendEvent, 1)
-//Global Object for class thermostat!
-@Field def thermostatObject = new Thermostats(sendEvent, 1)
-//Global Object for class aeon key fob!
-@Field def aeonKeyFobObject = new AeonKeyFobs(sendEvent, 1)
-//Global Object for class music player!
-@Field def musicPlayerObject = new MusicPlayers(sendEvent, 1)
-//Global Object for class motion sensor!
-@Field def motionSensorObject = new MotionSensors(sendEvent, 1)
-//Global Object for class image capture!
-@Field def imageCaptureObject = new ImageCaptures(sendEvent, 1)
-//Global Object for class smoke detector!
-@Field def smokeDetectorObject = new SmokeDetectors(sendEvent, 1)
-//Global Object for class alarm!
-@Field def alarmObject = new Alarms(sendEvent, 1)
-//Global Object for class speech synthesis!
-@Field def speechSynthesisObject = new SpeechSynthesises(sendEvent, 1)
-//Global Object for class acceleration sensor!
-@Field def accelerationSensorObject = new AccelerationSensors(sendEvent, 1)
-//Global Object for class Battery!
-@Field def batteryObject = new Batteries(sendEvent, 1)
-//Global Object for class beacon sensor!
-@Field def beaconSensorObject = new BeaconSensors(sendEvent, 1)
-//Global Object for class carbon monoxide!
-@Field def carbonMonoxideDetectorObject = new CarbonMonoxideDetectors(sendEvent, 1)
-//Global Object for class color control!
-@Field def colorControlObject = new ColorControls(sendEvent, 1)
-//Global Object for class energy meter!
-@Field def energyMeterObject = new EnergyMeters(sendEvent, 1)
-//Global Object for class illuminance measurement!
-@Field def illuminanceMeasurementObject = new IlluminanceMeasurements(sendEvent, 1)
-//Global Object for class power meter!
-@Field def powerMeterObject = new PowerMeters(sendEvent, 1)
-//Global Object for class humidity measurement!
-@Field def humidityMeasurementObject = new RelativeHumidityMeasurements(sendEvent, 1)
-//Global Object for class relay switch!
-@Field def relaySwitchObject = new RelaySwitches(sendEvent, 1)
-//Global Object for class sleep sensor!
-@Field def sleepSensorObject = new SleepSensors(sendEvent, 1)
-//Global Object for class step sensor!
-@Field def stepSensorObject = new StepSensors(sendEvent, 1)
-//Global Object for class switch level!
-@Field def switchLevelObject = new SwitchLevels(sendEvent, 1)
-//Global Object for class temperature measurement!
-@Field def temperatureMeasurementObject = new TemperatureMeasurements(sendEvent, 1)
-//Global Object for class water sensor!
-@Field def waterSensorObject = new WaterSensors(sendEvent, 1)
-//Global Object for class valves!
-@Field def valveObject = new Valves(sendEvent, 1)
-//Global Object for class mobile presence!
-@Field def mobilePresenceObject = new MobilePresences(sendEvent, 1)
-
-//Application #1
-class App1 {
-       def reference
-       def location
-       def app
-
-       //Extracted objects for App1
-       //Object for class color control!
-       def master
-       //Object for class color control!
-       def slaves
-       //Global variable for boolean!
-       def randomYes = "1"
-
-       //Extracted objects for functions for App1
-       //Global Object for functions in subscribe method!
-       def mainPage = this.&mainPage
-       //Global Object for functions in subscribe method!
-       def installed = this.&installed
-       //Global Object for functions in subscribe method!
-       def updated = this.&updated
-       //Global Object for functions in subscribe method!
-       def init = this.&init
-       //Global Object for functions in subscribe method!
-       def onOffHandler = this.&onOffHandler
-       //Global Object for functions in subscribe method!
-       def colorHandler = this.&colorHandler
-       //Global Object for functions in subscribe method!
-       def getRandomColorMaster = this.&getRandomColorMaster
-       //Global Object for functions in subscribe method!
-       def tempHandler = this.&tempHandler
-       //Global Object for functions in subscribe method!
-       def textAppName = this.&textAppName
-       //Global Object for functions in subscribe method!
-       def textVersion = this.&textVersion
-       //Global Object for functions in subscribe method!
-       def textCopyright = this.&textCopyright
-       //Global Object for functions in subscribe method!
-       def textLicense = this.&textLicense
-       //Global Object for functions in subscribe method!
-       def textHelp = this.&textHelp
-
-       App1(Object obj) {
-               reference = obj
-               location = obj.locationObject
-               app = obj.appObject
-               master = obj.colorControlObject
-               slaves = obj.colorControlObject
-               //Global variable for settings!
-               settings = [app: app, master: master, slaves: slaves, randomYes: randomYes, END: "END"]
-       }
-       //Global variables for each app
-       //Global variable for state[mode]
-       def state = [home:[],away:[],night:[]]
-       //Create a global logger object for methods
-       def log = new Logger()
-       //Create a global variable for Functions in Subscribe method
-       def functionList = []
-       //Create a global variable for Objects in Subscribe method
-       def objectList = []
-       //Create a global variable for Events in Subscribe method
-       def eventList = []
-       //Create a global list for function schedulers
-       def timersFuncList = []
-       //Create a global list for timer schedulers
-       def timersList = []
-       //Create a global variable for settings
-       def settings
-       //Zip code
-       def zipCode = 92617
-       //atomicState variable
-       def atomicState = [version: "1.01"]
-
-       //Methods
-       /////////////////////////////////////////////////////////////////////
-       def setLocationMode(String mode) {
-               location.setValue([name: "Location", value: "$mode", deviceId: "locationID0", descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               location.setValue([name: "mode", value: "$mode", deviceId: "locationID0", descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-       }
-       
-       /////////////////////////////////////////////////////////////////////
-       ////subscribe(obj, func)
-       def subscribe(Object obj, Closure FunctionToCall) {
-               if (obj == app) {
-                       objectList.add(obj)
-                       eventList.add("Touched")
-                       functionList.add(FunctionToCall)
-               } else if (obj == location) {
-                       objectList.add(obj)
-                       eventList.add("Location")
-                       functionList.add(FunctionToCall)
-               }
-       }
-       ////subscribe(obj, event, func)
-       def subscribe(Object obj, String event, Closure FunctionToCall) {
-               objectList.add(obj)
-               eventList.add(event)
-               functionList.add(FunctionToCall)
-       }
-       ////subscribe(obj, event, nameOfFunc)
-       def subscribe(Object obj, String event, String nameOfFunction) {
-               objectList.add(obj)
-               eventList.add(event)
-               functionList.add(nameOfFunction)
-       }
-       ////subscribe(obj, event, func, data)
-       def subscribe(Object obj, String event, Closure FunctionToCall, LinkedHashMap metaData) {
-               objectList.add(obj)     
-               eventList.add(event)
-               functionList.add(FunctionToCall)
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////runIn(time, func)
-       def runIn(int seconds, Closure functionToCall) {
-               if (timersFuncList.contains(functionToCall)) {
-                       timersList[timersFuncList.indexOf(functionToCall)].cancel()
-                       def task = timersList[timersFuncList.indexOf(functionToCall)].runAfter(1000*seconds*0, functionToCall)
-               } else {
-                       timersFuncList.add(functionToCall)
-                       timersList.add(new SimulatedTimer())
-                       def task = timersList[timersFuncList.indexOf(functionToCall)].runAfter(1000*seconds*0, functionToCall)
-               }
-       }
-       
-       def runIn(int seconds, Closure functionToCall, LinkedHashMap metaData) {
-               runIn(seconds, functionToCall)
-       }
-       
-       def runIn(int seconds, String nameOfFunction, LinkedHashMap metaData) {
-               runIn(seconds, nameOfFunction)
-       }
-       
-       def runIn(int seconds, String nameOfFunction) {
-               timersFuncList.add(nameOfFunction)
-               timersList.add(new SimulatedTimer())
-               def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(seconds*1000*0) {
-                       "$nameOfFunction"()
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////unschedule(func)
-       def unschedule(Closure functionToUnschedule) {
-               for (int i = 0;i < timersFuncList.size();i++) {
-                       if (timersFuncList[i] == functionToUnschedule) {
-                               if (timersList != null)
-                                       timersList[i].cancel()
-                       }
-               }
-       }
-       
-       def unschedule(String nameOfFunctionToUnschedule) {
-               for (int i = 0;i < timersFuncList.size();i++) {
-                       if (timersFuncList[i] instanceof String) {
-                               if (timersFuncList[i] == nameOfFunctionToUnschedule) {
-                                       if (timersList != null)
-                                               timersList[i].cancel()
-                               }
-                       }
-               }
-       }
-       
-       
-       def unschedule() {
-               for (int i = 0;i < timersFuncList.size();i++) {
-                       if (timersList != null)
-                               timersList[i].cancel()
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////sendNotificationToContacts(text, recipients)
-       def sendNotificationToContacts(String text, String recipients) {
-               for (int i = 0;i < recipients.size();i++) {
-                       for (int j = 0;j < location.contacts.size();j++) {
-                               if (recipients[i] == location.contacts[j]) {
-                                       println("Sending \""+text+"\" to "+location.phoneNumbers[j].toString())
-                               }
-                       }
-               }
-       }
-       
-       def sendNotificationToContacts(String text, String recipients, LinkedHashMap metaData) {
-               for (int i = 0;i < recipients.size();i++) {
-                       for (int j = 0;j < location.contacts.size();j++) {
-                               if (recipients[i] == location.contacts[j]) {
-                                       println("Sending \""+text+"\" to "+location.phoneNumbers[j].toString())
-                               }
-                       }
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////sendSms(phone, text)
-       def sendSms(long phoneNumber, String text) {
-               println("Sending \""+text+"\" to "+phoneNumber.toString())
-       }
-       
-       def sendSMS(long phoneNumber, String text) {
-               println("Sending \""+text+"\" to "+phoneNumber.toString())
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////sendPush(text)
-       def sendPush(String text) {
-               println(text)
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////schedule(time, nameOfFunction as String)
-       def schedule(String time, String nameOfFunction) {
-               def _inputTime = time.split(':')
-               Date date = new Date()  
-               def _currentTime = date.format("HH:mm:ss").split(':')
-       
-               //Convert input time and current time to minutes
-               def inputTime = Integer.parseInt(_inputTime[0])*3600+Integer.parseInt(_inputTime[1])*60
-               def currentTime = Integer.parseInt(_currentTime[0])*3600+Integer.parseInt(_currentTime[1])*60+Integer.parseInt(_currentTime[2])
-               def delay
-       
-               if (inputTime < currentTime) {
-                       delay = 24*60*60-inputTime+currentTime
-               } else {
-                       delay = inputTime-currentTime
-               }
-       
-               timersFuncList.add(nameOfFunction)
-               timersList.add(new SimulatedTimer())
-               def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(delay*1000*0) {
-                       "$nameOfFunction"()
-               }
-       }
-       ////schedule(time, nameOfFunction as Closure)
-       def schedule(String time, Closure nameOfFunction) {
-               def _inputTime = time.split(':')
-               Date date = new Date()  
-               def _currentTime = date.format("HH:mm:ss").split(':')
-       
-               //Convert input time and current time to minutes
-               def inputTime = Integer.parseInt(_inputTime[0])*3600+Integer.parseInt(_inputTime[1])*60
-               def currentTime = Integer.parseInt(_currentTime[0])*3600+Integer.parseInt(_currentTime[1])*60+Integer.parseInt(_currentTime[2])
-               def delay
-       
-               if (inputTime < currentTime) {
-                       delay = 24*60*60-inputTime+currentTime
-               } else {
-                       delay = inputTime-currentTime
-               }
-       
-               if (timersFuncList.contains(nameOfFunction)) {
-                       timersList[timersFuncList.indexOf(nameOfFunction)].cancel()
-                       def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(delay*0, nameOfFunction)
-               } else {
-                       timersFuncList.add(nameOfFunction)
-                       timersList.add(new SimulatedTimer())
-                       def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(delay*0, nameOfFunction)
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       def now() {
-               return System.currentTimeMillis()
-       }
-       /////////////////////////////////////////////////////////////////////
-       def getTemperatureScale() {
-               return 'F' //Celsius for now
-       }
-       
-       /////////////////////////////////////////////////////////////////////
-       def getSunriseAndSunset(LinkedHashMap metaData) {
-               def sunRiseSetInfo = [sunrise:[time:1563800160000],sunset:[time:1563850740000]]
-               return sunRiseSetInfo
-       }
-       /////////////////////////////////////////////////////////////////////
-       def httpPostJson(LinkedHashMap metaData, Closure inputData) {
-               inputData(metaData)
-       }
-       /////////////////////////////////////////////////////////////////////
-       def runEvery15Minutes(Closure inputData) {
-               inputData()
-       }
-       /////////////////////////////////////////////////////////////////////
-       def timeToday(String time, Object timeZone) {
-               def timeOfDay = new Date()
-               def _inputTime = time.split(':')
-               def inputTime = Integer.parseInt(_inputTime[0])*3600+Integer.parseInt(_inputTime[1])*60+1564191100415
-               timeOfDay.time = inputTime
-               return timeOfDay
-       }
-       /////////////////////////////////////////////////////////////////////
-       def sendNotification(String text, LinkedHashMap metaData) {
-               println("Sending \""+text+"\" to "+metaData.phone.toString())
-       }
-       /////////////////////////////////////////////////////////////////////
-       def canSchedule() {
-               return true
-       }
-       /////////////////////////////////////////////////////////////////////
-       def createAccessToken() {
-               state.accessToken = "accessToken"
-               return state.accessToken
-       }
-       /////////////////////////////////////////////////////////////////////
-       def runOnce(Date date, Closure methodToCall) {
-               methodTocall()
-       }
-
-       def mainPage() {
-               section("Master Light") {
-                       input "master", "capability.colorControl", title: "Colored Light", required: true
-               }
-               section("Lights that follow the master settings") {
-                       input "slaves", "capability.colorControl", title: "Colored Lights",  multiple: true, required: true, submitOnChange: true
-               }
-               section([mobileOnly:true], "Options") {
-                       input "randomYes", "bool",title: "When Master Turned On, Randomize Color", defaultValue: false
-                       href "pageAbout", title: "About ${textAppName()}", description: "Tap to get application version, license and instructions"
-               }
-               
-               dynamicPage(name: "mainPage", title: "", install: true, uninstall: false) {
-               def masterInList = slaves?.id?.find{it==master?.id}
-               if (masterInList) {
-                       section ("**WARNING**"){
-                               paragraph "You have included the Master Light in the Slave Group. This will cause a loop in execution. Please remove this device from the Slave Group.", image: "https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/img/caution.png"
-                       }
-               }
-               
-               page(name: "pageAbout", title: "About ${textAppName()}", uninstall: true) {
-                               section {
-                                       paragraph "${textVersion()}\n${textCopyright()}\n\n${textLicense()}\n"
-                               }
-                               section("Instructions") {
-                                       paragraph textHelp()
-                               }
-                               section("Tap button below to remove application"){
-                               }
-                       }
-                       
-               }
-       }
-       
-       def installed() {   
-               init() 
-       }
-       
-       def updated(){
-               unsubscribe()
-           init()
-       }
-       
-       def init() {
-           subscribe(master, "switch", onOffHandler)
-           subscribe(master, "level", colorHandler)
-           subscribe(master, "hue", colorHandler)
-           subscribe(master, "saturation", colorHandler)
-           subscribe(master, "colorTemperature", tempHandler)
-       }
-       //-----------------------------------
-       def onOffHandler(evt){
-               if (slaves && master) {
-                       if (!slaves?.id.find{it==master?.id}){
-                       if (master?.currentValue("switch") == "on"){
-                           if (randomYes) getRandomColorMaster()
-                                       else slaves?.on()
-                       }
-                       else {
-                           slaves?.off()  
-                       }
-                       }
-               }
-       }
-       
-       def colorHandler(evt) {
-               if (slaves && master) {
-                       if (!slaves?.id?.find{it==master?.id} && master?.currentValue("switch") == "on"){
-                               log.debug "Changing Slave units H,S,L"
-                       def dimLevel = master?.currentValue("level")
-                       def hueLevel = master?.currentValue("hue")
-                       def saturationLevel = master.currentValue("saturation")
-                               def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
-                       slaves?.setColor(newValue)
-                       try {
-                               log.debug "Changing Slave color temp"
-                               def tempLevel = master?.currentValue("colorTemperature")
-                               slaves?.setColorTemperature(tempLevel)
-                       }
-                               catch (e){
-                               log.debug "Color temp for master --"
-                       }
-                       }
-               }
-       }
-       
-       def getRandomColorMaster(){
-           def hueLevel = Math.floor(Math.random() *1000)
-           def saturationLevel = Math.floor(Math.random() * 100)
-           def dimLevel = master?.currentValue("level")
-               def newValue = [hue: hueLevel, saturation: saturationLevel, level: dimLevel as Integer]
-           log.debug hueLevel
-           log.debug saturationLevel
-           master.setColor(newValue)
-           slaves?.setColor(newValue)   
-       }
-       
-       def tempHandler(evt){
-               if (slaves && master) {
-                   if (!slaves?.id?.find{it==master?.id} && master?.currentValue("switch") == "on"){
-                       if (evt.value != "--") {
-                           log.debug "Changing Slave color temp based on Master change"
-                           def tempLevel = master.currentValue("colorTemperature")
-                           slaves?.setColorTemperature(tempLevel)
-                       }
-                       }
-               }
-       }
-       
-       //Version/Copyright/Information/Help
-       
-       private def textAppName() {
-               def text = "Color Coordinator"
-       }       
-       
-       private def textVersion() {
-           def text = "Version 1.1.1 (12/13/2016)"
-       }
-       
-       private def textCopyright() {
-           def text = "Copyright Â© 2016 Michael Struck"
-       }
-       
-       private def textLicense() {
-           def text =
-                       "Licensed under the Apache License, Version 2.0 (the 'License'); "+
-                       "you may not use this file except in compliance with the License. "+
-                       "You may obtain a copy of the License at"+
-                       "\n\n"+
-                       "    http://www.apache.org/licenses/LICENSE-2.0"+
-                       "\n\n"+
-                       "Unless required by applicable law or agreed to in writing, software "+
-                       "distributed under the License is distributed on an 'AS IS' BASIS, "+
-                       "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. "+
-                       "See the License for the specific language governing permissions and "+
-                       "limitations under the License."
-       }
-       
-       private def textHelp() {
-               def text =
-               "This application will allow you to control the settings of multiple colored lights with one control. " +
-               "Simply choose a master control light, and then choose the lights that will follow the settings of the master, "+
-               "including on/off conditions, hue, saturation, level and color temperature. Also includes a random color feature."
-       }
-       
-}
-
-
-//Application #2
-class App2 {
-       def reference
-       def location
-       def app
-
-       //Extracted objects for App2
-       //Object for class contactSensor!
-       def deviceContactSensor
-       //Global variable for time!
-       def reminderTime = "15:00"
-       //Object for class color control!
-       def deviceLight
-
-       //Extracted objects for functions for App2
-       //Global Object for functions in subscribe method!
-       def installed = this.&installed
-       //Global Object for functions in subscribe method!
-       def updated = this.&updated
-       //Global Object for functions in subscribe method!
-       def initialize = this.&initialize
-       //Global Object for functions in subscribe method!
-       def contactHandler = this.&contactHandler
-       //Global Object for functions in subscribe method!
-       def checkOpenDrawInPast = this.&checkOpenDrawInPast
-       //Global Object for functions in subscribe method!
-       def checkOpenDrawAfterReminder = this.&checkOpenDrawAfterReminder
-       //Global Object for functions in subscribe method!
-       def sendNotification = this.&sendNotification
-       //Global Object for functions in subscribe method!
-       def isOpened = this.&isOpened
-       //Global Object for functions in subscribe method!
-       def setLEDNotification = this.&setLEDNotification
-       //Global Object for functions in subscribe method!
-       def resetLEDNotification = this.&resetLEDNotification
-
-       App2(Object obj) {
-               reference = obj
-               location = obj.locationObject
-               app = obj.appObject
-               deviceContactSensor = obj.contactObject
-               deviceLight = obj.colorControlObject
-               //Global variable for settings!
-               settings = [app: app, deviceContactSensor: deviceContactSensor, reminderTime: reminderTime, deviceLight: deviceLight, END: "END"]
-       }
-       //Global variables for each app
-       //Global variable for state[mode]
-       def state = [home:[],away:[],night:[]]
-       //Create a global logger object for methods
-       def log = new Logger()
-       //Create a global variable for Functions in Subscribe method
-       def functionList = []
-       //Create a global variable for Objects in Subscribe method
-       def objectList = []
-       //Create a global variable for Events in Subscribe method
-       def eventList = []
-       //Create a global list for function schedulers
-       def timersFuncList = []
-       //Create a global list for timer schedulers
-       def timersList = []
-       //Create a global variable for settings
-       def settings
-       //Zip code
-       def zipCode = 92617
-       //atomicState variable
-       def atomicState = [version: "1.01"]
-
-       //Methods
-       /////////////////////////////////////////////////////////////////////
-       def setLocationMode(String mode) {
-               location.setValue([name: "Location", value: "$mode", deviceId: "locationID0", descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-               location.setValue([name: "mode", value: "$mode", deviceId: "locationID0", descriptionText: "",
-                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-       }
-       
-       /////////////////////////////////////////////////////////////////////
-       ////subscribe(obj, func)
-       def subscribe(Object obj, Closure FunctionToCall) {
-               if (obj == app) {
-                       objectList.add(obj)
-                       eventList.add("Touched")
-                       functionList.add(FunctionToCall)
-               } else if (obj == location) {
-                       objectList.add(obj)
-                       eventList.add("Location")
-                       functionList.add(FunctionToCall)
-               }
-       }
-       ////subscribe(obj, event, func)
-       def subscribe(Object obj, String event, Closure FunctionToCall) {
-               objectList.add(obj)
-               eventList.add(event)
-               functionList.add(FunctionToCall)
-       }
-       ////subscribe(obj, event, nameOfFunc)
-       def subscribe(Object obj, String event, String nameOfFunction) {
-               objectList.add(obj)
-               eventList.add(event)
-               functionList.add(nameOfFunction)
-       }
-       ////subscribe(obj, event, func, data)
-       def subscribe(Object obj, String event, Closure FunctionToCall, LinkedHashMap metaData) {
-               objectList.add(obj)     
-               eventList.add(event)
-               functionList.add(FunctionToCall)
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////runIn(time, func)
-       def runIn(int seconds, Closure functionToCall) {
-               if (timersFuncList.contains(functionToCall)) {
-                       timersList[timersFuncList.indexOf(functionToCall)].cancel()
-                       def task = timersList[timersFuncList.indexOf(functionToCall)].runAfter(1000*seconds*0, functionToCall)
-               } else {
-                       timersFuncList.add(functionToCall)
-                       timersList.add(new SimulatedTimer())
-                       def task = timersList[timersFuncList.indexOf(functionToCall)].runAfter(1000*seconds*0, functionToCall)
-               }
-       }
-       
-       def runIn(int seconds, Closure functionToCall, LinkedHashMap metaData) {
-               runIn(seconds, functionToCall)
-       }
-       
-       def runIn(int seconds, String nameOfFunction, LinkedHashMap metaData) {
-               runIn(seconds, nameOfFunction)
-       }
-       
-       def runIn(int seconds, String nameOfFunction) {
-               timersFuncList.add(nameOfFunction)
-               timersList.add(new SimulatedTimer())
-               def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(seconds*1000*0) {
-                       "$nameOfFunction"()
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////unschedule(func)
-       def unschedule(Closure functionToUnschedule) {
-               for (int i = 0;i < timersFuncList.size();i++) {
-                       if (timersFuncList[i] == functionToUnschedule) {
-                               if (timersList != null)
-                                       timersList[i].cancel()
-                       }
-               }
-       }
-       
-       def unschedule(String nameOfFunctionToUnschedule) {
-               for (int i = 0;i < timersFuncList.size();i++) {
-                       if (timersFuncList[i] instanceof String) {
-                               if (timersFuncList[i] == nameOfFunctionToUnschedule) {
-                                       if (timersList != null)
-                                               timersList[i].cancel()
-                               }
-                       }
-               }
-       }
-       
-       
-       def unschedule() {
-               for (int i = 0;i < timersFuncList.size();i++) {
-                       if (timersList != null)
-                               timersList[i].cancel()
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////sendNotificationToContacts(text, recipients)
-       def sendNotificationToContacts(String text, String recipients) {
-               for (int i = 0;i < recipients.size();i++) {
-                       for (int j = 0;j < location.contacts.size();j++) {
-                               if (recipients[i] == location.contacts[j]) {
-                                       println("Sending \""+text+"\" to "+location.phoneNumbers[j].toString())
-                               }
-                       }
-               }
-       }
-       
-       def sendNotificationToContacts(String text, String recipients, LinkedHashMap metaData) {
-               for (int i = 0;i < recipients.size();i++) {
-                       for (int j = 0;j < location.contacts.size();j++) {
-                               if (recipients[i] == location.contacts[j]) {
-                                       println("Sending \""+text+"\" to "+location.phoneNumbers[j].toString())
-                               }
-                       }
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////sendSms(phone, text)
-       def sendSms(long phoneNumber, String text) {
-               println("Sending \""+text+"\" to "+phoneNumber.toString())
-       }
-       
-       def sendSMS(long phoneNumber, String text) {
-               println("Sending \""+text+"\" to "+phoneNumber.toString())
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////sendPush(text)
-       def sendPush(String text) {
-               println(text)
-       }
-       /////////////////////////////////////////////////////////////////////
-       ////schedule(time, nameOfFunction as String)
-       def schedule(String time, String nameOfFunction) {
-               def _inputTime = time.split(':')
-               Date date = new Date()  
-               def _currentTime = date.format("HH:mm:ss").split(':')
-       
-               //Convert input time and current time to minutes
-               def inputTime = Integer.parseInt(_inputTime[0])*3600+Integer.parseInt(_inputTime[1])*60
-               def currentTime = Integer.parseInt(_currentTime[0])*3600+Integer.parseInt(_currentTime[1])*60+Integer.parseInt(_currentTime[2])
-               def delay
-       
-               if (inputTime < currentTime) {
-                       delay = 24*60*60-inputTime+currentTime
-               } else {
-                       delay = inputTime-currentTime
-               }
-       
-               timersFuncList.add(nameOfFunction)
-               timersList.add(new SimulatedTimer())
-               def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(delay*1000*0) {
-                       "$nameOfFunction"()
-               }
-       }
-       ////schedule(time, nameOfFunction as Closure)
-       def schedule(String time, Closure nameOfFunction) {
-               def _inputTime = time.split(':')
-               Date date = new Date()  
-               def _currentTime = date.format("HH:mm:ss").split(':')
-       
-               //Convert input time and current time to minutes
-               def inputTime = Integer.parseInt(_inputTime[0])*3600+Integer.parseInt(_inputTime[1])*60
-               def currentTime = Integer.parseInt(_currentTime[0])*3600+Integer.parseInt(_currentTime[1])*60+Integer.parseInt(_currentTime[2])
-               def delay
-       
-               if (inputTime < currentTime) {
-                       delay = 24*60*60-inputTime+currentTime
-               } else {
-                       delay = inputTime-currentTime
-               }
-       
-               if (timersFuncList.contains(nameOfFunction)) {
-                       timersList[timersFuncList.indexOf(nameOfFunction)].cancel()
-                       def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(delay*0, nameOfFunction)
-               } else {
-                       timersFuncList.add(nameOfFunction)
-                       timersList.add(new SimulatedTimer())
-                       def task = timersList[timersFuncList.indexOf(nameOfFunction)].runAfter(delay*0, nameOfFunction)
-               }
-       }
-       /////////////////////////////////////////////////////////////////////
-       def now() {
-               return System.currentTimeMillis()
-       }
-       /////////////////////////////////////////////////////////////////////
-       def getTemperatureScale() {
-               return 'F' //Celsius for now
-       }
-       
-       /////////////////////////////////////////////////////////////////////
-       def getSunriseAndSunset(LinkedHashMap metaData) {
-               def sunRiseSetInfo = [sunrise:[time:1563800160000],sunset:[time:1563850740000]]
-               return sunRiseSetInfo
-       }
-       /////////////////////////////////////////////////////////////////////
-       def httpPostJson(LinkedHashMap metaData, Closure inputData) {
-               inputData(metaData)
-       }
-       /////////////////////////////////////////////////////////////////////
-       def runEvery15Minutes(Closure inputData) {
-               inputData()
-       }
-       /////////////////////////////////////////////////////////////////////
-       def timeToday(String time, Object timeZone) {
-               def timeOfDay = new Date()
-               def _inputTime = time.split(':')
-               def inputTime = Integer.parseInt(_inputTime[0])*3600+Integer.parseInt(_inputTime[1])*60+1564191100415
-               timeOfDay.time = inputTime
-               return timeOfDay
-       }
-       /////////////////////////////////////////////////////////////////////
-       def sendNotification(String text, LinkedHashMap metaData) {
-               println("Sending \""+text+"\" to "+metaData.phone.toString())
-       }
-       /////////////////////////////////////////////////////////////////////
-       def canSchedule() {
-               return true
-       }
-       /////////////////////////////////////////////////////////////////////
-       def createAccessToken() {
-               state.accessToken = "accessToken"
-               return state.accessToken
-       }
-       /////////////////////////////////////////////////////////////////////
-       def runOnce(Date date, Closure methodToCall) {
-               methodTocall()
-       }
-
-       def installed() {
-               log.debug "Installed with settings: ${settings}"
-               
-               initialize()
-       }
-       
-       def updated() {
-               log.debug "Updated with settings: ${settings}"
-       
-               unsubscribe()
-               
-               initialize()
-       }
-       
-       def initialize() {
-       
-           // will stop LED notification incase it was set by med reminder
-           subscribe(deviceContactSensor, "contact", contactHandler)
-       
-           // how many minutes to look in the past from the reminder time, for an open draw
-           state.minutesToCheckOpenDraw = 60
-           
-           // is true when LED notification is set after exceeding 10 minutes past reminder time
-           state.ledNotificationTriggered = false
-           
-           // Set a timer to run once a day to notify if draw wasn't opened yet
-           schedule(reminderTime, checkOpenDrawInPast)
-          
-       }
-       
-       // Should turn off any LED notification on OPEN state
-       def contactHandler(evt){
-               if (evt.value == "open") {
-               // if LED notification triggered, reset it.
-               log.debug "Cabinet opened"
-               if (state.ledNotificationTriggered) {
-                   resetLEDNotification()
-               }
-               }
-       }
-       
-       // If the draw was NOT opened within 60 minutes of the timer send notification out.
-       def checkOpenDrawInPast(){
-               log.debug "Checking past 60 minutes of activity from $reminderTime"
-           
-           // check activity of sensor for past 60 minutes for any OPENED status
-           def cabinetOpened = isOpened(state.minutesToCheckOpenDraw)
-               log.debug "Cabinet found opened: $cabinetOpened"
-           
-           // if it's opened, then do nothing and assume they took their meds
-           if (!cabinetOpened) {    
-               sendNotification("Hi, please remember to take your meds in the cabinet")
-              
-              // if no open activity, send out notification and set new reminder    
-               def reminderTimePlus10 = new Date(now() + (10 * 60000))
-       
-               // needs to be scheduled if draw wasn't already opened
-               runOnce(reminderTimePlus10, checkOpenDrawAfterReminder)
-           }
-       }
-       
-       // If the draw was NOT opened after 10 minutes past reminder, use LED notification
-       def checkOpenDrawAfterReminder(){
-               log.debug "Checking additional 10 minutes of activity from $reminderTime"
-           
-           // check activity of sensor for past 10 minutes for any OPENED status
-           def cabinetOpened = isOpened(10)    
-           
-               log.debug "Cabinet found opened: $cabinetOpened"
-               
-           // if no open activity, blink lights
-           if (!cabinetOpened) {
-               log.debug "Set LED to Notification color"
-               setLEDNotification()
-           }
-           
-       }
-       
-       // Helper function for sending out an app notification
-       def sendNotification(msg){
-               log.debug "Message Sent: $msg"
-               sendPush(msg)
-       }
-       
-       // Check if the sensor has been opened since the minutes entered
-       // Return true if opened found, else false.
-       def isOpened(minutes){
-           // query last X minutes of activity log    
-           def previousDateTime = new Date(now() - (minutes * 60000))
-           
-           // capture all events recorded
-           def evts = deviceContactSensor.eventsSince(previousDateTime)   
-           def cabinetOpened = false
-           if (evts.size() > 0) {
-               evts.each{
-                   if(it.value == "open") {
-                       cabinetOpened = true 
-                   }
-               }
-               }
-           
-           return cabinetOpened
-       }
-       
-       // Saves current color and sets the light to RED
-       def setLEDNotification(){
-       
-               state.ledNotificationTriggered = true
-           
-               // turn light back off when reset is called if it was originally off
-               state.ledState = deviceLight.currentValue("switch")
-       
-               // set light to RED and store original color until stopped    
-           state.origColor = deviceLight.currentValue("hue")
-           deviceLight.on()
-           deviceLight.setHue(100)
-           
-           log.debug "LED set to RED. Original color stored: $state.origColor"
-       
-       }
-       
-       // Sets the color back to the original saved color
-       def resetLEDNotification(){
-       
-               state.ledNotificationTriggered = false
-           
-           // return color to original
-           log.debug "Reset LED color to: $state.origColor"
-           if (state.origColor != null) {
-               deviceLight.setHue(state.origColor)
-           }
-           
-           // if the light was turned on just for the notification, turn it back off now
-           if (state.ledState == "off") {
-               deviceLight.off()
-           }
-       
-       }
-}
-
-@Field def app1
-@Field def app2
-
-app1 = new App1(this)
-app2 = new App2(this)
-
-app1.installed()
-app2.installed()
-
-contactObject.setValue([name: "contact", value: "open", deviceId: "contactSensorID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-contactObject.setValue([name: "contact", value: "closed", deviceId: "contactSensorID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-contactObject.setValue([name: "contact", value: "open", deviceId: "contactSensorID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-
-colorControlObject.setValue([name: "hue", value: "32", deviceId: "colorControlID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-colorControlObject.setValue([name: "saturation", value: "32", deviceId: "colorControlID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-colorControlObject.setValue([name: "level", value: "32", deviceId: "colorControlID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-colorControlObject.setValue([name: "switch", value: "on", deviceId: "colorControlID0", descriptionText: "",
-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", value: "on", deviceId: "colorControlID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
-colorControlObject.setValue([name: "colorTemperature", value: "32", deviceId: "colorControlID0", descriptionText: "",
-displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/run.sh b/run.sh
index 6c955cea6e3c8df18fec04372294c46ec3951e92..c2c9cfa0ad7deab40ea69bddf807bf880066c5e2 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -1,7 +1,11 @@
 #!/bin/bash
 
 # Device conflict
-python ModelCheck.py ../jpf-core/ ../logs/ ../smartapps/ appLists/device-interaction/locksAppList
+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
+#python ModelCheck.py ../jpf-core/ ../logs/relaySwitch/ ../smartapps/ appLists/device-interaction/relaySwitchesAppList
+#python ModelCheck.py ../jpf-core/ ../logs/cameras/ ../smartapps/ appLists/device-interaction/camerasAppList
 
 # Physical conflict
 #python ModelCheck.py ../jpf-core/ ../logs/ ../smartapps/ appLists/physical-interaction/soundsensorAppList appLists/physical-interaction/soundAppList