mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
[CHF-201] Removing DTH workaround now that all events go to Kafka
This commit is contained in:
@@ -67,12 +67,6 @@ def parse(String description) {
|
|||||||
def resultMap = zigbee.getEvent(description)
|
def resultMap = zigbee.getEvent(description)
|
||||||
if (resultMap) {
|
if (resultMap) {
|
||||||
sendEvent(resultMap)
|
sendEvent(resultMap)
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.debug "DID NOT PARSE MESSAGE for description : $description"
|
log.debug "DID NOT PARSE MESSAGE for description : $description"
|
||||||
@@ -96,15 +90,7 @@ def setLevel(value) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.levelRefresh()
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.levelRefresh()
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -101,12 +101,6 @@ def parse(String description) {
|
|||||||
else {
|
else {
|
||||||
def descriptionText = finalResult.value == "on" ? '{{ device.displayName }} is On' : '{{ device.displayName }} is Off'
|
def descriptionText = finalResult.value == "on" ? '{{ device.displayName }} is On' : '{{ device.displayName }} is Off'
|
||||||
sendEvent(name: finalResult.type, value: finalResult.value, descriptionText: descriptionText, translatable: true)
|
sendEvent(name: finalResult.type, value: finalResult.value, descriptionText: descriptionText, translatable: true)
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -126,15 +120,7 @@ def on() {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.onOffRefresh()
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.onOffRefresh()
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -101,13 +101,6 @@ def parse(String description) {
|
|||||||
map = parseIasMessage(description)
|
map = parseIasMessage(description)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
def result = map ? createEvent(map) : null
|
def result = map ? createEvent(map) : null
|
||||||
|
|
||||||
@@ -285,15 +278,7 @@ private Map getMoistureResult(value) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -105,13 +105,6 @@ def parse(String description) {
|
|||||||
map = parseIasMessage(description)
|
map = parseIasMessage(description)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
def result = map ? createEvent(map) : null
|
def result = map ? createEvent(map) : null
|
||||||
|
|
||||||
@@ -296,15 +289,7 @@ private Map getMotionResult(value) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -127,13 +127,6 @@ def parse(String description) {
|
|||||||
map = parseIasMessage(description)
|
map = parseIasMessage(description)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
|
|
||||||
def result = map ? createEvent(map) : null
|
def result = map ? createEvent(map) : null
|
||||||
|
|
||||||
if (description?.startsWith('enroll request')) {
|
if (description?.startsWith('enroll request')) {
|
||||||
@@ -378,15 +371,7 @@ private getAccelerationResult(numValue) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -92,13 +92,6 @@ def parse(String description) {
|
|||||||
map = parseIasMessage(description)
|
map = parseIasMessage(description)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
def result = map ? createEvent(map) : null
|
def result = map ? createEvent(map) : null
|
||||||
|
|
||||||
@@ -248,15 +241,7 @@ private Map getContactResult(value) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -83,13 +83,6 @@ def parse(String description) {
|
|||||||
map = parseCustomMessage(description)
|
map = parseCustomMessage(description)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
return map ? createEvent(map) : null
|
return map ? createEvent(map) : null
|
||||||
}
|
}
|
||||||
@@ -253,14 +246,7 @@ private Map getHumidityResult(value) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh()
|
def refresh()
|
||||||
|
|||||||
@@ -54,12 +54,6 @@ def parse(String description) {
|
|||||||
|
|
||||||
def event = zigbee.getEvent(description)
|
def event = zigbee.getEvent(description)
|
||||||
if (event) {
|
if (event) {
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
if (event.name=="level" && event.value==0) {}
|
if (event.name=="level" && event.value==0) {}
|
||||||
else {
|
else {
|
||||||
sendEvent(event)
|
sendEvent(event)
|
||||||
@@ -86,15 +80,7 @@ def setLevel(value) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.onOffRefresh()
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.onOffRefresh()
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -85,12 +85,6 @@ def parse(String description) {
|
|||||||
def event = zigbee.getEvent(description)
|
def event = zigbee.getEvent(description)
|
||||||
if (event) {
|
if (event) {
|
||||||
log.debug event
|
log.debug event
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
if (event.name=="level" && event.value==0) {}
|
if (event.name=="level" && event.value==0) {}
|
||||||
else {
|
else {
|
||||||
if (event.name=="colorTemperature") {
|
if (event.name=="colorTemperature") {
|
||||||
@@ -130,15 +124,7 @@ def off() {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.onOffRefresh()
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.onOffRefresh()
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
@@ -74,12 +74,6 @@ def parse(String description) {
|
|||||||
log.debug "description is $description"
|
log.debug "description is $description"
|
||||||
def event = zigbee.getEvent(description)
|
def event = zigbee.getEvent(description)
|
||||||
if (event) {
|
if (event) {
|
||||||
// Temporary fix for the case when Device is OFFLINE and is connected again
|
|
||||||
if (state.lastActivity == null){
|
|
||||||
state.lastActivity = now()
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
state.lastActivity = now()
|
|
||||||
if (event.name=="level" && event.value==0) {}
|
if (event.name=="level" && event.value==0) {}
|
||||||
else {
|
else {
|
||||||
if (event.name=="colorTemperature") {
|
if (event.name=="colorTemperature") {
|
||||||
@@ -110,15 +104,7 @@ def setLevel(value) {
|
|||||||
* PING is used by Device-Watch in attempt to reach the Device
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
* */
|
* */
|
||||||
def ping() {
|
def ping() {
|
||||||
|
return zigbee.onOffRefresh()
|
||||||
if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
|
||||||
log.info "ping, alive=no, lastActivity=${state.lastActivity}"
|
|
||||||
state.lastActivity = null
|
|
||||||
return zigbee.onOffRefresh()
|
|
||||||
} else {
|
|
||||||
log.info "ping, alive=yes, lastActivity=${state.lastActivity}"
|
|
||||||
sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
Reference in New Issue
Block a user