Compare commits

..

3 Commits

Author SHA1 Message Date
이현주
65b9be4f7b MSA-1268: 취침 2016-05-11 23:29:51 -05:00
Lars Finander
a5da182bf4 Merge pull request #861 from larsfinander/DVCSMP-1738_Phillips_HUE_brightness_level
DVCSMP-1738 Philips HUE: Detail page showing the Brightness level twice
2016-05-11 15:25:36 -07:00
Lars Finander
27c05f4e5b DVCSMP-1738 Philips HUE: Detail page showing the Brightness level twice
-Removed secondary control from all Hue DTH
2016-05-06 09:29:41 -07:00
10 changed files with 210 additions and 28 deletions

View File

@@ -94,11 +94,11 @@ def parse(String description) {
def cmd = zwave.parse(description, [0x31: 1, 0x32: 1, 0x60: 3])
if (cmd) {
result = createEvent(zwaveEvent(cmd))
log.debug "Parse returned ${result?.descriptionText}"
storeGraphData(result.name, result.value)
} else {
log.debug "zwave.parse returned null command. Cannot create event"
}
log.debug "Parse returned ${result?.descriptionText}"
storeGraphData(result.name, result.value)
return result
}

View File

@@ -14,6 +14,7 @@
*
*/
//@Deprecated: Moved to ZLL Dimmer Bulb
metadata {
definition (name: "Cree Bulb", namespace: "smartthings", author: "SmartThings") {
@@ -24,7 +25,7 @@ metadata {
capability "Switch"
capability "Switch Level"
fingerprint profileId: "C05E", inClusters: "0000,0003,0004,0005,0006,0008,1000", outClusters: "0000,0019"
//fingerprint profileId: "C05E", inClusters: "0000,0003,0004,0005,0006,0008,1000", outClusters: "0000,0019"
}
// simulator metadata

View File

@@ -138,7 +138,6 @@ def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerS
log.debug "productTypeId: ${cmd.productTypeId}"
def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
updateDataValue("MSR", msr)
updateDataValue("manufacturer", cmd.manufacturerName)
createEvent([descriptionText: "$device.displayName MSR: $msr", isStateChange: false])
}

View File

@@ -37,9 +37,6 @@ metadata {
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.color", key: "COLOR_CONTROL") {
attributeState "color", action:"setAdjustedColor"
}

View File

@@ -38,9 +38,6 @@ metadata {
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.color", key: "COLOR_CONTROL") {
attributeState "color", action:"setAdjustedColor"
}

View File

@@ -33,9 +33,6 @@ metadata {
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}%'
}
}
controlTile("levelSliderControl", "device.level", "slider", height: 1, width: 2, inactiveLabel: false, range:"(0..100)") {

View File

@@ -22,9 +22,8 @@ metadata {
capability "Switch"
capability "Switch Level"
//fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0019"
//fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019", manufacturer: "CREE", model: "Connected A-19 60W Equivalent", deviceJoinName: "Cree Connected Bulb"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019", manufacturer: "CREE", model: "Connected A-19 60W Equivalent", deviceJoinName: "Cree Connected Bulb"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 W clear", deviceJoinName: "OSRAM LIGHTIFY LED Smart Connected Light"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 W clear - LIGHTIFY", deviceJoinName: "OSRAM LIGHTIFY LED Smart Connected Light"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0019", manufacturer: "Philips", model: "LWB006", deviceJoinName: "Philips Hue White"

View File

@@ -95,17 +95,11 @@ def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
}
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
log.debug "manufacturerId: ${cmd.manufacturerId}"
log.debug "manufacturerName: ${cmd.manufacturerName}"
log.debug "productId: ${cmd.productId}"
log.debug "productTypeId: ${cmd.productTypeId}"
def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
updateDataValue("MSR", msr)
updateDataValue("manufacturer", cmd.manufacturerName)
createEvent([descriptionText: "$device.displayName MSR: $msr", isStateChange: false])
if (state.manufacturer != cmd.manufacturerName) {
updateDataValue("manufacturer", cmd.manufacturerName)
}
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
// Handles all Z-Wave commands we aren't interested in
[:]

View File

@@ -0,0 +1,198 @@
/**
* 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.
*
* Good Night
*
* Author: SmartThings
* Date: 2013-03-07
*/
definition(
name: "이현주",
namespace: "smartthings",
author: "SmartThings",
description: "Changes mode when motion ceases after a specific time of night.",
category: "Mode Magic",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/ModeMagic/good-night.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/ModeMagic/good-night@2x.png"
)
preferences {
section("When there is no motion on any of these sensors") {
input "motionSensors", "capability.motionSensor", title: "Where?", multiple: true
}
section("For this amount of time") {
input "minutes", "number", title: "Minutes?"
}
section("After this time of day") {
input "timeOfDay", "time", title: "Time?"
}
section("And (optionally) these switches are all off") {
input "switches", "capability.switch", multiple: true, required: false
}
section("Change to this mode") {
input "newMode", "mode", title: "Mode?"
}
section( "Notifications" ) {
input("recipients", "contact", title: "Send notifications to") {
input "sendPushMessage", "enum", title: "Send a push notification?", options: ["Yes", "No"], required: false
input "phoneNumber", "phone", title: "Send a Text Message?", required: false
}
}
}
def installed() {
log.debug "Current mode = ${location.mode}"
createSubscriptions()
}
def updated() {
log.debug "Current mode = ${location.mode}"
unsubscribe()
createSubscriptions()
}
def createSubscriptions()
{
subscribe(motionSensors, "motion.active", motionActiveHandler)
subscribe(motionSensors, "motion.inactive", motionInactiveHandler)
subscribe(switches, "switch.off", switchOffHandler)
subscribe(location, modeChangeHandler)
if (state.modeStartTime == null) {
state.modeStartTime = 0
}
}
def modeChangeHandler(evt) {
state.modeStartTime = now()
}
def switchOffHandler(evt) {
if (correctMode() && correctTime()) {
if (allQuiet() && switchesOk()) {
takeActions()
}
}
}
def motionActiveHandler(evt)
{
log.debug "Motion active"
}
def motionInactiveHandler(evt)
{
// for backward compatibility
if (state.modeStartTime == null) {
subscribe(location, modeChangeHandler)
state.modeStartTime = 0
}
if (correctMode() && correctTime()) {
runIn(minutes * 60, scheduleCheck, [overwrite: false])
}
}
def scheduleCheck()
{
log.debug "scheduleCheck, currentMode = ${location.mode}, newMode = $newMode"
if (correctMode() && correctTime()) {
if (allQuiet() && switchesOk()) {
takeActions()
}
}
}
private takeActions() {
def message = "Goodnight! SmartThings changed the mode to '$newMode'"
send(message)
setLocationMode(newMode)
log.debug message
}
private correctMode() {
if (location.mode != newMode) {
true
} else {
log.debug "Location is already in the desired mode: doing nothing"
false
}
}
private correctTime() {
def t0 = now()
def modeStartTime = new Date(state.modeStartTime)
def startTime = timeTodayAfter(modeStartTime, timeOfDay, location.timeZone)
if (t0 >= startTime.time) {
true
} else {
log.debug "The current time of day (${new Date(t0)}), is not in the correct time window ($startTime): doing nothing"
false
}
}
private switchesOk() {
def result = true
for (it in (switches ?: [])) {
if (it.currentSwitch == "on") {
result = false
break
}
}
log.debug "Switches are all off: $result"
result
}
private allQuiet() {
def threshold = 1000 * 60 * minutes - 1000
def states = motionSensors.collect { it.currentState("motion") ?: [:] }.sort { a, b -> b.dateCreated <=> a.dateCreated }
if (states) {
if (states.find { it.value == "active" }) {
log.debug "Found active state"
false
} else {
def sensor = states.first()
def elapsed = now() - sensor.rawDateCreated.time
if (elapsed >= threshold) {
log.debug "No active states, and enough time has passed"
true
} else {
log.debug "No active states, but not enough time has passed"
false
}
}
} else {
log.debug "No states to check for activity"
true
}
}
private send(msg) {
if (location.contactBookEnabled) {
sendNotificationToContacts(msg, recipients)
}
else {
if (sendPushMessage != "No") {
log.debug("sending push message")
sendPush(msg)
}
if (phoneNumber) {
log.debug("sending text message")
sendSms(phoneNumber, msg)
}
}
log.debug msg
}

View File

@@ -273,7 +273,7 @@ def scheduleCheck(evt) {
else {
if(people){
//don't turn off lights if anyone is home
if(someoneIsHome){
if(someoneIsHome()){
log.debug("Stopping Check for Light")
unschedule()
}