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
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def installed() {
state.numberOfSwitches = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'd still need to add an explicit else here I think to avoid an NPE (just in case)

Also this doesn't really alter any of the behavior of the device, since these two models would have been defaulting to 1 in the first place, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Please add back a default case here (or remove the model checks you added).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

if (!childDevices) {
if (!childDevices && state.numberOfSwitches > 1) {
addChildSwitches(state.numberOfSwitches)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was happening before with for (def endpoint : 2..numberOfSwitches) { when numberOfSwitches was 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was still adding two children switches

}
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
Expand All @@ -93,12 +93,12 @@ def installed() {
}
// Preferences template end
response([
refresh((1..state.numberOfSwitches).toList())
refresh((1..state.numberOfSwitches).toList())
])
}

def updated() {
if (!childDevices) {
if (!childDevices && state.numberOfSwitches > 1) {
addChildSwitches(state.numberOfSwitches)
}
// Preferences template begin
Expand Down