Compare commits

...

1 Commits

Author SHA1 Message Date
Angie Martinez
cee1019f61 MSA-2537: To be able to connect more to my room 2018-01-09 19:33:37 -08:00
2 changed files with 144 additions and 53 deletions

View File

@@ -0,0 +1,91 @@
/**
* My firs time device handler
*
* Copyright 2018 Angie Martinez
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
*/
metadata {
definition (name: "My firs time device handler ", namespace: "Martin33z", author: "Angie Martinez") {
capability "Light"
capability "TV"
capability "TV Channel"
}
simulator {
// TODO: define status and reply messages here
}
tiles {
// TODO: define your main and details tiles here
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
// TODO: handle 'switch' attribute
// TODO: handle 'volume' attribute
// TODO: handle 'channel' attribute
// TODO: handle 'power' attribute
// TODO: handle 'picture' attribute
// TODO: handle 'sound' attribute
// TODO: handle 'movieMode' attribute
// TODO: handle 'tvChannel' attribute
}
// handle commands
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def on() {
log.debug "Executing 'on'"
// TODO: handle 'on' command
}
def volumeUp() {
log.debug "Executing 'volumeUp'"
// TODO: handle 'volumeUp' command
}
def volumeDown() {
log.debug "Executing 'volumeDown'"
// TODO: handle 'volumeDown' command
}
def channelUp() {
log.debug "Executing 'channelUp'"
// TODO: handle 'channelUp' command
}
def channelDown() {
log.debug "Executing 'channelDown'"
// TODO: handle 'channelDown' command
}
def setTvChannel() {
log.debug "Executing 'setTvChannel'"
// TODO: handle 'setTvChannel' command
}
def channelUp() {
log.debug "Executing 'channelUp'"
// TODO: handle 'channelUp' command
}
def channelDown() {
log.debug "Executing 'channelDown'"
// TODO: handle 'channelDown' command
}

View File

@@ -1,53 +1,53 @@
/**
* Copyright 2015 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
* Let There Be Light!
* Turn your lights on when an open/close sensor opens and off when the sensor closes.
*
* Author: SmartThings
*/
definition(
name: "Let There Be Light!",
namespace: "smartthings",
author: "SmartThings",
description: "Turn your lights on when a SmartSense Multi is opened and turn them off when it is closed.",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet@2x.png"
)
preferences {
section("When the door opens/closes...") {
input "contact1", "capability.contactSensor", title: "Where?"
}
section("Turn on/off a light...") {
input "switch1", "capability.switch"
}
}
def installed() {
subscribe(contact1, "contact", contactHandler)
}
def updated() {
unsubscribe()
subscribe(contact1, "contact", contactHandler)
}
def contactHandler(evt) {
log.debug "$evt.value"
if (evt.value == "open") {
switch1.on()
} else if (evt.value == "closed") {
switch1.off()
}
}
/**
* Copyright 2015 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
* Let There Be Light!
* Turn your lights on when an open/close sensor opens and off when the sensor closes.
*
* Author: SmartThings
*/
definition(
name: "Let There Be Light!",
namespace: "smartthings",
author: "SmartThings",
description: "Turn your lights on when a SmartSense Multi is opened and turn them off when it is closed.",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet@2x.png"
)
preferences {
section("When the door opens/closes...") {
input "contact1", "capability.contactSensor", title: "Where?"
}
section("Turn on/off a light...") {
input "switch1", "capability.switch"
}
}
def installed() {
subscribe(contact1, "contact", contactHandler)
}
def updated() {
unsubscribe()
subscribe(contact1, "contact", contactHandler)
}
def contactHandler(evt) {
log.debug "$evt.value"
if (evt.value == "open") {
switch1.on()
} else if (evt.value == "closed") {
switch1.off()
}
}