mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-27 21:04:15 +00:00
Merge pull request #545 from SmartThingsCommunity/staging
Syncing down changes from staging to master
This commit is contained in:
@@ -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