mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-25 13:04:10 +00:00
Compare commits
16 Commits
MSA-1817-1
...
PROD_2017.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a605373d6 | ||
|
|
90fb9251a6 | ||
|
|
195e0babb2 | ||
|
|
065715f296 | ||
|
|
10acb76b34 | ||
|
|
4fc046f57f | ||
|
|
ff2e70b011 | ||
|
|
79e2789f68 | ||
|
|
94a87e5c7f | ||
|
|
22be8ef2e8 | ||
|
|
2f20a339c3 | ||
|
|
ab79ceb857 | ||
|
|
2151e2dd3e | ||
|
|
bfd2b6c0fa | ||
|
|
fc312286a2 | ||
|
|
0846b6f34c |
@@ -9,7 +9,7 @@ apply plugin: 'smartthings-slack'
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.smartthings.deployment:executable-deployment-scripts:1.0.8"
|
classpath "com.smartthings.deployment:executable-deployment-scripts:1.0.11"
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ metadata {
|
|||||||
capability "Tamper Alert"
|
capability "Tamper Alert"
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Water Sensor"
|
capability "Water Sensor"
|
||||||
|
capability "Health Check"
|
||||||
|
|
||||||
fingerprint deviceId: "0x0701", inClusters: "0x5E, 0x22, 0x85, 0x59, 0x20, 0x80, 0x70, 0x56, 0x5A, 0x7A, 0x72, 0x8E, 0x71, 0x73, 0x98, 0x9C, 0x31, 0x86", outClusters: ""
|
fingerprint deviceId: "0x0701", inClusters: "0x5E, 0x22, 0x85, 0x59, 0x20, 0x80, 0x70, 0x56, 0x5A, 0x7A, 0x72, 0x8E, 0x71, 0x73, 0x98, 0x9C, 0x31, 0x86", outClusters: ""
|
||||||
}
|
}
|
||||||
@@ -228,6 +229,8 @@ def zwaveEvent(physicalgraph.zwave.commands.deviceresetlocallyv1.DeviceResetLoca
|
|||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
log.debug "Executing 'configure'"
|
log.debug "Executing 'configure'"
|
||||||
|
// Device-Watch simply pings if no device events received for 8 hrs & 2 minutes
|
||||||
|
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|
||||||
def cmds = []
|
def cmds = []
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ metadata {
|
|||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Tamper Alert"
|
capability "Tamper Alert"
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
|
capability "Health Check"
|
||||||
|
|
||||||
fingerprint deviceId: "0x0701", inClusters: "0x5E, 0x20, 0x86, 0x72, 0x5A, 0x59, 0x85, 0x73, 0x84, 0x80, 0x71, 0x56, 0x70, 0x31, 0x8E, 0x22, 0x30, 0x9C, 0x98, 0x7A", outClusters: ""
|
fingerprint deviceId: "0x0701", inClusters: "0x5E, 0x20, 0x86, 0x72, 0x5A, 0x59, 0x85, 0x73, 0x84, 0x80, 0x71, 0x56, 0x70, 0x31, 0x8E, 0x22, 0x30, 0x9C, 0x98, 0x7A", outClusters: ""
|
||||||
}
|
}
|
||||||
@@ -240,6 +241,8 @@ def zwaveEvent(physicalgraph.zwave.commands.deviceresetlocallyv1.DeviceResetLoca
|
|||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
log.debug "Executing 'configure'"
|
log.debug "Executing 'configure'"
|
||||||
|
// Device-Watch simply pings if no device events received for 8 hrs & 2 minutes
|
||||||
|
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|
||||||
def cmds = []
|
def cmds = []
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ metadata {
|
|||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
|
capability "Health Check"
|
||||||
|
|
||||||
command "resetParams2StDefaults"
|
command "resetParams2StDefaults"
|
||||||
command "listCurrentParams"
|
command "listCurrentParams"
|
||||||
@@ -304,6 +305,9 @@ def lateConfigure(setConf = False) {
|
|||||||
*/
|
*/
|
||||||
def configure() {
|
def configure() {
|
||||||
log.debug "Configuring Device..."
|
log.debug "Configuring Device..."
|
||||||
|
// Device-Watch simply pings if no device events received for 8 hrs & 2 minutes
|
||||||
|
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|
||||||
def cmds = []
|
def cmds = []
|
||||||
|
|
||||||
// send associate to group 2 to get alarm data
|
// send associate to group 2 to get alarm data
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
capability "Illuminance Measurement"
|
capability "Illuminance Measurement"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
|
capability "Health Check"
|
||||||
|
|
||||||
command "resetParams2StDefaults"
|
command "resetParams2StDefaults"
|
||||||
command "listCurrentParams"
|
command "listCurrentParams"
|
||||||
@@ -125,6 +126,9 @@
|
|||||||
*/
|
*/
|
||||||
def configure() {
|
def configure() {
|
||||||
log.debug "Configuring Device For SmartThings Use"
|
log.debug "Configuring Device For SmartThings Use"
|
||||||
|
// Device-Watch simply pings if no device events received for 8 hrs & 2 minutes
|
||||||
|
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|
||||||
def cmds = []
|
def cmds = []
|
||||||
|
|
||||||
// send associate to group 3 to get sensor data reported only to hub
|
// send associate to group 3 to get sensor data reported only to hub
|
||||||
|
|||||||
@@ -81,38 +81,32 @@ def getInputs() {
|
|||||||
//API external Endpoints
|
//API external Endpoints
|
||||||
mappings {
|
mappings {
|
||||||
path("/subscriptionURL/:url") {
|
path("/subscriptionURL/:url") {
|
||||||
action:
|
action: [
|
||||||
[
|
|
||||||
PUT: "updateEndpointURL"
|
PUT: "updateEndpointURL"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/connectionId/:connId") {
|
path("/connectionId/:connId") {
|
||||||
action:
|
action: [
|
||||||
[
|
|
||||||
PUT: "updateConnectionId"
|
PUT: "updateConnectionId"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/devices") {
|
path("/devices") {
|
||||||
action:
|
action: [
|
||||||
[
|
|
||||||
GET: "getDevices"
|
GET: "getDevices"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/devices/:id") {
|
path("/devices/:id") {
|
||||||
action:
|
action: [
|
||||||
[
|
|
||||||
GET: "getDevice"
|
GET: "getDevice"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/update/:id") {
|
path("/update/:id") {
|
||||||
action:
|
action: [
|
||||||
[
|
|
||||||
PUT: "updateDevice"
|
PUT: "updateDevice"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
path("/subscription/:id") {
|
path("/subscription/:id") {
|
||||||
action:
|
action: [
|
||||||
[
|
|
||||||
POST: "registerDeviceChange",
|
POST: "registerDeviceChange",
|
||||||
DELETE: "unregisterDeviceChange"
|
DELETE: "unregisterDeviceChange"
|
||||||
]
|
]
|
||||||
@@ -186,16 +180,20 @@ def eventHandler(evt) {
|
|||||||
def evt_name = evt.name
|
def evt_name = evt.name
|
||||||
def evt_device = evt.device
|
def evt_device = evt.device
|
||||||
def evt_deviceType = getDeviceType(evt_device);
|
def evt_deviceType = getDeviceType(evt_device);
|
||||||
|
def deviceInfo
|
||||||
|
|
||||||
|
if(evt_deviceType == "thermostat")
|
||||||
|
{
|
||||||
|
deviceInfo = [name: evt_device.displayName, id: evt_device.id, status:evt_device.getStatus(), deviceType:evt_deviceType, manufacturer:evt_device.getManufacturerName(), model:evt_device.getModelName(), attributes: deviceAttributeList(evt_device), locationMode: getLocationModeInfo()]
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deviceInfo = [name: evt_device.displayName, id: evt_device.id, status:evt_device.getStatus(), deviceType:evt_deviceType, manufacturer:evt_device.getManufacturerName(), model:evt_device.getModelName(), attributes: deviceAttributeList(evt_device)]
|
||||||
|
}
|
||||||
|
|
||||||
def params = [
|
def params = [
|
||||||
uri: "${state.endpointURL}/${state.connectionId}",
|
uri: "${state.endpointURL}/${state.connectionId}",
|
||||||
body: [
|
body: [ deviceInfo ]
|
||||||
name : evt_device.displayName,
|
|
||||||
id : evt_device.id,
|
|
||||||
deviceType : evt_deviceType,
|
|
||||||
manufacturer: evt_device.getManufacturerName(),
|
|
||||||
model : evt_device.getModelName(),
|
|
||||||
attributes : deviceAttributeList(evt_device)
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
try {
|
try {
|
||||||
log.trace "POST URI: ${params.uri}"
|
log.trace "POST URI: ${params.uri}"
|
||||||
@@ -230,10 +228,13 @@ def getDevices() {
|
|||||||
def deviceData = []
|
def deviceData = []
|
||||||
inputs?.each {
|
inputs?.each {
|
||||||
def deviceType = getDeviceType(it)
|
def deviceType = getDeviceType(it)
|
||||||
if (deviceType == "thermostat") {
|
if(deviceType == "thermostat")
|
||||||
deviceData << [name: it.displayName, id: it.id, deviceType: deviceType, manufacturer: it.getManufacturerName(), model: it.getModelName(), attributes: deviceAttributeList(it), locationMode: getLocationModeInfo()]
|
{
|
||||||
} else {
|
deviceData << [name: it.displayName, id: it.id, status:it.getStatus(), deviceType:deviceType, manufacturer:it.getManufacturerName(), model:it.getModelName(), attributes: deviceAttributeList(it), locationMode: getLocationModeInfo()]
|
||||||
deviceData << [name: it.displayName, id: it.id, deviceType: deviceType, manufacturer: it.getManufacturerName(), model: it.getModelName(), attributes: deviceAttributeList(it)]
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deviceData << [name: it.displayName, id: it.id, status:it.getStatus(), deviceType:deviceType, manufacturer:it.getManufacturerName(), model:it.getModelName(), attributes: deviceAttributeList(it)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,10 +247,13 @@ def getDevice() {
|
|||||||
def it = findDevice(params.id)
|
def it = findDevice(params.id)
|
||||||
def deviceType = getDeviceType(it)
|
def deviceType = getDeviceType(it)
|
||||||
def device
|
def device
|
||||||
if (deviceType == "thermostat") {
|
if(deviceType == "thermostat")
|
||||||
device = [name: it.displayName, id: it.id, deviceType: deviceType, manufacturer: it.getManufacturerName(), model: it.getModelName(), attributes: deviceAttributeList(it), locationMode: getLocationModeInfo()]
|
{
|
||||||
} else {
|
device = [name: it.displayName, id: it.id, status:it.getStatus(), deviceType:deviceType, manufacturer:it.getManufacturerName(), model:it.getModelName(), attributes: deviceAttributeList(it), locationMode: getLocationModeInfo()]
|
||||||
device = [name: it.displayName, id: it.id, deviceType: deviceType, manufacturer: it.getManufacturerName(), model: it.getModelName(), attributes: deviceAttributeList(it)]
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
device = [name: it.displayName, id: it.id, status:it.getStatus(), deviceType:deviceType, manufacturer:it.getManufacturerName(), model:it.getModelName(), attributes: deviceAttributeList(it)]
|
||||||
}
|
}
|
||||||
log.debug "getDevice, return: ${device}"
|
log.debug "getDevice, return: ${device}"
|
||||||
return device
|
return device
|
||||||
@@ -322,20 +326,29 @@ private getLocationModeInfo() {
|
|||||||
//Map each device to a type given it's capabilities
|
//Map each device to a type given it's capabilities
|
||||||
private getDeviceType(device) {
|
private getDeviceType(device) {
|
||||||
def deviceType
|
def deviceType
|
||||||
def caps = device.capabilities
|
def capabilities = device.capabilities
|
||||||
log.debug "capabilities: [${device}, ${caps}]"
|
log.debug "capabilities: [${device}, ${capabilities}]"
|
||||||
log.debug "supported commands: [${device}, ${device.supportedCommands}]"
|
log.debug "supported commands: [${device}, ${device.supportedCommands}]"
|
||||||
caps.each {
|
|
||||||
switch (it.name.toLowerCase()) {
|
//Loop through the device capability list to determine the device type.
|
||||||
|
capabilities.each {capability ->
|
||||||
|
switch(capability.name.toLowerCase())
|
||||||
|
{
|
||||||
case "switch":
|
case "switch":
|
||||||
deviceType = "switch"
|
deviceType = "switch"
|
||||||
if (caps.any { it.name.toLowerCase() == "power meter" }) {
|
|
||||||
|
//If the device also contains "Switch Level" capability, identify it as a "light" device.
|
||||||
|
if (capabilities.any{it.name.toLowerCase() == "switch level"}){
|
||||||
|
|
||||||
|
//If the device also contains "Power Meter" capability, identify it as a "dimmerSwitch" device.
|
||||||
|
if (capabilities.any{it.name.toLowerCase() == "power meter"}){
|
||||||
|
deviceType = "dimmerSwitch"
|
||||||
return deviceType
|
return deviceType
|
||||||
}
|
} else {
|
||||||
if (caps.any { it.name.toLowerCase() == "switch level" }) {
|
|
||||||
deviceType = "light"
|
deviceType = "light"
|
||||||
return deviceType
|
return deviceType
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case "contact sensor":
|
case "contact sensor":
|
||||||
deviceType = "contactSensor"
|
deviceType = "contactSensor"
|
||||||
@@ -414,7 +427,7 @@ private mapDeviceCommands(command, value) {
|
|||||||
resultCommand = "setSaturation"
|
resultCommand = "setSaturation"
|
||||||
resultValue = value
|
resultValue = value
|
||||||
break
|
break
|
||||||
case "ct":
|
case "colorTemperature":
|
||||||
resultCommand = "setColorTemperature"
|
resultCommand = "setColorTemperature"
|
||||||
resultValue = value
|
resultValue = value
|
||||||
break
|
break
|
||||||
@@ -451,7 +464,8 @@ private mapDeviceCommands(command, value) {
|
|||||||
if (value == 1 || value == "1" || value == "lock") {
|
if (value == 1 || value == "1" || value == "lock") {
|
||||||
resultCommand = "lock"
|
resultCommand = "lock"
|
||||||
resultValue = ""
|
resultValue = ""
|
||||||
} else if (value == 0 || value == "0" || value == "unlock") {
|
}
|
||||||
|
else if (value == 0 || value == "0" || value == "unlock") {
|
||||||
resultCommand = "unlock"
|
resultCommand = "unlock"
|
||||||
resultValue = ""
|
resultValue = ""
|
||||||
}
|
}
|
||||||
@@ -462,4 +476,3 @@ private mapDeviceCommands(command, value) {
|
|||||||
|
|
||||||
return [resultCommand,resultValue]
|
return [resultCommand,resultValue]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user