mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-21 05:10:50 +00:00
Compare commits
1 Commits
PROD_2017.
...
MSA-2068-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c562f4081 |
@@ -158,7 +158,7 @@ def generateEvent(Map results) {
|
|||||||
if(results) {
|
if(results) {
|
||||||
|
|
||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
def supportedThermostatModes = ["off"]
|
def supportedThermostatModes = []
|
||||||
def thermostatMode = null
|
def thermostatMode = null
|
||||||
|
|
||||||
results.each { name, value ->
|
results.each { name, value ->
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ Works with:
|
|||||||
|
|
||||||
## Device Health
|
## Device Health
|
||||||
|
|
||||||
ZigBee Button is marked offline only in the case when Hub is offline.
|
SmartThings platform will ping the device after `checkInterval` seconds of inactivity in last attempt to reach the device before marking it `OFFLINE`
|
||||||
|
|
||||||
|
* __722min__ checkInterval
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
* for the specific language governing permissions and limitations under the License.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import groovy.json.JsonOutput
|
|
||||||
import physicalgraph.zigbee.zcl.DataType
|
import physicalgraph.zigbee.zcl.DataType
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
@@ -185,6 +183,13 @@ private Map parseNonIasButtonMessage(Map descMap){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
|
* */
|
||||||
|
def ping() {
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "Refreshing Battery"
|
log.debug "Refreshing Battery"
|
||||||
|
|
||||||
@@ -193,6 +198,8 @@ def refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
|
// Device-Watch allows 2 check-in misses from device (plus 2 mins lag time)
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 6 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
log.debug "Configuring Reporting, IAS CIE, and Bindings."
|
log.debug "Configuring Reporting, IAS CIE, and Bindings."
|
||||||
def cmds = []
|
def cmds = []
|
||||||
if (device.getDataValue("model") == "3450-L") {
|
if (device.getDataValue("model") == "3450-L") {
|
||||||
@@ -252,8 +259,6 @@ def updated() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def initialize() {
|
def initialize() {
|
||||||
// Arrival sensors only goes OFFLINE when Hub is off
|
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: JsonOutput.toJson([protocol: "zigbee", scheme:"untracked"]), displayed: false)
|
|
||||||
if ((device.getDataValue("manufacturer") == "OSRAM") && (device.getDataValue("model") == "LIGHTIFY Dimming Switch")) {
|
if ((device.getDataValue("manufacturer") == "OSRAM") && (device.getDataValue("model") == "LIGHTIFY Dimming Switch")) {
|
||||||
sendEvent(name: "numberOfButtons", value: 2)
|
sendEvent(name: "numberOfButtons", value: 2)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ metadata {
|
|||||||
def installed() {
|
def installed() {
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
||||||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
response(refresh())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
|||||||
89
smartapps/nanoheal/nanoheal-iot.src/nanoheal-iot.groovy
Normal file
89
smartapps/nanoheal/nanoheal-iot.src/nanoheal-iot.groovy
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* Nanoheal_IoT
|
||||||
|
*
|
||||||
|
* Copyright 2017 ashoka
|
||||||
|
*
|
||||||
|
* 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: "Nanoheal_IoT",
|
||||||
|
namespace: "nanoheal",
|
||||||
|
author: "ashoka",
|
||||||
|
description: "Control IoT Devices.",
|
||||||
|
category: "Fun & Social",
|
||||||
|
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("Allow external service to control these things...") {
|
||||||
|
input "switches", "capability.switch", multiple: true, required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
|
||||||
|
mappings {
|
||||||
|
path("/switches") {
|
||||||
|
action: [
|
||||||
|
GET: "listSwitches"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/switches/:command") {
|
||||||
|
action: [
|
||||||
|
PUT: "updateSwitches"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def listSwitches() {
|
||||||
|
def resp = []
|
||||||
|
switches.each {
|
||||||
|
resp << [name: it.displayName, value: it.currentValue("switch")]
|
||||||
|
}
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateSwitches() {
|
||||||
|
// use the built-in request object to get the command parameter
|
||||||
|
def command = params.command
|
||||||
|
|
||||||
|
// all switches have the command
|
||||||
|
// execute the command on all switches
|
||||||
|
// (note we can do this on the array - the command will be invoked on every element
|
||||||
|
switch(command) {
|
||||||
|
case "on":
|
||||||
|
switches.on()
|
||||||
|
break
|
||||||
|
case "off":
|
||||||
|
switches.off()
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
httpError(400, "$command is not a valid command for all switches specified")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: implement event handlers
|
||||||
Reference in New Issue
Block a user