mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-30 06:13:05 +01:00
MSA-884: This is a quick update to a previously published device handler to accept the "update" packet that occurs when the zigbee pairs with the hub to stop an exception due to it not being in the map format that other packets are in.
This commit is contained in:
committed by
Donald Kirker
parent
d82a387c68
commit
69a6fc4f9e
@@ -120,7 +120,7 @@ def setInstallSmartApp(value){
|
|||||||
}
|
}
|
||||||
|
|
||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
|
log.debug description
|
||||||
def description_map = parseDescriptionAsMap(description)
|
def description_map = parseDescriptionAsMap(description)
|
||||||
def event_name = ""
|
def event_name = ""
|
||||||
def measurement_map = [
|
def measurement_map = [
|
||||||
@@ -129,10 +129,7 @@ def parse(String description) {
|
|||||||
zigbeedeviceid: device.zigbeeId,
|
zigbeedeviceid: device.zigbeeId,
|
||||||
created: new Date().time /1000 as int
|
created: new Date().time /1000 as int
|
||||||
]
|
]
|
||||||
if (description_map.cluster == "0000"){
|
if (description_map.cluster == "0001"){
|
||||||
/* version number, not used */
|
|
||||||
|
|
||||||
} else if (description_map.cluster == "0001"){
|
|
||||||
/* battery voltage in mV (device needs minimium 2.1v to run) */
|
/* battery voltage in mV (device needs minimium 2.1v to run) */
|
||||||
log.debug "PlantLink - id ${device.zigbeeId} battery ${description_map.value}"
|
log.debug "PlantLink - id ${device.zigbeeId} battery ${description_map.value}"
|
||||||
event_name = "battery_status"
|
event_name = "battery_status"
|
||||||
@@ -158,6 +155,10 @@ def parse(String description) {
|
|||||||
def parseDescriptionAsMap(description) {
|
def parseDescriptionAsMap(description) {
|
||||||
(description - "read attr - ").split(",").inject([:]) { map, param ->
|
(description - "read attr - ").split(",").inject([:]) { map, param ->
|
||||||
def nameAndValue = param.split(":")
|
def nameAndValue = param.split(":")
|
||||||
map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]
|
if(nameAndValue.length == 2){
|
||||||
|
map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]
|
||||||
|
}else{
|
||||||
|
map += []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user