mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-18 05:10:52 +00:00
Compare commits
13 Commits
PROD_2017.
...
MSA-2104-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5beae1d9fc | ||
|
|
e5738978b0 | ||
|
|
07064eb8cc | ||
|
|
f519a2d828 | ||
|
|
4da49283bf | ||
|
|
7389edf795 | ||
|
|
23154372d2 | ||
|
|
1b0437c633 | ||
|
|
b3d9578140 | ||
|
|
7549979be5 | ||
|
|
f647be3a62 | ||
|
|
2536c69083 | ||
|
|
45663ffb86 |
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Spruce Sensor -Pre-release V2 10/8/2015
|
* Spruce Sensor -updated with SLP model number 5/2017
|
||||||
*
|
*
|
||||||
* Copyright 2014 Plaid Systems
|
* Copyright 2014 Plaid Systems
|
||||||
*
|
*
|
||||||
@@ -14,25 +14,33 @@
|
|||||||
*
|
*
|
||||||
-------10/20/2015 Updates--------
|
-------10/20/2015 Updates--------
|
||||||
-Fix/add battery reporting interval to update
|
-Fix/add battery reporting interval to update
|
||||||
-remove polling and/or refresh(?)
|
-remove polling and/or refresh
|
||||||
|
|
||||||
|
-------5/2017 Updates--------
|
||||||
|
-Add fingerprints for SLP
|
||||||
|
-add device health, check every 60mins + 2mins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Spruce Sensor", namespace: "plaidsystems", author: "NCauffman") {
|
definition (name: "Spruce Sensor", namespace: "plaidsystems", author: "Plaid Systems") {
|
||||||
|
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Relative Humidity Measurement"
|
capability "Relative Humidity Measurement"
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
capability "Health Check"
|
||||||
//capability "Polling"
|
//capability "Polling"
|
||||||
|
|
||||||
attribute "maxHum", "string"
|
attribute "maxHum", "string"
|
||||||
attribute "minHum", "string"
|
attribute "minHum", "string"
|
||||||
|
|
||||||
|
|
||||||
command "resetHumidity"
|
command "resetHumidity"
|
||||||
command "refresh"
|
command "refresh"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0402,0405", outClusters: "0003, 0019", manufacturer: "PLAID SYSTEMS", model: "PS-SPRZMS-01"
|
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0402,0405", outClusters: "0003, 0019", manufacturer: "PLAID SYSTEMS", model: "PS-SPRZMS-01", deviceJoinName: "Spruce Sensor"
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0402,0405", outClusters: "0003, 0019", manufacturer: "PLAID SYSTEMS", model: "PS-SPRZMS-SLP1", deviceJoinName: "Spruce Sensor"
|
||||||
}
|
}
|
||||||
|
|
||||||
preferences {
|
preferences {
|
||||||
@@ -293,6 +301,11 @@ def setConfig(){
|
|||||||
sendEvent(name: 'configuration',value: configInterval, descriptionText: "Configuration initialized")
|
sendEvent(name: 'configuration',value: configInterval, descriptionText: "Configuration initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed(){
|
||||||
|
//check every 1 hour + 2mins
|
||||||
|
sendEvent(name: "checkInterval", value: 1 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
|
}
|
||||||
|
|
||||||
//when device preferences are changed
|
//when device preferences are changed
|
||||||
def updated(){
|
def updated(){
|
||||||
log.debug "device updated"
|
log.debug "device updated"
|
||||||
@@ -303,6 +316,8 @@ def updated(){
|
|||||||
sendEvent(name: 'configuration',value: 0, descriptionText: "Settings changed and will update at next report. Measure interval set to ${interval} mins")
|
sendEvent(name: 'configuration',value: 0, descriptionText: "Settings changed and will update at next report. Measure interval set to ${interval} mins")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//check every 1 hour + 2mins
|
||||||
|
sendEvent(name: "checkInterval", value: 1 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
|
|
||||||
//poll
|
//poll
|
||||||
@@ -395,4 +410,4 @@ private byte[] reverseArray(byte[] array) {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ def parse(String description) {
|
|||||||
} else {
|
} else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
|
||||||
}
|
}
|
||||||
|
} else if (descMap?.clusterInt == zigbee.IAS_ZONE_CLUSTER && descMap.attrInt == zigbee.ATTRIBUTE_IAS_ZONE_STATUS && descMap?.value) {
|
||||||
|
map = translateZoneStatus(new ZoneStatus(zigbee.convertToInt(descMap?.value)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (map.name == "temperature") {
|
} else if (map.name == "temperature") {
|
||||||
@@ -129,6 +131,10 @@ def parse(String description) {
|
|||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
|
|
||||||
|
translateZoneStatus(zs)
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map translateZoneStatus(ZoneStatus zs) {
|
||||||
return zs.isAlarm1Set() ? getMoistureResult('wet') : getMoistureResult('dry')
|
return zs.isAlarm1Set() ? getMoistureResult('wet') : getMoistureResult('dry')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +203,8 @@ def ping() {
|
|||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "Refreshing Temperature and Battery"
|
log.debug "Refreshing Temperature and Battery"
|
||||||
def refreshCmds = zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000) +
|
def refreshCmds = zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000) +
|
||||||
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020)
|
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
|
||||||
|
zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS)
|
||||||
|
|
||||||
return refreshCmds + zigbee.enrollResponse()
|
return refreshCmds + zigbee.enrollResponse()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ def parse(String description) {
|
|||||||
def value = descMap.value.endsWith("01") ? "active" : "inactive"
|
def value = descMap.value.endsWith("01") ? "active" : "inactive"
|
||||||
log.debug "Doing a read attr motion event"
|
log.debug "Doing a read attr motion event"
|
||||||
map = getMotionResult(value)
|
map = getMotionResult(value)
|
||||||
|
} else if (descMap?.clusterInt == zigbee.IAS_ZONE_CLUSTER && descMap.attrInt == zigbee.ATTRIBUTE_IAS_ZONE_STATUS && descMap?.value) {
|
||||||
|
map = translateZoneStatus(new ZoneStatus(zigbee.convertToInt(descMap?.value)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (map.name == "temperature") {
|
} else if (map.name == "temperature") {
|
||||||
@@ -135,6 +137,10 @@ def parse(String description) {
|
|||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
|
|
||||||
|
translateZoneStatus(zs)
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map translateZoneStatus(ZoneStatus zs) {
|
||||||
// Some sensor models that use this DTH use alarm1 and some use alarm2 to signify motion
|
// Some sensor models that use this DTH use alarm1 and some use alarm2 to signify motion
|
||||||
return (zs.isAlarm1Set() || zs.isAlarm2Set()) ? getMotionResult('active') : getMotionResult('inactive')
|
return (zs.isAlarm1Set() || zs.isAlarm2Set()) ? getMotionResult('active') : getMotionResult('inactive')
|
||||||
}
|
}
|
||||||
@@ -200,7 +206,8 @@ def refresh() {
|
|||||||
log.debug "refresh called"
|
log.debug "refresh called"
|
||||||
|
|
||||||
def refreshCmds = zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
|
def refreshCmds = zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
|
||||||
zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000)
|
zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000) +
|
||||||
|
zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS)
|
||||||
|
|
||||||
return refreshCmds + zigbee.enrollResponse()
|
return refreshCmds + zigbee.enrollResponse()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,8 +134,9 @@ def parse(String description) {
|
|||||||
} else {
|
} else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
|
||||||
}
|
}
|
||||||
|
} else if (descMap?.clusterInt == zigbee.IAS_ZONE_CLUSTER && descMap.attrInt == zigbee.ATTRIBUTE_IAS_ZONE_STATUS && descMap?.value) {
|
||||||
|
maps += translateZoneStatus(new ZoneStatus(zigbee.convertToInt(descMap?.value)))
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
maps += handleAcceleration(descMap)
|
maps += handleAcceleration(descMap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,6 +230,11 @@ private List<Map> parseAxis(List<Map> attrData) {
|
|||||||
|
|
||||||
private List<Map> parseIasMessage(String description) {
|
private List<Map> parseIasMessage(String description) {
|
||||||
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
|
|
||||||
|
translateZoneStatus(zs)
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Map> translateZoneStatus(ZoneStatus zs) {
|
||||||
List<Map> results = []
|
List<Map> results = []
|
||||||
|
|
||||||
if (garageSensor != "Yes") {
|
if (garageSensor != "Yes") {
|
||||||
@@ -313,7 +319,7 @@ def refresh() {
|
|||||||
def refreshCmds = zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000) +
|
def refreshCmds = zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000) +
|
||||||
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
|
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
|
||||||
zigbee.readAttribute(0xFC02, 0x0010, [mfgCode: manufacturerCode]) +
|
zigbee.readAttribute(0xFC02, 0x0010, [mfgCode: manufacturerCode]) +
|
||||||
zigbee.enrollResponse()
|
zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS) + zigbee.enrollResponse()
|
||||||
|
|
||||||
return refreshCmds
|
return refreshCmds
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ definition(
|
|||||||
|
|
||||||
preferences {
|
preferences {
|
||||||
page(name: "selectButton")
|
page(name: "selectButton")
|
||||||
page(name: "configureButton1")
|
for (def i=1; i<=8; i++) {
|
||||||
page(name: "configureButton2")
|
page(name: "configureButton$i")
|
||||||
page(name: "configureButton3")
|
}
|
||||||
page(name: "configureButton4")
|
|
||||||
|
|
||||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||||
section {
|
section {
|
||||||
@@ -60,22 +59,45 @@ def selectButton() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def createPage(pageNum) {
|
||||||
|
if ((state.numButton == pageNum) || (pageNum == 8))
|
||||||
|
state.installCondition = true
|
||||||
|
dynamicPage(name: "configureButton$pageNum", title: "Set up button $pageNum here",
|
||||||
|
nextPage: "configureButton${pageNum+1}", install: state.installCondition, uninstall: configured(), getButtonSections(pageNum))
|
||||||
|
}
|
||||||
|
|
||||||
def configureButton1() {
|
def configureButton1() {
|
||||||
dynamicPage(name: "configureButton1", title: "Now let's decide how to use the first button",
|
state.numButton = buttonDevice.currentState("numberOfButtons")?.longValue ?: 4
|
||||||
nextPage: "configureButton2", uninstall: configured(), getButtonSections(1))
|
log.debug "state variable numButton: ${state.numButton}"
|
||||||
|
state.installCondition = false
|
||||||
|
createPage(1)
|
||||||
}
|
}
|
||||||
def configureButton2() {
|
def configureButton2() {
|
||||||
dynamicPage(name: "configureButton2", title: "If you have a second button, set it up here",
|
createPage(2)
|
||||||
nextPage: "configureButton3", uninstall: configured(), getButtonSections(2))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def configureButton3() {
|
def configureButton3() {
|
||||||
dynamicPage(name: "configureButton3", title: "If you have a third button, you can do even more here",
|
createPage(3)
|
||||||
nextPage: "configureButton4", uninstall: configured(), getButtonSections(3))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def configureButton4() {
|
def configureButton4() {
|
||||||
dynamicPage(name: "configureButton4", title: "If you have a fourth button, you rule, and can set it up here",
|
createPage(4)
|
||||||
install: true, uninstall: true, getButtonSections(4))
|
}
|
||||||
|
|
||||||
|
def configureButton5() {
|
||||||
|
createPage(5)
|
||||||
|
}
|
||||||
|
|
||||||
|
def configureButton6() {
|
||||||
|
createPage(6)
|
||||||
|
}
|
||||||
|
|
||||||
|
def configureButton7() {
|
||||||
|
createPage(7)
|
||||||
|
}
|
||||||
|
|
||||||
|
def configureButton8() {
|
||||||
|
createPage(8)
|
||||||
}
|
}
|
||||||
|
|
||||||
def getButtonSections(buttonNumber) {
|
def getButtonSections(buttonNumber) {
|
||||||
|
|||||||
@@ -202,7 +202,8 @@ def inputSelectionPage() {
|
|||||||
|
|
||||||
section("options variations") {
|
section("options variations") {
|
||||||
paragraph "tap these elements and look at the differences when selecting an option"
|
paragraph "tap these elements and look at the differences when selecting an option"
|
||||||
input(type: "enum", name: "selectionSimple", title: "Simple options", description: "no separators in the selectable options", groupedOptions: addGroup(englishOptions + spanishOptions))
|
input(type: "enum", name: "selectionSimple", title: "Simple options", description: "no separators in the selectable options", options: ["Thing 1", "Thing 2", "(Complicated) Thing 3"])
|
||||||
|
input(type: "enum", name: "selectionSimpleGrouped", title: "Simple (Grouped) options", description: "no separators in the selectable options", groupedOptions: addGroup(englishOptions + spanishOptions))
|
||||||
input(type: "enum", name: "selectionGrouped", title: "Grouped options", description: "separate groups of options with headers", groupedOptions: groupedOptions)
|
input(type: "enum", name: "selectionGrouped", title: "Grouped options", description: "separate groups of options with headers", groupedOptions: groupedOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,15 +215,15 @@ def inputSelectionPage() {
|
|||||||
|
|
||||||
section("segmented") {
|
section("segmented") {
|
||||||
paragraph "segmented should only work if there are either 2 or 3 options to choose from"
|
paragraph "segmented should only work if there are either 2 or 3 options to choose from"
|
||||||
input(type: "enum", name: "selectionSegmented1", style: "segmented", title: "1 option", groupedOptions: addGroup(["One"]))
|
input(type: "enum", name: "selectionSegmented1", style: "segmented", title: "1 option", options: ["One"])
|
||||||
input(type: "enum", name: "selectionSegmented4", style: "segmented", title: "4 options", groupedOptions: addGroup(["One", "Two", "Three", "Four"]))
|
input(type: "enum", name: "selectionSegmented4", style: "segmented", title: "4 options", options: ["One", "Two", "Three", "Four"])
|
||||||
|
|
||||||
paragraph "multiple and required will have no effect on segmented selection elements. There will always be exactly 1 option selected"
|
paragraph "multiple and required will have no effect on segmented selection elements. There will always be exactly 1 option selected"
|
||||||
input(type: "enum", name: "selectionSegmented2", style: "segmented", title: "2 options", options: ["One", "Two"])
|
input(type: "enum", name: "selectionSegmented2", style: "segmented", title: "2 options", options: ["One", "Two"])
|
||||||
input(type: "enum", name: "selectionSegmented3", style: "segmented", title: "3 options", options: ["One", "Two", "Three"])
|
input(type: "enum", name: "selectionSegmented3", style: "segmented", title: "3 options", options: ["One", "Two", "Three"])
|
||||||
|
|
||||||
paragraph "specifying defaultValue still works with segmented selection elements"
|
paragraph "specifying defaultValue still works with segmented selection elements"
|
||||||
input(type: "enum", name: "selectionSegmentedWithDefault", title: "defaulted to 'two'", groupedOptions: addGroup(["One", "Two", "Three"]), defaultValue: "Two")
|
input(type: "enum", name: "selectionSegmentedWithDefault", style: "segmented", title: "defaulted to 'two'", options: ["One", "Two", "Three"], defaultValue: "Two")
|
||||||
}
|
}
|
||||||
|
|
||||||
section("required: true") {
|
section("required: true") {
|
||||||
@@ -231,6 +232,8 @@ def inputSelectionPage() {
|
|||||||
|
|
||||||
section("multiple: true") {
|
section("multiple: true") {
|
||||||
input(type: "enum", name: "selectionMultiple", title: "This allows multiple selections", description: "It should look different when nothing is selected", groupedOptions: addGroup(["an option", "another option", "no way, one more?"]), multiple: true)
|
input(type: "enum", name: "selectionMultiple", title: "This allows multiple selections", description: "It should look different when nothing is selected", groupedOptions: addGroup(["an option", "another option", "no way, one more?"]), multiple: true)
|
||||||
|
input(type: "enum", name: "selectionMultipleDefault1", title: "This allows multiple selections with a single default", description: "It should look different when nothing is selected", groupedOptions: addGroup(["an option", "another option", "no way, one more?"]), multiple: true, defaultValue: "an option")
|
||||||
|
input(type: "enum", name: "selectionMultipleDefault2", title: "This allows multiple selections with multiple defaults", description: "It should look different when nothing is selected", groupedOptions: addGroup(["an option", "another option", "no way, one more?"]), multiple: true, defaultValue: ["an option", "another option"])
|
||||||
}
|
}
|
||||||
|
|
||||||
section("with image") {
|
section("with image") {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ def authPage() {
|
|||||||
log.debug "have LIFX access token"
|
log.debug "have LIFX access token"
|
||||||
|
|
||||||
def options = locationOptions() ?: []
|
def options = locationOptions() ?: []
|
||||||
def count = options.size()
|
def count = options.size().toString()
|
||||||
|
|
||||||
return dynamicPage(name:"Credentials", title:"", nextPage:"", install:true, uninstall: true) {
|
return dynamicPage(name:"Credentials", title:"", nextPage:"", install:true, uninstall: true) {
|
||||||
section("Select your location") {
|
section("Select your location") {
|
||||||
|
|||||||
Reference in New Issue
Block a user