2 * Copyright 2015 SmartThings
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
10 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
11 * for the specific language governing permissions and limitations under the License.
13 * Schedule the Camera Power
15 * Author: danny@smartthings.com
20 name: "Camera Power Scheduler",
21 namespace: "smartthings",
22 author: "SmartThings",
23 description: "Turn the power on and off at a specific time. ",
24 category: "Available Beta Apps",
25 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/dropcam-on-off-schedule.png",
26 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/dropcam-on-off-schedule@2x.png"
30 section("Camera power..."){
31 input "switch1", "capability.switch", multiple: true
33 section("Turn the Camera On at..."){
34 input "startTime", "time", title: "Start Time", required:false
36 section("Turn the Camera Off at..."){
37 input "endTime", "time", title: "End Time", required:false
54 def tz = location.timeZone
56 //if it's after the startTime but before the end time, turn it on
57 if(startTime && timeToday(startTime,tz).time > timeToday(now,tz).time){
59 if(endTime && timeToday(endTime,tz).time < timeToday(now,tz).time){
66 else if(endTime && timeToday(endtime,tz).time > timeToday(now,tz).time)
73 runDaily(startTime, turnOnCamera)
75 runDaily(endTime,turnOffCamera)
80 log.info "turned on camera"
86 log.info "turned off camera"