Compare commits

..

10 Commits

Author SHA1 Message Date
Vinay Rao
a4d9cd51a3 Merge pull request #2005 from SmartThingsCommunity/staging
Rolling up staging to production
2017-05-16 14:37:45 -07:00
Vinay Rao
9b01a7d8be Merge pull request #2004 from SmartThingsCommunity/production
Rolling down production to staging
2017-05-16 14:37:15 -07:00
Vinay Rao
7cf8bb1917 Merge pull request #1998 from larsfinander/DVCSMP-2656_OpenT2T_Update_to_5_5_submission_staging
DVCSMP-2656 OpenT2T: Update to 5/15 submission
2017-05-15 12:31:34 -07:00
Lars Finander
d4fd778a64 DVCSMP-2656 OpenT2T: Update to 5/15 submission 2017-05-15 13:25:44 -06:00
Vinay Rao
d60657e466 Merge pull request #1992 from dkirker/production
PROB-1615: Add SYLVANIA Smart 10-Year A19 bulb fingerprint
2017-05-11 15:08:13 -07:00
Donald Kirker
d8dc70ae9e PROB-1615 Add SYLVANIA Smart 10-Year A19 bulb fingerprint 2017-05-11 14:03:24 -07:00
Vinay Rao
3457bbad42 Merge pull request #1991 from tslagle13/gideon-change
[MSA-1968] - Publish gideon smarthome changes
2017-05-11 11:12:30 -07:00
tslagle13
c6c4b09fbb [MSA-1968] - Publish gideon smarthome changes
small change to sensor readings
2017-05-11 11:06:44 -07:00
Vinay Rao
7e25d32c70 Merge pull request #1990 from SmartThingsCommunity/master
Rolling up master to staging
2017-05-09 16:04:19 -05:00
Vinay Rao
abc5683ed3 Merge pull request #1988 from SmartThingsCommunity/staging
Rolling up staging to production
2017-05-09 13:46:13 -05:00
4 changed files with 56 additions and 44 deletions

View File

@@ -25,6 +25,7 @@ metadata {
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008" fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart A19 Soft White" fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart A19 Soft White"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM 10 Year", deviceJoinName: "SYLVANIA Smart 10-Year A19"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FF00", outClusters: "0019", manufacturer: "MRVL", model: "MZ100", deviceJoinName: "Wemo Bulb" fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FF00", outClusters: "0019", manufacturer: "MRVL", model: "MZ100", deviceJoinName: "Wemo Bulb"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ" fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY PAR38 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart PAR38 Soft White" fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY PAR38 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart PAR38 Soft White"

View File

@@ -765,7 +765,6 @@ def turnOffSwitch() {
} else { } else {
device.off(); device.off();
return [Device_id: params.id, result_action: "200"] return [Device_id: params.id, result_action: "200"]
} }
} }
@@ -789,6 +788,7 @@ def getTempSensorsStatus(id) {
return [] return []
} else { } else {
def bat = getBatteryStatus(device.id) def bat = getBatteryStatus(device.id)
return [temperature: device.currentValue('temperature')] + bat def scale = [Scale: location.temperatureScale]
return [temperature: device.currentValue('temperature')] + bat + scale
} }
} }

View File

@@ -15,66 +15,66 @@ definition(
) )
preferences { preferences {
section("Light switches to turn off") { section("Light switches to turn off") {
input "switches", "capability.switch", title: "Choose light switches", multiple: true input "switches", "capability.switch", title: "Choose light switches", multiple: true
} }
section("Turn off when there is no motion and presence") { section("Turn off when there is no motion and presence") {
input "motionSensor", "capability.motionSensor", title: "Choose motion sensor" input "motionSensor", "capability.motionSensor", title: "Choose motion sensor"
input "presenceSensors", "capability.presenceSensor", title: "Choose presence sensors", multiple: true input "presenceSensors", "capability.presenceSensor", title: "Choose presence sensors", multiple: true
} }
section("Delay before turning off") { section("Delay before turning off") {
input "delayMins", "number", title: "Minutes of inactivity?" input "delayMins", "number", title: "Minutes of inactivity?"
} }
} }
def installed() { def installed() {
subscribe(motionSensor, "motion", motionHandler) subscribe(motionSensor, "motion", motionHandler)
subscribe(presenceSensors, "presence", presenceHandler) subscribe(presenceSensors, "presence", presenceHandler)
} }
def updated() { def updated() {
unsubscribe() unsubscribe()
subscribe(motionSensor, "motion", motionHandler) subscribe(motionSensor, "motion", motionHandler)
subscribe(presenceSensors, "presence", presenceHandler) subscribe(presenceSensors, "presence", presenceHandler)
} }
def motionHandler(evt) { def motionHandler(evt) {
log.debug "handler $evt.name: $evt.value" log.debug "handler $evt.name: $evt.value"
if (evt.value == "inactive") { if (evt.value == "inactive") {
runIn(delayMins * 60, scheduleCheck, [overwrite: true]) runIn(delayMins * 60, scheduleCheck, [overwrite: false])
} }
} }
def presenceHandler(evt) { def presenceHandler(evt) {
log.debug "handler $evt.name: $evt.value" log.debug "handler $evt.name: $evt.value"
if (evt.value == "not present") { if (evt.value == "not present") {
runIn(delayMins * 60, scheduleCheck, [overwrite: true]) runIn(delayMins * 60, scheduleCheck, [overwrite: false])
} }
} }
def isActivePresence() { def isActivePresence() {
// check all the presence sensors, make sure none are present // check all the presence sensors, make sure none are present
def noPresence = presenceSensors.find{it.currentPresence == "present"} == null def noPresence = presenceSensors.find{it.currentPresence == "present"} == null
!noPresence !noPresence
} }
def scheduleCheck() { def scheduleCheck() {
log.debug "scheduled check" log.debug "scheduled check"
def motionState = motionSensor.currentState("motion") def motionState = motionSensor.currentState("motion")
if (motionState.value == "inactive") { if (motionState.value == "inactive") {
def elapsed = now() - motionState.rawDateCreated.time def elapsed = now() - motionState.rawDateCreated.time
def threshold = 1000 * 60 * delayMins - 1000 def threshold = 1000 * 60 * delayMins - 1000
if (elapsed >= threshold) { if (elapsed >= threshold) {
if (!isActivePresence()) { if (!isActivePresence()) {
log.debug "Motion has stayed inactive since last check ($elapsed ms) and no presence: turning lights off" log.debug "Motion has stayed inactive since last check ($elapsed ms) and no presence: turning lights off"
switches.off() switches.off()
} else { } else {
log.debug "Presence is active: do nothing" log.debug "Presence is active: do nothing"
}
} else {
log.debug "Motion has not stayed inactive long enough since last check ($elapsed ms): do nothing"
} }
} else {
log.debug "Motion has not stayed inactive long enough since last check ($elapsed ms): do nothing"
}
} else { } else {
log.debug "Motion is active: do nothing" log.debug "Motion is active: do nothing"
} }
} }

View File

@@ -162,6 +162,17 @@ def registerAllDeviceSubscriptions() {
registerChangeHandler(inputs) registerChangeHandler(inputs)
} }
//Subscribe to events from a list of devices
def registerChangeHandler(myList) {
myList.each { myDevice ->
def theAtts = myDevice.supportedAttributes
theAtts.each { att ->
subscribe(myDevice, att.name, deviceEventHandler)
log.info "Registering for ${myDevice.displayName}.${att.name}"
}
}
}
//Endpoints function: Subscribe to events from a specific device //Endpoints function: Subscribe to events from a specific device
def registerDeviceChange() { def registerDeviceChange() {
def subscriptionEndpt = params.subscriptionURL def subscriptionEndpt = params.subscriptionURL