Skip to content

Instantly share code, notes, and snippets.

@luqman
Created November 10, 2015 17:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save luqman/4b9267f83af2410d5532 to your computer and use it in GitHub Desktop.
Save luqman/4b9267f83af2410d5532 to your computer and use it in GitHub Desktop.
Fibaro Universal Sensor
metadata {
definition (name: "Fibaro Universal Sensor", namespace: "luqman", author: "luqman") {
capability "Sensor"
command "report"
command "singleSet"
command "singleRemove"
command "multiSet"
command "multiRemove"
fingerprint deviceId: "0x2001", inClusters: "0x30 0x60 0x85 0x8E 0x72 0x70 0x86 0x7A 0xEF 0x2B"
}
simulator {
// messages the device returns in response to commands it receives
status "open" : "zw device: 02, command: 2001, payload: 00"
status "closed": "zw device: 02, command: 2001, payload: FF"
}
tiles {
standardTile("contact", "device.contact", width: 2, height: 2) {
state "open", label: '${name}', icon: "st.contact.contact.open", backgroundColor: "#ffa81e"
state "closed", label: '${name}', icon: "st.contact.contact.closed", backgroundColor: "#79b821"
}
main(["contact"])
details(["contact"])
}
}
def parse(String description)
{
def result = []
def cmd = zwave.parse(description, [ 0x60: 3])
if (cmd) {
result += zwaveEvent(cmd)
}
log.debug "parsed '$description' to ${result}"
result
}
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv1.ManufacturerSpecificReport cmd) {
log.debug("ManufacturerSpecificReport ${cmd.inspect()}")
}
def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd) {
log.debug("ConfigurationReport ${cmd.inspect()}")
}
def zwaveEvent(physicalgraph.zwave.commands.multichannelv3.MultiChannelCmdEncap cmd) {
log.debug("XXX MultiChannelCmdEncap ${cmd.inspect()}")
def encapsulatedCommand = cmd.encapsulatedCommand()
if (encapsulatedCommand) {
log.debug("Decrypted returned ${encapsulatedCommand?.inspect()}")
}
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
log.debug "Catchall reached for cmd: ${cmd.toString()}}"
[]
}
def report() {
// zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
//
delayBetween([
zwave.configurationV1.configurationGet(parameterNumber: 5).format(),
zwave.configurationV1.configurationGet(parameterNumber: 6).format()
])
}
def sensorValueEvent(value) {
if (value) {
createEvent(name: "contact", value: "open", descriptionText: "$device.displayName is open")
} else {
createEvent(name: "contact", value: "closed", descriptionText: "$device.displayName is closed")
}
}
def configTest() {
log.debug "configTest"
zwave.multiChannelAssociationV2.multiChannelAssociationSet(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
//zwave.associationV2.associationSet(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
}
def singleRemove() {
def cmds = []
//cmds << zwave.associationV2.associationRemove(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format()
//cmds << zwave.associationV2.associationRemove(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
cmds << zwave.associationV2.associationRemove(groupingIdentifier:3, nodeId:[zwaveHubNodeId]).format()
delayBetween(cmds, 500)
}
def singleSet() {
def cmds = []
//cmds << zwave.associationV2.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format()
//cmds << zwave.associationV2.associationSet(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
cmds << zwave.associationV2.associationSet(groupingIdentifier:3, nodeId:[zwaveHubNodeId]).format()
delayBetween(cmds, 500)
}
def multiSet() {
def cmds = []
cmds << zwave.multiChannelAssociationV2.multiChannelAssociationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format()
cmds << zwave.multiChannelAssociationV2.multiChannelAssociationSet(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
//cmds << zwave.multiChannelAssociationV2.multiChannelAssociationSet(groupingIdentifier:3, nodeId:[zwaveHubNodeId]).format()
delayBetween(cmds, 500)
}
def multiRemove() {
def cmds = []
cmds << zwave.multiChannelAssociationV2.multiChannelAssociationRemove(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format()
cmds << zwave.multiChannelAssociationV2.multiChannelAssociationRemove(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
//cmds << zwave.multiChannelAssociationV2.multiChannelAssociationRemove(groupingIdentifier:3, nodeId:[zwaveHubNodeId]).format()
delayBetween(cmds, 500)
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd)
{
log.debug "BasicSet ${cmd.inspect()}"
sensorValueEvent(cmd.value)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment