Compare commits
1 Commits
prod
...
MSA-2537-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cee1019f61 |
@@ -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
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user