From: Rahmadi Trimananda Date: Fri, 9 Aug 2019 21:03:56 +0000 (-0700) Subject: Update simple-sync-trigger.groovy X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartapps.git;a=commitdiff_plain;h=60526c608145571e7e260c78858617c34a922196 Update simple-sync-trigger.groovy --- diff --git a/official/simple-sync-trigger.groovy b/official/simple-sync-trigger.groovy index b6709e1..e8b64f4 100755 --- a/official/simple-sync-trigger.groovy +++ b/official/simple-sync-trigger.groovy @@ -18,7 +18,7 @@ definition( preferences { page(name: "agentSelection", title: "Select your Simple Sync") - page(name: "refreshActivities", title: "Updating list of Simple Sync activities") + //page(name: "refreshActivities", title: "Updating list of Simple Sync activities") page(name: "control", title: "Run a Simple Control activity when something happens") page(name: "timeIntervalInput", title: "Only during a certain time", install: true, uninstall: true) { section { @@ -30,10 +30,10 @@ preferences { def agentSelection() { - if (agent) - { - state.refreshCount = 0 - } + //if (agent) + //{ + // state.refreshCount = 0 + //} dynamicPage(name: "agentSelection", title: "Select your Simple Sync", nextPage: "control", install: false, uninstall: true) { section { @@ -57,28 +57,29 @@ def agentSelection() def control() { - def activities = agent.latestValue('activities') + //def activities = agent.latestValue('activities') + //def activities - if (!activities || !state.refreshCount) - { - int refreshCount = !state.refreshCount ? 0 : state.refreshCount as int - state.refreshCount = refreshCount + 1 - def refreshInterval = refreshCount == 0 ? 2 : 4 + //if (!activities || !state.refreshCount) + //{ + // int refreshCount = !state.refreshCount ? 0 : state.refreshCount as int + // state.refreshCount = refreshCount + 1 + // def refreshInterval = refreshCount == 0 ? 2 : 4 // Request activities every 5th attempt - if((refreshCount % 5) == 0) - { - agent.getAllActivities() - } + // if((refreshCount % 5) == 0) + // { + //agent.getAllActivities() + // } - dynamicPage(name: "control", title: "Updating list of Simple Control activities", nextPage: "", refreshInterval: refreshInterval, install: false, uninstall: true) { - section("") { - paragraph "Retrieving activities from Simple Sync" - } - } - } - else - { + // dynamicPage(name: "control", title: "Updating list of Simple Control activities", nextPage: "", refreshInterval: refreshInterval, install: false, uninstall: true) { + // section("") { + // paragraph "Retrieving activities from Simple Sync" + // } + // } + //} + //else + //{ dynamicPage(name: "control", title: "Run a Simple Control activity when something happens", nextPage: "timeIntervalInput", install: false, uninstall: true) { def anythingSet = anythingSet() if (anythingSet) { @@ -111,13 +112,13 @@ def control() ifUnset "triggerModes", "mode", title: "System Changes Mode", required: false, multiple: true ifUnset "timeOfDay", "time", title: "At a Scheduled Time", required: false } - section("Run this activity"){ - input "activity", "enum", title: "Activity?", required: true, options: new groovy.json.JsonSlurper().parseText(activities ?: "[]").activities?.collect { ["${it.uuid}": it.name] } - } + //section("Run this activity"){ + // input "activity", "enum", title: "Activity?", required: true, options: new groovy.json.JsonSlurper().parseText(activities ?: "[]").activities?.collect { ["${it.uuid}": it.name] } + //} section("More options", hideable: true, hidden: true) { input "frequency", "decimal", title: "Minimum time between actions (defaults to every event)", description: "Minutes", required: false - href "timeIntervalInput", title: "Only during a certain time", description: timeLabel ?: "Tap to set", state: timeLabel ? "complete" : "incomplete" + //href "timeIntervalInput", title: "Only during a certain time", description: timeLabel ?: "Tap to set", state: timeLabel ? "complete" : "incomplete" input "days", "enum", title: "Only on certain days of the week", multiple: true, required: false, options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] input "modes", "mode", title: "Only when mode is", multiple: true, required: false @@ -128,7 +129,7 @@ def control() mode title: "Set for specific mode(s)" } } - } + //} } private anythingSet() { @@ -223,7 +224,7 @@ def appTouchHandler(evt) { } private startActivity(evt) { - agent.startActivity(activity) + //agent.startActivity(activity) if (frequency) { state.lastActionTimeStamp = now()