mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-18 05:10:52 +00:00
Compare commits
13 Commits
MSA-944-1
...
PROD_2016.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
024a6cb698 | ||
|
|
410e9f40cc | ||
|
|
1578c48440 | ||
|
|
7526d2b445 | ||
|
|
caf761c015 | ||
|
|
62a965d90b | ||
|
|
fb9f1dee47 | ||
|
|
3a433d3865 | ||
|
|
8f25ff4434 | ||
|
|
515b268374 | ||
|
|
9b87d39fe8 | ||
|
|
a103d437c2 | ||
|
|
bdd88deb99 |
@@ -9,7 +9,6 @@ metadata {
|
|||||||
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 "Color Temperature"
|
|
||||||
capability "Switch"
|
capability "Switch"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
@@ -53,7 +52,7 @@ metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main(["switch"])
|
main(["switch"])
|
||||||
details(["rich-control", "colorTempSliderControl","refresh"])
|
details(["rich-control", "refresh"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,129 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Alfred Workflow
|
|
||||||
*
|
|
||||||
* Author: SmartThings
|
|
||||||
*/
|
|
||||||
|
|
||||||
definition(
|
|
||||||
name: "윤정은",
|
|
||||||
namespace: "윤정은",
|
|
||||||
author: "SmartThings",
|
|
||||||
description: "This SmartApp allows you to interact with the things in your physical graph through Alfred.",
|
|
||||||
category: "Convenience",
|
|
||||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/alfred-app.png",
|
|
||||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/alfred-app@2x.png",
|
|
||||||
oauth: [displayName: "SmartThings Alfred Workflow", displayLink: ""]
|
|
||||||
)
|
|
||||||
|
|
||||||
preferences {
|
|
||||||
section("Allow Alfred to Control These Things...") {
|
|
||||||
input "switches", "capability.switch", title: "Which Switches?", multiple: true, required: false
|
|
||||||
input "locks", "capability.lock", title: "Which Locks?", multiple: true, required: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mappings {
|
|
||||||
path("/switches") {
|
|
||||||
action: [
|
|
||||||
GET: "listSwitches",
|
|
||||||
PUT: "updateSwitches"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/switches/:id") {
|
|
||||||
action: [
|
|
||||||
GET: "showSwitch",
|
|
||||||
PUT: "updateSwitch"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/locks") {
|
|
||||||
action: [
|
|
||||||
GET: "listLocks",
|
|
||||||
PUT: "updateLocks"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
path("/locks/:id") {
|
|
||||||
action: [
|
|
||||||
GET: "showLock",
|
|
||||||
PUT: "updateLock"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def installed() {}
|
|
||||||
|
|
||||||
def updated() {}
|
|
||||||
|
|
||||||
def listSwitches() {
|
|
||||||
switches.collect { device(it,"switch") }
|
|
||||||
}
|
|
||||||
void updateSwitches() {
|
|
||||||
updateAll(switches)
|
|
||||||
}
|
|
||||||
def showSwitch() {
|
|
||||||
show(switches, "switch")
|
|
||||||
}
|
|
||||||
void updateSwitch() {
|
|
||||||
update(switches)
|
|
||||||
}
|
|
||||||
|
|
||||||
def listLocks() {
|
|
||||||
locks.collect { device(it, "lock") }
|
|
||||||
}
|
|
||||||
void updateLocks() {
|
|
||||||
updateAll(locks)
|
|
||||||
}
|
|
||||||
def showLock() {
|
|
||||||
show(locks, "lock")
|
|
||||||
}
|
|
||||||
void updateLock() {
|
|
||||||
update(locks)
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateAll(devices) {
|
|
||||||
def command = request.JSON?.command
|
|
||||||
if (command) {
|
|
||||||
devices."$command"()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void update(devices) {
|
|
||||||
log.debug "update, request: ${request.JSON}, params: ${params}, devices: $devices.id"
|
|
||||||
def command = request.JSON?.command
|
|
||||||
if (command) {
|
|
||||||
def device = devices.find { it.id == params.id }
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
} else {
|
|
||||||
device."$command"()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private show(devices, name) {
|
|
||||||
def device = devices.find { it.id == params.id }
|
|
||||||
if (!device) {
|
|
||||||
httpError(404, "Device not found")
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
def s = device.currentState(name)
|
|
||||||
[id: device.id, label: device.displayName, name: device.displayName, state: s]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private device(it, name) {
|
|
||||||
if (it) {
|
|
||||||
def s = it.currentState(name)
|
|
||||||
[id: it.id, label: it.displayName, name: it.displayName, state: s]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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,13 +408,15 @@ 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;
|
||||||
default:
|
case "Custom Message":
|
||||||
/*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