mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-26 05:14:11 +00:00
Compare commits
1 Commits
MSA-1535-2
...
MSA-1536-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d1ab32c07 |
@@ -1,158 +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.
|
|
||||||
*
|
|
||||||
* LEEDARSON White Color Temperature Bulb
|
|
||||||
*
|
|
||||||
* Author: Yechi
|
|
||||||
* Date: 2015-09-22
|
|
||||||
*/
|
|
||||||
|
|
||||||
metadata {
|
|
||||||
definition (name: "LEEDARSON White Color Temperature Bulb", namespace: "smartthings", author: "Yechi") {
|
|
||||||
|
|
||||||
capability "Actuator"
|
|
||||||
capability "Color Temperature"
|
|
||||||
capability "Configuration"
|
|
||||||
capability "Health Check"
|
|
||||||
capability "Refresh"
|
|
||||||
capability "Switch"
|
|
||||||
capability "Switch Level"
|
|
||||||
|
|
||||||
attribute "colorName", "string"
|
|
||||||
command "setGenericName"
|
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300", outClusters: "0019"
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04", outClusters: "0019"
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Flood BR30 Tunable White"
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Recessed Kit RT 5/6 Tunable White"
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 TW", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic B40 TW - LIGHTIFY", deviceJoinName: "OSRAM LIGHTIFY Classic B40 Tunable White"
|
|
||||||
fingerprint profileId: "0104", deviceId: "0102", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300", outClusters: "0019", manufacturer: "Eaton", model: "Halo_LT01", deviceJoinName: "LDS Tunable White"
|
|
||||||
}
|
|
||||||
|
|
||||||
// UI tile definitions
|
|
||||||
tiles(scale: 2) {
|
|
||||||
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
|
|
||||||
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
|
|
||||||
attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#79b821", nextState:"turningOff"
|
|
||||||
attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
|
|
||||||
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#79b821", nextState:"turningOff"
|
|
||||||
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
|
|
||||||
}
|
|
||||||
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
|
|
||||||
attributeState "level", action:"switch level.setLevel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
|
||||||
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
|
|
||||||
}
|
|
||||||
|
|
||||||
controlTile("colorTempSliderControl", "device.colorTemperature", "slider", width: 4, height: 2, inactiveLabel: false, range:"(2700..5000)") {
|
|
||||||
state "colorTemperature", action:"color temperature.setColorTemperature"
|
|
||||||
}
|
|
||||||
valueTile("colorName", "device.colorName", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
|
||||||
state "colorName", label: '${currentValue}'
|
|
||||||
}
|
|
||||||
|
|
||||||
main(["switch"])
|
|
||||||
details(["switch", "colorTempSliderControl", "colorName", "refresh"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse incoming device messages to generate events
|
|
||||||
def parse(String description) {
|
|
||||||
log.debug "description is $description"
|
|
||||||
def event = zigbee.getEvent(description)
|
|
||||||
if (event) {
|
|
||||||
if (event.name=="level" && event.value==0) {}
|
|
||||||
else {
|
|
||||||
if (event.name=="colorTemperature") {
|
|
||||||
setGenericName(event.value)
|
|
||||||
}
|
|
||||||
sendEvent(event)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
def cluster = zigbee.parse(description)
|
|
||||||
|
|
||||||
if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) {
|
|
||||||
if (cluster.data[0] == 0x00) {
|
|
||||||
log.debug "ON/OFF REPORTING CONFIG RESPONSE: " + cluster
|
|
||||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
log.warn "ON/OFF REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
log.warn "DID NOT PARSE MESSAGE for description : $description"
|
|
||||||
log.debug "${cluster}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def off() {
|
|
||||||
zigbee.off()
|
|
||||||
}
|
|
||||||
|
|
||||||
def on() {
|
|
||||||
zigbee.on()
|
|
||||||
}
|
|
||||||
|
|
||||||
def setLevel(value) {
|
|
||||||
zigbee.setLevel(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PING is used by Device-Watch in attempt to reach the Device
|
|
||||||
* */
|
|
||||||
def ping() {
|
|
||||||
return zigbee.onOffRefresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
def refresh() {
|
|
||||||
zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig()
|
|
||||||
}
|
|
||||||
|
|
||||||
def configure() {
|
|
||||||
log.debug "Configuring Reporting and Bindings."
|
|
||||||
// Device-Watch allows 3 check-in misses from device (plus 1 min lag time)
|
|
||||||
// enrolls with default periodic reporting until newer 5 min interval is confirmed
|
|
||||||
sendEvent(name: "checkInterval", value: 3 * 60 * 60 + 1 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
|
||||||
|
|
||||||
// OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
def setColorTemperature(value) {
|
|
||||||
setGenericName(value)
|
|
||||||
zigbee.setColorTemperature(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
//Naming based on the wiki article here: http://en.wikipedia.org/wiki/Color_temperature
|
|
||||||
def setGenericName(value){
|
|
||||||
if (value != null) {
|
|
||||||
def genericName = "White"
|
|
||||||
if (value < 3300) {
|
|
||||||
genericName = "Soft White"
|
|
||||||
} else if (value < 4150) {
|
|
||||||
genericName = "Moonlight"
|
|
||||||
} else if (value <= 5000) {
|
|
||||||
genericName = "Cool White"
|
|
||||||
} else if (value >= 5000) {
|
|
||||||
genericName = "Daylight"
|
|
||||||
}
|
|
||||||
sendEvent(name: "colorName", value: genericName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
118
smartapps/brilliant/brilliant.src/brilliant.groovy
Normal file
118
smartapps/brilliant/brilliant.src/brilliant.groovy
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/**
|
||||||
|
* Brilliant Light Switch App
|
||||||
|
*
|
||||||
|
* Copyright 2016 Brilliant Home Technology
|
||||||
|
*
|
||||||
|
* 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: "Brilliant",
|
||||||
|
namespace: "brilliant",
|
||||||
|
author: "Brilliant Home Technology",
|
||||||
|
description: "Control lights connected to your Smartthings hub from the Brilliant switch",
|
||||||
|
category: "Convenience",
|
||||||
|
iconUrl: "https://s3-us-west-1.amazonaws.com/dev-object-store/assets/logo-brilliant-square.png",
|
||||||
|
iconX2Url: "https://s3-us-west-1.amazonaws.com/dev-object-store/assets/logo-brilliant-square.png",
|
||||||
|
iconX3Url: "https://s3-us-west-1.amazonaws.com/dev-object-store/assets/logo-brilliant-square.png")
|
||||||
|
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
section("All Devices") {
|
||||||
|
input "all", "capability.actuator", multiple: true, required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mappings {
|
||||||
|
path("/all") {
|
||||||
|
action: [
|
||||||
|
GET: "get_all"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/device/:device_id") {
|
||||||
|
action: [
|
||||||
|
GET: "get_device"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/device/:device_id/:command") {
|
||||||
|
action: [
|
||||||
|
PUT: "do_command"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_all() {
|
||||||
|
def resp = []
|
||||||
|
all.each {
|
||||||
|
def device = it
|
||||||
|
def attributes = it.supportedAttributes*.name
|
||||||
|
def state = [:]
|
||||||
|
attributes.each {
|
||||||
|
state.put(it, device.currentState(it))
|
||||||
|
}
|
||||||
|
def commands = it.supportedCommands*.name
|
||||||
|
def capabilities = it.capabilities*.name
|
||||||
|
def map = [id: it.id, name: it.name, label: it.label, commands:commands, capabilities: capabilities, state:state]
|
||||||
|
resp << map
|
||||||
|
}
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_device() {
|
||||||
|
def deviceId = params.device_id
|
||||||
|
|
||||||
|
def device = all.find { it.id == deviceId }
|
||||||
|
|
||||||
|
def attributes = device.supportedAttributes*.name
|
||||||
|
def state = [:]
|
||||||
|
attributes.each {
|
||||||
|
state.put(it, device.currentState(it))
|
||||||
|
}
|
||||||
|
return [state: state]
|
||||||
|
}
|
||||||
|
|
||||||
|
def do_command() {
|
||||||
|
// use the built-in request object to get the command parameter
|
||||||
|
def deviceId = params.device_id
|
||||||
|
def command = params.command
|
||||||
|
def json = request.JSON
|
||||||
|
|
||||||
|
if (deviceId && command) {
|
||||||
|
def device = all.find { it.id == deviceId }
|
||||||
|
log.debug "Device: ${device}"
|
||||||
|
if (!device.hasCommand(command)) {
|
||||||
|
httpError(501, "$command is not a valid command for all switches specified")
|
||||||
|
}
|
||||||
|
def foo = json.data
|
||||||
|
if (foo) {
|
||||||
|
log.debug "Going to issue command ${command} with variable ${foo}"
|
||||||
|
device."$command"(json.data)
|
||||||
|
} else {
|
||||||
|
log.debug "Going to issue command ${command} with no variables"
|
||||||
|
device."$command"()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
}
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
* LDS_CCT
|
|
||||||
*
|
|
||||||
* Copyright 2016 Jungle
|
|
||||||
*
|
|
||||||
* 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: "LDS_CCT",
|
|
||||||
namespace: "smarttings",
|
|
||||||
author: "Jungle",
|
|
||||||
description: "LDS_CCT",
|
|
||||||
category: "",
|
|
||||||
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
|
|
||||||
Reference in New Issue
Block a user