Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICP-13231- removed cause of duplicated events #32782

Merged
merged 3 commits into from
Jun 9, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,12 @@ def updated() {


def initialize() {
def numberOfButtons = prodNumberOfButtons[zwaveInfo.prod]
sendEvent(name: "numberOfButtons", value: numberOfButtons, displayed: false)
if(isUntrackedAeotec() || isUntrackedFibaro()) {
sendEvent(name: "DeviceWatch-Enroll", value: JsonOutput.toJson([protocol: "zwave", scheme:"untracked"]), displayed: false)
} else {
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 10 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
}
if(!childDevices) {
addChildButtons(numberOfButtons)
}
if(childDevices) {
def event
for(def endpoint : 1..prodNumberOfButtons[zwaveInfo.prod]) {
event = createEvent(name: "button", value: "pushed", isStateChange: true)
sendEventToChild(endpoint, event)
}
}

response([
secure(zwave.batteryV1.batteryGet()),
"delay 2000",
Expand All @@ -97,9 +86,23 @@ def configure() {
//Makes Fibaro KeyFob buttons send all kind of supported events
}
}
setupChildDevices()
cmds
}

def setupChildDevices(){
def numberOfButtons = prodNumberOfButtons[zwaveInfo.prod]
sendEvent(name: "numberOfButtons", value: numberOfButtons, displayed: false)
if(!childDevices) {
addChildButtons(numberOfButtons)

for(def endpoint : 1..prodNumberOfButtons[zwaveInfo.prod]) {
def event = createEvent(name: "button", value: "pushed", isStateChange: true)
sendEventToChild(endpoint, event)
}
greens marked this conversation as resolved.
Show resolved Hide resolved
}
}

def parse(String description) {
def result = []
if (description.startsWith("Err")) {
Expand Down Expand Up @@ -137,9 +140,9 @@ def zwaveEvent(physicalgraph.zwave.commands.sceneactivationv1.SceneActivationSet
def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotification cmd) {
def value = eventsMap[(int) cmd.keyAttributes]
def description = "Button no. ${cmd.sceneNumber} was ${value}"
def event = createEvent(name: "button", value: value, descriptionText: description, data: [buttonNumber: cmd.sceneNumber], isStateChange: true)
sendEventToChild(cmd.sceneNumber, event)
return event
def childEvent = createEvent(name: "button", value: value, descriptionText: description, data: [buttonNumber: cmd.sceneNumber], isStateChange: true)
sendEventToChild(cmd.sceneNumber, childEvent)
return createEvent(name: "button", value: value, descriptionText: description, data: [buttonNumber: cmd.sceneNumber], isStateChange: true, displayed: false)
}

def sendEventToChild(buttonNumber, event) {
Expand Down