X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=official%2Fstep-notifier.groovy;h=7a0609130b9090f12dbbef2a172f13be8bed8441;hb=314ca2bccdf85a517cd3bd3aa10a5afb6cd0238a;hp=7aec19c178283349ebab827ec74a5da21c0fe604;hpb=3325c1b0cc49b9fbbc497cb3612f7aeff5263eca;p=smartapps.git diff --git a/official/step-notifier.groovy b/official/step-notifier.groovy index 7aec19c..7a06091 100755 --- a/official/step-notifier.groovy +++ b/official/step-notifier.groovy @@ -25,7 +25,6 @@ definition( preferences { page(name: "setupNotifications") - page(name: "chooseTrack", title: "Select a song or station") page(name: "timeIntervalInput", title: "Only during a certain time") { section { input "starting", "time", title: "Starting", required: false @@ -39,11 +38,11 @@ def setupNotifications() { dynamicPage(name: "setupNotifications", title: "Configure Your Goal Notifications.", install: true, uninstall: true) { section("Select your Jawbone UP") { - input "jawbone", "device.jawboneUser", title: "Jawbone UP", required: true, multiple: false + input "jawbone", "capability.stepSensor", title: "Jawbone UP", required: true, multiple: false } section("Notify Me When"){ - input "thresholdType", "enum", title: "Select When to Notify", required: false, defaultValue: "Goal Reached", options: [["Goal":"Goal Reached"],["Threshold":"Specific Number of Steps"]], submitOnChange:true + input "thresholdType", "enum", title: "Select When to Notify", required: false, defaultValue: "Goal Reached", options: ["Goal","Threshold"], submitOnChange:true if (settings.thresholdType) { if (settings.thresholdType == "Threshold") { input "threshold", "number", title: "Enter Step Threshold", description: "Number", required: true @@ -66,7 +65,7 @@ def setupNotifications() { section("Change the Color of the Lights") { input "hues", "capability.colorControl", title: "Which Hue Bulbs?", required:false, multiple:true input "color", "enum", title: "Hue Color?", required: false, multiple:false, options: ["Red","Green","Blue","Yellow","Orange","Purple","Pink"] - input "lightLevel", "enum", title: "Light Level?", required: false, options: [[10:"10%"],[20:"20%"],[30:"30%"],[40:"40%"],[50:"50%"],[60:"60%"],[70:"70%"],[80:"80%"],[90:"90%"],[100:"100%"]] + input "lightLevel", "enum", title: "Light Level?", required: false, options: [10,20,30,40,50,60,70,80,90,100] input "duration", "number", title: "Duration in Seconds?", defaultValue: 30, required: false } @@ -83,18 +82,10 @@ def setupNotifications() { } } -def chooseTrack() { - dynamicPage(name: "chooseTrack") { - section{ - input "song","enum",title:"Play this track", required:true, multiple: false, options: songOptions() - } - } -} - private songOptions() { // Make sure current selection is in the set - + /* def options = new LinkedHashSet() if (state.selectedSong?.station) { options << state.selectedSong.station @@ -110,10 +101,12 @@ private songOptions() { options.addAll(dataMaps.collect{it.station}) log.trace "${options.size()} songs in list" - options.take(20) as List + options.take(20) as List*/ + state.selectedSong = "SomeTrack" } private saveSelectedSong() { + /* try { def thisSong = song log.info "Looking for $thisSong" @@ -135,12 +128,14 @@ private saveSelectedSong() { } catch (Throwable t) { log.error t - } + }*/ + state.selectedSong = "SomeTrack" } def installed() { log.debug "Installed with settings: ${settings}" - + // Initialize input value + color = "Orange" initialize() } @@ -156,7 +151,7 @@ def initialize() { log.trace "Entering initialize()" state.lastSteps = 0 - state.steps = jawbone.currentValue("steps").toInteger() + state.steps = jawbone.currentValue("steps").toInteger() state.goal = jawbone.currentValue("goal").toInteger() subscribe (jawbone,"goal",goalHandler) @@ -266,7 +261,7 @@ def lightsNotification() { for (i in 1..flashCount) { lights.on() - pause(500) + //pause(500) lights.off() }