Skip to content

Commit

Permalink
ICP-13694 - removes supporting the Battery capability (SmartThingsCom…
Browse files Browse the repository at this point in the history
…munity#45566)

* ICP-13694 - removes supporting the Battery capability

* ICP-13694 - removes supporting the Battery capability
  • Loading branch information
KKlimczukS authored and shinasys committed Apr 29, 2021
1 parent 81837dd commit 3365742
Showing 1 changed file with 1 addition and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import physicalgraph.zigbee.zcl.DataType
metadata {
definition(name: "ZigBee Window Shade", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.blind", mnmn: "SmartThings", vid: "generic-shade") {
capability "Actuator"
capability "Battery"
capability "Configuration"
capability "Refresh"
capability "Window Shade"
Expand Down Expand Up @@ -80,7 +79,6 @@ private getCOMMAND_GOTO_LIFT_PERCENTAGE() { 0x05 }
private getATTRIBUTE_POSITION_LIFT() { 0x0008 }
private getATTRIBUTE_CURRENT_LEVEL() { 0x0000 }
private getCOMMAND_MOVE_LEVEL_ONOFF() { 0x04 }
private getBATTERY_PERCENTAGE_REMAINING() { 0x0021 }

private List<Map> collectAttributes(Map descMap) {
List<Map> descMaps = new ArrayList<Map>()
Expand Down Expand Up @@ -117,9 +115,6 @@ def parse(String description) {
def valueInt = Math.round((zigbee.convertHexToInt(descMap.value)) / 255 * 100)

levelEventHandler(valueInt)
} else if (reportsBatteryPercentage() && descMap?.clusterInt == zigbee.POWER_CONFIGURATION_CLUSTER && zigbee.convertHexToInt(descMap?.attrId) == BATTERY_PERCENTAGE_REMAINING && descMap.value) {
def batteryLevel = zigbee.convertHexToInt(descMap.value)
batteryPercentageEventHandler(batteryLevel)
}
}
}
Expand Down Expand Up @@ -152,13 +147,6 @@ def updateFinalState() {
}
}

def batteryPercentageEventHandler(batteryLevel) {
if (batteryLevel != null) {
batteryLevel = Math.min(100, Math.max(0, batteryLevel))
sendEvent([name: "battery", value: batteryLevel, unit: "%", descriptionText: "{{ device.displayName }} battery was {{ value }}%"])
}
}

def supportsLiftPercentage() {
device.getDataValue("manufacturer") != "Feibit Co.Ltd"
}
Expand Down Expand Up @@ -243,17 +231,9 @@ def configure() {
cmds += readDeviceBindingTable()
}

if (reportsBatteryPercentage()) {
cmds += zigbee.configureReporting(zigbee.POWER_CONFIGURATION_CLUSTER, BATTERY_PERCENTAGE_REMAINING, DataType.UINT8, 30, 21600, 0x01)
}

return refresh() + cmds
}

def usesLocalGroupBinding() {
isIkeaKadrilj() || isIkeaFyrtur()
}

private def parseBindingTableMessage(description) {
Integer groupAddr = getGroupAddrFromBindingTable(description)
if (groupAddr) {
Expand All @@ -279,19 +259,7 @@ private List readDeviceBindingTable() {
}

def shouldInvertLiftPercentage() {
return isIkeaKadrilj() || isIkeaFyrtur() || isSomfy()
}

def reportsBatteryPercentage() {
return isIkeaKadrilj() || isIkeaFyrtur()
}

def isIkeaKadrilj() {
device.getDataValue("model") == "KADRILJ roller blind"
}

def isIkeaFyrtur() {
device.getDataValue("model") == "FYRTUR block-out roller blind"
return isSomfy()
}

def isSomfy() {
Expand Down

0 comments on commit 3365742

Please sign in to comment.