Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions devicetypes/smartthings/aeon-minimote.src/aeon-minimote.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import groovy.json.JsonOutput
import groovy.json.JsonOutput

/**
* Copyright 2015 SmartThings
Expand All @@ -15,7 +14,7 @@ import groovy.json.JsonOutput
*
*/
metadata {
definition (name: "Aeon Minimote", namespace: "smartthings", author: "SmartThings", runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false) {
definition (name: "Aeon Minimote", namespace: "smartthings", author: "SmartThings", runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, mcdSync: true) {
capability "Actuator"
capability "Button"
capability "Holdable Button"
Expand Down Expand Up @@ -128,27 +127,32 @@ def updated() {
initialize()
if (!childDevices) {
createChildDevices()
}
else if (device.label != state.oldLabel) {
} else if (device.label != state.oldLabel) {
childDevices.each {
def segs = it.deviceNetworkId.split("/")
def newLabel = "${device.displayName} button ${segs[-1]}"
it.setLabel(newLabel)
}
state.oldLabel = device.label
} else {
childDevices.each {
it.sendEvent(name: "supportedButtonValues", value: ["pushed","held"].encodeAsJson(), displayed: false)
}
}
}

def initialize() {
sendEvent(name: "numberOfButtons", value: 4)
sendEvent(name: "DeviceWatch-Enroll", value: JsonOutput.toJson([protocol: "zwave", scheme:"untracked"]), displayed: false)
sendEvent(name: "supportedButtonValues", value: ["pushed","held"].encodeAsJson(), displayed: false)
}

private void createChildDevices() {
state.oldLabel = device.label
for (i in 1..4) {
addChildDevice("Child Button", "${device.deviceNetworkId}/${i}", device.hubId,
def child = addChildDevice("Child Button", "${device.deviceNetworkId}/${i}", device.hubId,
[completedSetup: true, label: "${device.displayName} button ${i}",
isComponent: true, componentName: "button$i", componentLabel: "Button $i"])
child.sendEvent(name: "supportedButtonValues", value: ["pushed","held"].encodeAsJson(), displayed: false)
}
}