Skip to content

Commit

Permalink
ICP-10136 - Zooz Power Strip: calling sendHubCommand() once with all …
Browse files Browse the repository at this point in the history
…commands (for all endpoints) (SmartThingsCommunity#11431) (SmartThingsCommunity#11483)

* ICP-10136 - calling sendHubCommand() once with all commands (for all endpoints)

* ICP-10136 - decreased delay between commands send from refresh() to 200 milliseconds
  • Loading branch information
greens authored Oct 28, 2019
1 parent c382d13 commit 86bbf3a
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,26 +254,38 @@ private onOffCmd(value, endpoint = 1) {
}

private refreshAll(includeMeterGet = true) {
childDevices.each { childRefresh(it.deviceNetworkId, includeMeterGet) }
sendHubCommand refresh(includeMeterGet)

def endpoints = [1]

childDevices.each {
def switchId = getSwitchId(it.deviceNetworkId)
if (switchId != null) {
endpoints << switchId
}
}
sendHubCommand refresh(endpoints,includeMeterGet)
}

def childRefresh(deviceNetworkId, includeMeterGet = true) {
def switchId = getSwitchId(deviceNetworkId)
if (switchId != null) {
sendHubCommand refresh(switchId,includeMeterGet)
sendHubCommand refresh([switchId],includeMeterGet)
}
}

def refresh(endpoint = 1, includeMeterGet = true) {
def refresh(endpoints = [1], includeMeterGet = true) {

def cmds = [encap(zwave.basicV1.basicGet(), endpoint)]
def cmds = []

if (includeMeterGet) {
cmds << encap(zwave.meterV3.meterGet(scale: 0), endpoint)
cmds << encap(zwave.meterV3.meterGet(scale: 2), endpoint)
endpoints.each {
cmds << [encap(zwave.basicV1.basicGet(), it)]
if (includeMeterGet) {
cmds << encap(zwave.meterV3.meterGet(scale: 0), it)
cmds << encap(zwave.meterV3.meterGet(scale: 2), it)
}
}
delayBetween(cmds, 500)

delayBetween(cmds, 200)
}

private resetAll() {
Expand Down

0 comments on commit 86bbf3a

Please sign in to comment.