Skip to content

Commit

Permalink
Merge pull request SmartThingsCommunity#60779 from SmartThingsCommuni…
Browse files Browse the repository at this point in the history
…ty/acceptance

Rolling up acceptance to production for deploy
  • Loading branch information
greens authored Mar 16, 2021
2 parents 27a55d8 + e60051e commit bee8ebb
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 18 deletions.
77 changes: 60 additions & 17 deletions devicetypes/smartthings/ikea-button.src/ikea-button.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ metadata {
fingerprint inClusters: "0000, 0001, 0003, 0009, 0102, 1000, FC7C", outClusters: "0003, 0004, 0006, 0008, 0019, 0102, 1000", manufacturer:"IKEA of Sweden", model: "TRADFRI on/off switch", deviceJoinName: "IKEA Remote Control", mnmn: "SmartThings", vid: "SmartThings-smartthings-IKEA_TRADFRI_On/Off_Switch" //IKEA TRÅDFRI On/Off switch
fingerprint manufacturer: "IKEA of Sweden", model: "TRADFRI open/close remote", deviceJoinName: "IKEA Remote Control", mnmn: "SmartThings", vid: "SmartThings-smartthings-IKEA_TRADFRI_open/close_remote" // raw description 01 0104 0203 01 07 0000 0001 0003 0009 0020 1000 FC7C 07 0003 0004 0006 0008 0019 0102 1000 //IKEA TRÅDFRI Open/Close Remote
fingerprint manufacturer: "KE", model: "TRADFRI open/close remote", deviceJoinName: "IKEA Remote Control", mnmn: "SmartThings", vid: "SmartThings-smartthings-IKEA_TRADFRI_open/close_remote" // raw description 01 0104 0203 01 07 0000 0001 0003 0009 0020 1000 FC7C 07 0003 0004 0006 0008 0019 0102 1000 //IKEA TRÅDFRI Open/Close Remote
fingerprint manufacturer: "SOMFY", model: "Situo 4 Zigbee", deviceJoinName: "SOMFY Remote Control", mnmn: "SmartThings", vid: "SmartThings-smartthings-Somfy_open/close_remote" // raw description 01 0104 0203 00 02 0000 0003 04 0003 0005 0006 0102
fingerprint manufacturer: "SOMFY", model: "Situo 4 Zigbee", deviceJoinName: "SOMFY Remote Control", mnmn: "SmartThings", vid: "SmartThings-smartthings-Somfy_Situo4_open/close_remote" // raw description 01 0104 0203 00 02 0000 0003 04 0003 0005 0006 0102
fingerprint manufacturer: "SOMFY", model: "Situo 1 Zigbee", deviceJoinName: "SOMFY Remote Control", mnmn: "SmartThings", vid: "SmartThings-smartthings-Somfy_open/close_remote" // raw description 01 0104 0203 00 02 0000 0003 04 0003 0005 0006 0102
}

Expand Down Expand Up @@ -72,10 +72,29 @@ private getOPENCLOSE_BUTTONS() {
DOWN:2]
}

private getOPENCLOSESTOP_BUTTONS() {
[UP:1,
STOP:2,
DOWN:3
private getOPENCLOSESTOP_BUTTONS_ENDPOINTS() {
[
1: [UP:1,
STOP:2,
DOWN:3],
2: [UP:4,
STOP:5,
DOWN:6],
3: [UP:7,
STOP:8,
DOWN:9],
4: [UP:10,
STOP:11,
DOWN:12]
]
}

private getBUTTON_NUMBER_ENDPOINT() {
[
1: 1, 2: 1, 3: 1,
4: 2, 5: 2, 6: 2,
7: 3, 8: 3, 9: 3,
10:4, 11: 4, 12: 4
]
}

Expand Down Expand Up @@ -123,8 +142,14 @@ private getButtonLabel(buttonNum) {
label = ikeaOnOffSwitchNames[buttonNum - 1]
} else if (isIkeaOpenCloseRemote()) {
label = openCloseRemoteNames[buttonNum - 1]
} else if (isSomfySituo()) {
label = openCloseStopRemoteNames[buttonNum - 1]
} else if (isSomfy()) {
// UP, STOP, DOWN events in "Somfy Situo 4" come from 4 endpoints, so there are 12 child buttons
// endpoint 1: buttons 1-3, enpoint 2: buttons 4-6, endpoint 3: buttons 7-9, endpoint 4: buttons 10-12
// Situo 1 reports from endpoint 1 only
def endpoint = BUTTON_NUMBER_ENDPOINT[buttonNum]
def buttonNameIdx = (buttonNum - 1)%3
def buttonName = openCloseStopRemoteNames[buttonNameIdx]
label = "endpoint $endpoint $buttonName"
}

return label
Expand All @@ -141,7 +166,7 @@ private void createChildButtonDevices(numberOfButtons) {

for (i in 1..numberOfButtons) {
log.debug "Creating child $i"
def supportedButtons = ((isIkeaRemoteControl() && i == REMOTE_BUTTONS.MIDDLE) || isIkeaOpenCloseRemote() || isSomfySituo()) ? ["pushed"] : ["pushed", "held"]
def supportedButtons = ((isIkeaRemoteControl() && i == REMOTE_BUTTONS.MIDDLE) || isIkeaOpenCloseRemote() || isSomfy()) ? ["pushed"] : ["pushed", "held"]
def child = addChildDevice("Child Button", "${device.deviceNetworkId}:${i}", device.hubId,
[completedSetup: true, label: getButtonName(i),
isComponent: true, componentName: "button$i", componentLabel: getButtonLabel(i)])
Expand All @@ -159,15 +184,17 @@ def installed() {
numberOfButtons = 5
} else if (isIkeaOnOffSwitch() || isIkeaOpenCloseRemote()) {
numberOfButtons = 2
} else if (isSomfySituo()) {
} else if (isSomfySituo1()) {
numberOfButtons = 3
} else if (isSomfySituo4()) {
numberOfButtons = 12
}

if (numberOfButtons > 1) {
createChildButtonDevices(numberOfButtons)
}

def supportedButtons = isIkeaOpenCloseRemote() || isSomfySituo() ? ["pushed"] : ["pushed", "held"]
def supportedButtons = isIkeaOpenCloseRemote() || isSomfy() ? ["pushed"] : ["pushed", "held"]
sendEvent(name: "supportedButtonValues", value: supportedButtons.encodeAsJSON(), displayed: false)
sendEvent(name: "numberOfButtons", value: numberOfButtons, displayed: false)
numberOfButtons.times {
Expand All @@ -193,10 +220,17 @@ def configure() {

def cmds = []

if (isSomfySituo()) {
if (isSomfy()) {
cmds += zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x21, ["destEndpoint":0xE8]) +
zigbee.configureReporting(zigbee.POWER_CONFIGURATION_CLUSTER, 0x21, DataType.UINT8, 30, 21600, 0x01, ["destEndpoint":0xE8]) +
zigbee.addBinding(CLUSTER_WINDOW_COVERING)
zigbee.removeBinding(zigbee.ONOFF_CLUSTER, device.zigbeeId, 0x01, device.hub.zigbeeEui, 0x01) +
zigbee.addBinding(CLUSTER_WINDOW_COVERING, ["destEndpoint":0x01])

if (isSomfySituo4()) {
cmds += zigbee.addBinding(CLUSTER_WINDOW_COVERING, ["destEndpoint":0x02]) +
zigbee.addBinding(CLUSTER_WINDOW_COVERING, ["destEndpoint":0x03]) +
zigbee.addBinding(CLUSTER_WINDOW_COVERING, ["destEndpoint":0x04])
}
} else {
cmds += zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x21) +
zigbee.configureReporting(zigbee.POWER_CONFIGURATION_CLUSTER, 0x21, DataType.UINT8, 30, 21600, 0x01) +
Expand Down Expand Up @@ -326,17 +360,18 @@ private Map getButtonEvent(Map descMap) {
buttonNumber = OPENCLOSE_BUTTONS.DOWN
}
}
} else if (isSomfySituo() && descMap.data?.size() == 0){
} else if (isSomfy() && descMap.data?.size() == 0){
// Somfy Situo Remotes query their shades directly after "My"(stop) button is pressed (that's intended behavior)
// descMap contains 'data':['00', '00'] in such cases, so we have to ignore those redundant misinterpreted UP events
if (descMap.clusterInt == CLUSTER_WINDOW_COVERING) {
buttonState = "pushed"
def endpoint = Integer.parseInt(descMap.sourceEndpoint)
if (descMap.commandInt == 0x00) {
buttonNumber = OPENCLOSESTOP_BUTTONS.UP
buttonNumber = OPENCLOSESTOP_BUTTONS_ENDPOINTS[endpoint].UP
} else if (descMap.commandInt == 0x01) {
buttonNumber = OPENCLOSESTOP_BUTTONS.DOWN
buttonNumber = OPENCLOSESTOP_BUTTONS_ENDPOINTS[endpoint].DOWN
} else if (descMap.commandInt == 0x02) {
buttonNumber = OPENCLOSESTOP_BUTTONS.STOP
buttonNumber = OPENCLOSESTOP_BUTTONS_ENDPOINTS[endpoint].STOP
}
}
}
Expand Down Expand Up @@ -368,10 +403,18 @@ private boolean isIkea() {
isIkeaRemoteControl() || isIkeaOnOffSwitch() || isIkeaOpenCloseRemote()
}

private boolean isSomfySituo() {
private boolean isSomfy() {
device.getDataValue("manufacturer") == "SOMFY"
}

private boolean isSomfySituo1() {
isSomfy() && device.getDataValue("model") == "Situo 1 Zigbee"
}

private boolean isSomfySituo4() {
isSomfy() && device.getDataValue("model") == "Situo 4 Zigbee"
}

private Integer getGroupAddrFromBindingTable(description) {
log.info "Parsing binding table - '$description'"
def btr = zigbee.parseBindingTableResponse(description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private int getPowerDiv() {
}

private int getEnergyDiv() {
(isSengledOutlet() || isJascoProductsOutlet()) ? 10000 : 100
(isSengledOutlet() || isJascoProductsOutlet()) ? 10000 : isFrientOutlet() ? 1000 : 100
}

private boolean isSengledOutlet() {
Expand All @@ -177,3 +177,7 @@ private boolean isSengledOutlet() {
private boolean isJascoProductsOutlet() {
device.getDataValue("manufacturer") == "Jasco Products"
}

private boolean isFrientOutlet() {
device.getDataValue("manufacturer") == "frient A/S"
}

0 comments on commit bee8ebb

Please sign in to comment.