mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-25 05:04:09 +00:00
Compare commits
1 Commits
MSA-883-1
...
MSA-877-15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1a69d9344 |
@@ -80,12 +80,19 @@ def parse(String description) {
|
|||||||
if (cmd) {
|
if (cmd) {
|
||||||
result = zwaveEvent(cmd)
|
result = zwaveEvent(cmd)
|
||||||
}
|
}
|
||||||
log.debug "Parsed ${description.inspect()} to ${result.inspect()}"
|
// log.debug "Parsed ${description.inspect()} to ${result.inspect()}"
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.multiinstancev1.MultiInstanceCmdEncap cmd) {
|
def zwaveEvent(physicalgraph.zwave.commands.multiinstancev1.MultiInstanceCmdEncap cmd) {
|
||||||
def encapsulated = cmd.encapsulatedCommand([0x31: 1, 0x84: 2, 0x60: 1, 0x85: 1, 0x70: 1])
|
def encapsulated = null
|
||||||
|
if (cmd.respondsTo("encapsulatedCommand")) {
|
||||||
|
encapsulated = cmd.encapsulatedCommand()
|
||||||
|
} else {
|
||||||
|
def hex1 = { n -> String.format("%02X", n) }
|
||||||
|
def sorry = "command: ${hex1(cmd.commandClass)}${hex1(cmd.command)}, payload: " + cmd.parameter.collect{ hex1(it) }.join(" ")
|
||||||
|
encapsulated = zwave.parse(sorry, [0x31: 1, 0x84: 2, 0x60: 1, 0x85: 1, 0x70: 1])
|
||||||
|
}
|
||||||
return encapsulated ? zwaveEvent(encapsulated) : null
|
return encapsulated ? zwaveEvent(encapsulated) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -487,6 +487,11 @@ def enrollResponse() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseAxis(String description) {
|
private Map parseAxis(String description) {
|
||||||
|
def hexToSignedInt = { hexVal ->
|
||||||
|
def unsignedVal = hexToInt(hexVal)
|
||||||
|
unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal
|
||||||
|
}
|
||||||
|
|
||||||
def z = hexToSignedInt(description[0..3])
|
def z = hexToSignedInt(description[0..3])
|
||||||
def y = hexToSignedInt(description[10..13])
|
def y = hexToSignedInt(description[10..13])
|
||||||
def x = hexToSignedInt(description[20..23])
|
def x = hexToSignedInt(description[20..23])
|
||||||
@@ -513,11 +518,6 @@ private Map parseAxis(String description) {
|
|||||||
getXyzResult(xyzResults, description)
|
getXyzResult(xyzResults, description)
|
||||||
}
|
}
|
||||||
|
|
||||||
private hexToSignedInt(hexVal) {
|
|
||||||
def unsignedVal = hexToInt(hexVal)
|
|
||||||
unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal
|
|
||||||
}
|
|
||||||
|
|
||||||
def garageEvent(zValue) {
|
def garageEvent(zValue) {
|
||||||
def absValue = zValue.abs()
|
def absValue = zValue.abs()
|
||||||
def contactValue = null
|
def contactValue = null
|
||||||
|
|||||||
@@ -326,7 +326,6 @@ def addBulbs() {
|
|||||||
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.value.hub, ["label":newHueBulb?.value.name])
|
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.value.hub, ["label":newHueBulb?.value.name])
|
||||||
}
|
}
|
||||||
log.debug "created ${d.displayName} with id $dni"
|
log.debug "created ${d.displayName} with id $dni"
|
||||||
d.refresh()
|
|
||||||
} else {
|
} else {
|
||||||
log.debug "$dni in not longer paired to the Hue Bridge or ID changed"
|
log.debug "$dni in not longer paired to the Hue Bridge or ID changed"
|
||||||
}
|
}
|
||||||
@@ -334,8 +333,8 @@ def addBulbs() {
|
|||||||
//backwards compatable
|
//backwards compatable
|
||||||
newHueBulb = bulbs.find { (app.id + "/" + it.id) == dni }
|
newHueBulb = bulbs.find { (app.id + "/" + it.id) == dni }
|
||||||
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.hub, ["label":newHueBulb?.name])
|
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.hub, ["label":newHueBulb?.name])
|
||||||
d.refresh()
|
|
||||||
}
|
}
|
||||||
|
d.refresh()
|
||||||
} else {
|
} else {
|
||||||
log.debug "found ${d.displayName} with id $dni already exists, type: '$d.typeName'"
|
log.debug "found ${d.displayName} with id $dni already exists, type: '$d.typeName'"
|
||||||
if (bulbs instanceof java.util.Map) {
|
if (bulbs instanceof java.util.Map) {
|
||||||
|
|||||||
Reference in New Issue
Block a user