Complex scheduling for smartapps


(Justin Léger) #1

Hello fellow members of the ST community. I am starting to build smartapps. I wanted to adapt the Gentle Wake smartapp template to feature advance scheduling. I am pretty new with ST. Prior to using ST, I was using Wemo switches combines with the power of IFTTT. I am a college student and what I liked the most was to setup my lighting so that my lights would come on when my iphone alarm rang. Since my scheduling varies, I do not wake up a the same time everyday. I was disappointed to see that ST could not accommodate to that type of scheduling (if it does please tell me how :smiley: ).

def schedulingPage() {
	dynamicPage(name: "schedulingPage", title: "Rules For Automatically Dimming Your Lights ${direction}") {

		section {
			input(name: "days", type: "enum", title: "Allow Automatic Dimming On These Days", description: "Every day", required: false, multiple: true, options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"])
		}

		section {
			input(name: "modeStart", title: "Start when entering this mode", type: "mode", required: false, mutliple: false, refreshAfterSelection: true)
			if (modeStart || androidClient()) {
				input(name: "modeStop", title: "Stop when leaving '${modeStart}' mode", type: "bool", required: false)
			}
		}

		section {
			input(name: "startTime", type: "time", title: "Start Dimming At This Time", description: null, required: false)
		}

	}
}

`
Sorry for the messed up code snippet. I am new to this type of forum. I tried to look at the code and find a way to modify it in order to select a specific time for each day and trigger the smartapp using the settings of the current day. For each day I would input the time and if the user leaves it blank, the smartapp wouldn’t trigger that day. I don’t think this is too difficult to make, but I don’t know how I can pass those parameters to the wake up method.

I need your help guys…