mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
Compare commits
3 Commits
PROD_2017.
...
MSA-1801-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
098a26839f | ||
|
|
4a6f0eda02 | ||
|
|
8a00eaee12 |
@@ -1,71 +1,71 @@
|
||||
/**
|
||||
* Simulated Alarm
|
||||
*
|
||||
* Copyright 2014 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.
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Simulated Alarm", namespace: "smartthings/testing", author: "SmartThings") {
|
||||
capability "Alarm"
|
||||
capability "Sensor"
|
||||
capability "Actuator"
|
||||
}
|
||||
|
||||
simulator {
|
||||
// reply messages
|
||||
["strobe","siren","both","off"].each {
|
||||
reply "$it": "alarm:$it"
|
||||
}
|
||||
}
|
||||
|
||||
tiles {
|
||||
standardTile("alarm", "device.alarm", width: 2, height: 2) {
|
||||
state "off", label:'off', action:'alarm.both', icon:"st.alarm.alarm.alarm", backgroundColor:"#ffffff"
|
||||
state "strobe", label:'strobe!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
|
||||
state "siren", label:'siren!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
|
||||
state "both", label:'alarm!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
|
||||
}
|
||||
standardTile("strobe", "device.alarm", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"alarm.strobe", icon:"st.secondary.strobe", backgroundColor:"#cccccc"
|
||||
}
|
||||
standardTile("siren", "device.alarm", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"alarm.siren", icon:"st.secondary.siren", backgroundColor:"#cccccc"
|
||||
}
|
||||
standardTile("off", "device.alarm", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"alarm.off", icon:"st.secondary.off"
|
||||
}
|
||||
main "alarm"
|
||||
details(["alarm","strobe","siren","test","off"])
|
||||
}
|
||||
}
|
||||
|
||||
def strobe() {
|
||||
sendEvent(name: "alarm", value: "strobe")
|
||||
}
|
||||
|
||||
def siren() {
|
||||
sendEvent(name: "alarm", value: "siren")
|
||||
}
|
||||
|
||||
def both() {
|
||||
sendEvent(name: "alarm", value: "both")
|
||||
}
|
||||
|
||||
def off() {
|
||||
sendEvent(name: "alarm", value: "off")
|
||||
}
|
||||
|
||||
// Parse incoming device messages to generate events
|
||||
def parse(String description) {
|
||||
def pair = description.split(":")
|
||||
createEvent(name: pair[0].trim(), value: pair[1].trim())
|
||||
}
|
||||
/**
|
||||
* Simulated Alarm
|
||||
*
|
||||
* Copyright 2014 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.
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Simulated Alarm", namespace: "smartthings/testing", author: "SmartThings") {
|
||||
capability "Alarm"
|
||||
capability "Sensor"
|
||||
capability "Actuator"
|
||||
}
|
||||
|
||||
simulator {
|
||||
// reply messages
|
||||
["strobe","siren","both","off"].each {
|
||||
reply "$it": "alarm:$it"
|
||||
}
|
||||
}
|
||||
|
||||
tiles {
|
||||
standardTile("alarm", "device.alarm", width: 2, height: 2) {
|
||||
state "off", label:'off', action:'alarm.both', icon:"st.alarm.alarm.alarm", backgroundColor:"#ffffff"
|
||||
state "strobe", label:'strobe!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
|
||||
state "siren", label:'siren!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
|
||||
state "both", label:'alarm!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
|
||||
}
|
||||
standardTile("strobe", "device.alarm", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"alarm.strobe", icon:"st.secondary.strobe", backgroundColor:"#cccccc"
|
||||
}
|
||||
standardTile("siren", "device.alarm", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"alarm.siren", icon:"st.secondary.siren", backgroundColor:"#cccccc"
|
||||
}
|
||||
standardTile("off", "device.alarm", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"alarm.off", icon:"st.secondary.off"
|
||||
}
|
||||
main "alarm"
|
||||
details(["alarm","strobe","siren","test","off"])
|
||||
}
|
||||
}
|
||||
|
||||
def strobe() {
|
||||
sendEvent(name: "alarm", value: "strobe")
|
||||
}
|
||||
|
||||
def siren() {
|
||||
sendEvent(name: "alarm", value: "siren")
|
||||
}
|
||||
|
||||
def both() {
|
||||
sendEvent(name: "alarm", value: "both")
|
||||
}
|
||||
|
||||
def off() {
|
||||
sendEvent(name: "alarm", value: "off")
|
||||
}
|
||||
|
||||
// Parse incoming device messages to generate events
|
||||
def parse(String description) {
|
||||
def pair = description.split(":")
|
||||
createEvent(name: pair[0].trim(), value: pair[1].trim())
|
||||
}
|
||||
|
||||
51
smartapps/jefferson/jefferson.src/jefferson.groovy
Normal file
51
smartapps/jefferson/jefferson.src/jefferson.groovy
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* jefferson
|
||||
*
|
||||
* Copyright 2017 Jaeguk Yun
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
definition(
|
||||
name: "jefferson",
|
||||
namespace: "jefferson",
|
||||
author: "Jaeguk Yun",
|
||||
description: "Jaeguk Yun",
|
||||
category: "Green Living",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||
oauth: true)
|
||||
|
||||
|
||||
preferences {
|
||||
section("Title") {
|
||||
// TODO: put inputs here
|
||||
}
|
||||
}
|
||||
|
||||
def installed() {
|
||||
log.debug "Installed with settings: ${settings}"
|
||||
|
||||
initialize()
|
||||
}
|
||||
|
||||
def updated() {
|
||||
log.debug "Updated with settings: ${settings}"
|
||||
|
||||
unsubscribe()
|
||||
initialize()
|
||||
}
|
||||
|
||||
def initialize() {
|
||||
// TODO: subscribe to attributes, devices, locations, etc.
|
||||
}
|
||||
|
||||
// TODO: implement event handlers
|
||||
Reference in New Issue
Block a user