mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-18 05:10:52 +00:00
Compare commits
1 Commits
PROD_2016.
...
MSA-949-3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca31ced7df |
@@ -1,96 +1,97 @@
|
|||||||
/**
|
/**
|
||||||
* Hue Lux Bulb
|
* Hue Lux Bulb
|
||||||
*
|
*
|
||||||
* Author: SmartThings
|
* Author: SmartThings
|
||||||
*/
|
*/
|
||||||
// for the UI
|
// for the UI
|
||||||
metadata {
|
metadata {
|
||||||
// Automatically generated. Make future change here.
|
// Automatically generated. Make future change here.
|
||||||
definition (name: "Hue Lux Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Hue Lux Bulb", namespace: "smartthings", author: "SmartThings") {
|
||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Switch"
|
capability "Color Temperature"
|
||||||
capability "Refresh"
|
capability "Switch"
|
||||||
capability "Sensor"
|
capability "Refresh"
|
||||||
|
capability "Sensor"
|
||||||
command "refresh"
|
|
||||||
}
|
command "refresh"
|
||||||
|
}
|
||||||
simulator {
|
|
||||||
// TODO: define status and reply messages here
|
simulator {
|
||||||
}
|
// TODO: define status and reply messages here
|
||||||
|
}
|
||||||
tiles(scale: 2) {
|
|
||||||
multiAttributeTile(name:"rich-control", type: "lighting", canChangeIcon: true){
|
tiles(scale: 2) {
|
||||||
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
|
multiAttributeTile(name:"rich-control", type: "lighting", canChangeIcon: true){
|
||||||
attributeState "on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
|
||||||
attributeState "off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
attributeState "on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
||||||
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
attributeState "off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
||||||
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
||||||
}
|
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
||||||
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
|
}
|
||||||
attributeState "level", action:"switch level.setLevel", range:"(0..100)"
|
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
|
||||||
}
|
attributeState "level", action:"switch level.setLevel", range:"(0..100)"
|
||||||
tileAttribute ("device.level", key: "SECONDARY_CONTROL") {
|
}
|
||||||
attributeState "level", label: 'Level ${currentValue}%'
|
tileAttribute ("device.level", key: "SECONDARY_CONTROL") {
|
||||||
}
|
attributeState "level", label: 'Level ${currentValue}%'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
|
|
||||||
state "on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
|
||||||
state "off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
state "on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
||||||
state "turningOn", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
state "off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
||||||
state "turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
state "turningOn", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
|
||||||
}
|
state "turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
|
||||||
|
}
|
||||||
controlTile("levelSliderControl", "device.level", "slider", height: 1, width: 2, inactiveLabel: false, range:"(0..100)") {
|
|
||||||
state "level", action:"switch level.setLevel"
|
controlTile("levelSliderControl", "device.level", "slider", height: 1, width: 2, inactiveLabel: false, range:"(0..100)") {
|
||||||
}
|
state "level", action:"switch level.setLevel"
|
||||||
|
}
|
||||||
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
|
||||||
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
|
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||||
}
|
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||||
|
}
|
||||||
main(["switch"])
|
|
||||||
details(["rich-control", "refresh"])
|
main(["switch"])
|
||||||
}
|
details(["rich-control", "colorTempSliderControl","refresh"])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// parse events into attributes
|
|
||||||
def parse(description) {
|
// parse events into attributes
|
||||||
log.debug "parse() - $description"
|
def parse(description) {
|
||||||
def results = []
|
log.debug "parse() - $description"
|
||||||
|
def results = []
|
||||||
def map = description
|
|
||||||
if (description instanceof String) {
|
def map = description
|
||||||
log.debug "Hue Bulb stringToMap - ${map}"
|
if (description instanceof String) {
|
||||||
map = stringToMap(description)
|
log.debug "Hue Bulb stringToMap - ${map}"
|
||||||
}
|
map = stringToMap(description)
|
||||||
|
}
|
||||||
if (map?.name && map?.value) {
|
|
||||||
results << createEvent(name: "${map?.name}", value: "${map?.value}")
|
if (map?.name && map?.value) {
|
||||||
}
|
results << createEvent(name: "${map?.name}", value: "${map?.value}")
|
||||||
results
|
}
|
||||||
}
|
results
|
||||||
|
}
|
||||||
// handle commands
|
|
||||||
void on() {
|
// handle commands
|
||||||
parent.on(this)
|
void on() {
|
||||||
sendEvent(name: "switch", value: "on")
|
parent.on(this)
|
||||||
}
|
sendEvent(name: "switch", value: "on")
|
||||||
|
}
|
||||||
void off() {
|
|
||||||
parent.off(this)
|
void off() {
|
||||||
sendEvent(name: "switch", value: "off")
|
parent.off(this)
|
||||||
}
|
sendEvent(name: "switch", value: "off")
|
||||||
|
}
|
||||||
void setLevel(percent) {
|
|
||||||
log.debug "Executing 'setLevel'"
|
void setLevel(percent) {
|
||||||
parent.setLevel(this, percent)
|
log.debug "Executing 'setLevel'"
|
||||||
sendEvent(name: "level", value: percent)
|
parent.setLevel(this, percent)
|
||||||
}
|
sendEvent(name: "level", value: percent)
|
||||||
|
}
|
||||||
void refresh() {
|
|
||||||
log.debug "Executing 'refresh'"
|
void refresh() {
|
||||||
parent.manualRefresh()
|
log.debug "Executing 'refresh'"
|
||||||
}
|
parent.manualRefresh()
|
||||||
|
}
|
||||||
50
smartapps/-/-.src/-.groovy
Normal file
50
smartapps/-/-.src/-.groovy
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* 정창환
|
||||||
|
*
|
||||||
|
* Copyright 2016 정창환
|
||||||
|
*
|
||||||
|
* 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: "정창환",
|
||||||
|
namespace: "정창환",
|
||||||
|
author: "정창환",
|
||||||
|
description: "\u3139\u3139\u3139",
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
@@ -76,7 +76,7 @@ def mainPage() {
|
|||||||
}
|
}
|
||||||
section{
|
section{
|
||||||
input "actionType", "enum", title: "Action?", required: true, defaultValue: "Bell 1", options: [
|
input "actionType", "enum", title: "Action?", required: true, defaultValue: "Bell 1", options: [
|
||||||
"Custom Message",
|
//"Custom Message",
|
||||||
"Bell 1",
|
"Bell 1",
|
||||||
"Bell 2",
|
"Bell 2",
|
||||||
"Dogs Barking",
|
"Dogs Barking",
|
||||||
@@ -89,7 +89,7 @@ def mainPage() {
|
|||||||
"Someone is arriving",
|
"Someone is arriving",
|
||||||
"Piano",
|
"Piano",
|
||||||
"Lightsaber"]
|
"Lightsaber"]
|
||||||
input "message","text",title:"Play this message", required:false, multiple: false
|
//input "message","text",title:"Play this message", required:false, multiple: false
|
||||||
}
|
}
|
||||||
section {
|
section {
|
||||||
input "sonos", "capability.musicPlayer", title: "On this Speaker player", required: true
|
input "sonos", "capability.musicPlayer", title: "On this Speaker player", required: true
|
||||||
@@ -408,15 +408,13 @@ private loadText() {
|
|||||||
case "Lightsaber":
|
case "Lightsaber":
|
||||||
state.sound = [uri: "http://s3.amazonaws.com/smartapp-media/sonos/lightsaber.mp3", duration: "10"]
|
state.sound = [uri: "http://s3.amazonaws.com/smartapp-media/sonos/lightsaber.mp3", duration: "10"]
|
||||||
break;
|
break;
|
||||||
case "Custom Message":
|
default:
|
||||||
if (message) {
|
/*if (message) {
|
||||||
state.sound = textToSpeech(message instanceof List ? message[0] : message) // not sure why this is (sometimes) needed)
|
state.sound = textToSpeech(message instanceof List ? message[0] : message) // not sure why this is (sometimes) needed)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state.sound = textToSpeech("You selected the custom message option but did not enter a message in the $app.label Smart App")
|
state.sound = textToSpeech("You selected the custom message option but did not enter a message in the $app.label Smart App")
|
||||||
}
|
}*/
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state.sound = [uri: "http://s3.amazonaws.com/smartapp-media/sonos/bell1.mp3", duration: "10"]
|
state.sound = [uri: "http://s3.amazonaws.com/smartapp-media/sonos/bell1.mp3", duration: "10"]
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user