}
}
+ def setLevel(long level) {
+ if (level != this.level) {
+ this.currentLevel = level
+ this.level = level
+ println("The level of the light is changed to $level!")
+ sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ }
+ }
+
def setColorTemperature(int colorTemperature) {
if (colorTemperature != this.colorTemperature) {
this.colorTemperature = colorTemperature
}
}
+ def setLevel(long level) {
+ if (level != this.level) {
+ this.currentLevel = level
+ this.level = level
+ colorControls[0].setLevel(level)
+ }
+ }
+
def setColorTemperature(int colorTemperature) {
if (colorTemperature != this.colorTemperature) {
this.colorTemperature = colorTemperature
}
}
+ def setColorTemperature(long colorTemperature) {
+ if (colorTemperature != this.colorTemperature) {
+ this.colorTemperature = colorTemperature
+ colorControls[0].setColorTemperature(colorTemperature)
+ }
+ }
+
def on() {
if (this.currentSwitch != "on") {
this.currentSwitch = "on"
@Field File extractedObjectsConstructorApp2 = new File("Extractor/App2/extractedObjectsConstructorApp2.groovy")
//Set this to true for global-state variable conflict
-@Field assignDifferentModes = false
+@Field assignDifferentModes = true
@Field chooseMode = 0
//Empty the files
if (App == "App1") {
extractedObjectsApp2.write("")
extractedObjectsConstructorApp2.write("")
if (assignDifferentModes)
- chooseMode = 1
+ chooseMode = 2
}
Temp == "capability.switchLevel" or
Temp == "capability.illuminanceMeasurement" or
Temp == "capability.colorControl" or
+ Temp == "capability.colorTemperature" or
#Motion related
Temp == "capability.motionSensor" or
Temp == "capability.accelerationSensor" or
def AnalyzePhysicalInteraction(app1Capab, app2Capab):
#Light
if ("capability.illuminanceMeasurement" in app1Capab) and ("capability.switch" in app2Capab or
- "capability.switchLevel" in app2Capab or "capability.colorControl" in app2Capab):
+ "capability.switchLevel" in app2Capab or "capability.colorControl" or "capability.colorTemperature" in app2Capab):
print ("\nWARNING: Potential PHYSICAL CONFLICT (light) detected between App1 and App2!\n")
#Motion
# TODO: Technically this is not entirely precise since we need to be able to detect that the other app creates motion
}*/
"$nameOfFunction"()
}
+/////////////////////////////////////////////////////////////////////
+////schedule(Date, nameOfFunction as String)
+def schedule(Date date, String nameOfFunction) {
+ "$nameOfFunction"()
+}
////schedule(time, nameOfFunction as Closure)
def schedule(String time, Closure nameOfFunction) {
/*def _inputTime = time.split(':')
package MusicPlayer
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
public class MusicPlayer {
private String id
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
+ def statesSince(String info, Date dateObj) {
+ statesSince()
+ }
+ def statesSince() {
+ eventsSince()
+ }
+ def eventsSince(Date dateObj) {
+ eventsSince()
+ }
+
+ def eventsSince() {
+ def evtActive = [[name: "status", value: "on", deviceId: "musicPlayerID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+ def evtInactive = [[name: "status", value: "off", deviceId: "musicPlayerID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+ def init = Verify.getInt(0,4)
+ def evtToSend = []
+ if (init == 0) {//return empty set
+ return evtToSend
+ } else if (init == 1) {//send one active event
+ evtActive.each{
+ evtToSend.add(it)
+ }
+ return evtToSend
+ } else if (init == 2) {//send two active events
+ evtActive.each{
+ evtToSend.add(it)
+ }
+ evtActive.each{
+ evtToSend.add(it)
+ }
+ return evtToSend
+ } else if (init == 3) {//send one inactive event
+ evtInactive.each{
+ evtToSend.add(it)
+ }
+ return evtToSend
+ } else if (init == 4) {//send two inactive events
+ evtInactive.each{
+ evtToSend.add(it)
+ }
+ evtInactive.each{
+ evtToSend.add(it)
+ }
+ return evtToSend
+ }
+ }
def playText(LinkedHashMap metaData) {
playText()
}
this.level = level
}
}
+ def playSoundAndTrack(String trackData, int duration, int trackNumber, int level) {
+ playTrackAndResume(trackData, duration)
+ if (level != this.level) {
+ this.level = level
+ }
+ if (trackNumber!= this.trackNumber) {
+ this.trackNumber = trackNumber
+ }
+ }
def playTrackAtVolume(String trackData, int level) {
playTrack(trackData)
if (level != this.level) {
musicPlayers[0].stop()
}
}
+ def statesSince(String info, Date dateObj, LinkedHashMap map) {
+ return musicPlayers[0].statesSince()
+ }
def playText(LinkedHashMap metaData) {
playText()
}
beacon-control.groovy
-bon-voyage.groovy
-bose-soundtouch-control.groovy
-bright-when-dark-and-or-bright-after-sunset.groovy
-button-controller.groovy
-forgiving-security.groovy
-gentle-wake-up.groovy
-good-night.groovy
-good-night-house.groovy
-greetings-earthling.groovy
-hello-home-phrase-director.groovy
-hue-mood-lighting.groovy
-keep-me-cozy.groovy
-lighting-director.groovy
-make-it-so.groovy
-nobody-home.groovy
-notify-me-with-hue.groovy
-rise-and-shine.groovy
-routine-director.groovy
-scheduled-mode-change.groovy
-simple-sync-trigger.groovy
-single-button-controller.groovy
-smart-alarm.groovy
-smart-home-ventilation.groovy
-smart-security.groovy
-sonos-music-modes.groovy
-speaker-control.groovy
-speaker-mood-music.groovy
-speaker-notify-with-sound.groovy
-speaker-weather-forecast.groovy
-sunrise-sunset.groovy
-switch-activates-home-phrase-or-mode.groovy
-switch-changes-mode.groovy
-thermostat-mode-director.groovy
-vacation-lighting-director.groovy
-working-from-home.groovy
-button-controller-for-hlgs.groovy
-circadian-daylight.groovy
-ecobeeChangeMode.groovy
-ecobeeGenerateWeeklyStats.groovy
-ecobeeManageClimate.groovy
-ecobeeResumeProg.groovy
-MonitorAndSetEcobeeHumidity.groovy
-SmartPresence.groovy
-Switches.groovy
-WorkingFromHome.groovy
+#bon-voyage.groovy
+#bose-soundtouch-control.groovy
+#bright-when-dark-and-or-bright-after-sunset.groovy
+#forgiving-security.groovy
+#gentle-wake-up.groovy
+#good-night.groovy
+#good-night-house.groovy
+#greetings-earthling.groovy
+#hello-home-phrase-director.groovy
+#hue-mood-lighting.groovy
+#keep-me-cozy.groovy
+#lighting-director.groovy
+#make-it-so.groovy
+#nobody-home.groovy
+#notify-me-with-hue.groovy
+#rise-and-shine.groovy
+#routine-director.groovy
+#scheduled-mode-change.groovy
+#simple-sync-trigger.groovy
+#single-button-controller.groovy
+#smart-alarm.groovy
+#smart-home-ventilation.groovy
+#smart-security.groovy
+#sonos-music-modes.groovy
+#speaker-control.groovy
+#speaker-mood-music.groovy
+#speaker-notify-with-sound.groovy
+#speaker-weather-forecast.groovy
+#sunrise-sunset.groovy
+#switch-activates-home-phrase-or-mode.groovy
+#switch-changes-mode.groovy
+#thermostat-mode-director.groovy
+#vacation-lighting-director.groovy
+#working-from-home.groovy
+#circadian-daylight.groovy
+#SmartPresence.groovy
+#Switches.groovy
+#WorkingFromHome.groovy
### The following is a very buggy app
###talking-alarm-clock.groovy
+### The following apps are the same as single-button-controller
+### We only use one button so it does not matter
+###button-controller.groovy
+###button-controller-for-hlgs.groovy
+### The following are third party apps
+###ecobeeChangeMode.groovy
+###ecobeeGenerateWeeklyStats.groovy
+###ecobeeManageClimate.groovy
+###ecobeeResumeProg.groovy
+###MonitorAndSetEcobeeHumidity.groovy
\ No newline at end of file