Skip to content

Commit

Permalink
Merge pull request SmartThingsCommunity#17688 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 Jan 7, 2020
2 parents 056d3b5 + 35694f0 commit b9e5ff2
Show file tree
Hide file tree
Showing 16 changed files with 284 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ private getCurrentSetpointType() {
}

private getMaxSetpointTemperature() {
temperatureScale == 'C' ? 40 : 104
temperatureScale == 'C' ? 80 : 176
}

private getMinSetpointTemperature() {
temperatureScale == 'C' ? -12 : 11
temperatureScale == 'C' ? -25 : -13
}
Empty file.
Empty file.
Empty file modified devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019 SmartThings
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Chinese
'''HEIMAN Scene Keypad'''.zh-cn=海曼情景开关
28 changes: 24 additions & 4 deletions devicetypes/smartthings/zigbee-multi-button.src/zigbee-multi-button.groovy
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ metadata {

fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model:"3450-L", deviceJoinName: "Iris KeyFob", mnmn: "SmartThings", vid: "generic-4-button"
fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model:"3450-L2", deviceJoinName: "Iris KeyFob", mnmn: "SmartThings", vid: "generic-4-button"
fingerprint profileId: "0104", inClusters: "0004", outClusters: "0000, 0001, 0003, 0004, 0005, 0B05", manufacturer: "HEIMAN", model: "SceneSwitch-EM-3.0", deviceJoinName: "HEIMAN Scene Keypad", vid: "generic-4-button-alt"
}

tiles {
Expand Down Expand Up @@ -67,7 +68,18 @@ def parseAttrMessage(description) {
map = getBatteryPercentageResult(Integer.parseInt(descMap.value, 16))
} else if (descMap?.clusterInt == zigbee.ONOFF_CLUSTER && descMap.isClusterSpecific) {
map = getButtonEvent(descMap)
}
} else if(descMap?.clusterInt == 0xFC80) {
def buttonNumber
buttonNumber = Integer.valueOf(descMap?.command[1].toInteger()) + 1

log.debug "Number is ${buttonNumber}"
def event = createEvent(name: "button", value: "pushed", data: [buttonNumber: buttonNumber], descriptionText: "pushed", isStateChange: true)
if (buttonNumber != 1) {
sendEventToChild(buttonNumber, event)
} else {
sendEvent(event)
}
}
map
}

Expand Down Expand Up @@ -146,6 +158,7 @@ def configure() {
def installed() {
sendEvent(name: "button", value: "pushed", isStateChange: true, displayed: false)
sendEvent(name: "supportedButtonValues", value: supportedButtonValues.encodeAsJSON(), displayed: false)

initialize()
}

Expand All @@ -157,6 +170,7 @@ def initialize() {
def numberOfButtons = modelNumberOfButtons[device.getDataValue("model")]
sendEvent(name: "numberOfButtons", value: numberOfButtons, displayed: false)
sendEvent(name: "checkInterval", value: 2 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])

if(!childDevices) {
addChildButtons(numberOfButtons)
}
Expand Down Expand Up @@ -207,13 +221,19 @@ private getButtonMap() {[
]}

private getSupportedButtonValues() {
def values = ["pushed", "held"]
def values
if (device.getDataValue("model") == "SceneSwitch-EM-3.0") {
values = ["pushed"]
} else {
values = ["pushed", "held"]
}
return values
}

private getModelNumberOfButtons() {[
"3450-L" : 4,
"3450-L2" : 4
"3450-L2" : 4,
"SceneSwitch-EM-3.0" : 4
]}

private getModelBindings(model) {
Expand All @@ -222,4 +242,4 @@ private getModelBindings(model) {
bindings += zigbee.addBinding(zigbee.ONOFF_CLUSTER, ["destEndpoint" : endpoint])
}
bindings
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2019 SmartThings
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

# Chinese
'''HEIMAN Emergency Button'''.zh-cn=海曼智能紧急按钮
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
/*
* Copyright 2016 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
import physicalgraph.zigbee.zcl.DataType

metadata {
definition(name: "Zigbee Non-Holdable Button", namespace: "smartthings", author: "SmartThings", runLocally: false, mnmn: "SmartThings", vid: "generic-button-4", ocfDeviceType: "x.com.st.d.remotecontroller") {
capability "Configuration"
capability "Battery"
capability "Refresh"
capability "Button"
capability "Health Check"
capability "Sensor"

fingerprint profileId: "0104", inClusters: "0000, 0001, 0003, 0500", outClusters: "0019", manufacturer: "HEIMAN", model: "SOS-EM", deviceJoinName: "HEIMAN Emergency Button"
}

tiles(scale: 2) {
multiAttributeTile(name: "button", type: "generic", width: 6, height: 4) {
tileAttribute("device.button", key: "PRIMARY_CONTROL") {
attributeState "pushed", label: "Pressed", icon:"st.Weather.weather14", backgroundColor:"#53a7c0"
}
}
valueTile("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
state "battery", label: '${currentValue}% battery', unit: ""
}
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", action: "refresh.refresh", icon: "st.secondary.refresh"
}

main(["button"])
details(["button", "battery", "refresh"])
}
}

def installed() {
sendEvent(name: "supportedButtonValues", value: ["pushed"].encodeAsJSON(), displayed: false)
sendEvent(name: "numberOfButtons", value: 1, displayed: false)
}

private List<Map> collectAttributes(Map descMap) {
List<Map> descMaps = new ArrayList<Map>()

descMaps.add(descMap)

if (descMap.additionalAttrs) {
descMaps.addAll(descMap.additionalAttrs)
}

return descMaps
}

def parse(String description) {
log.debug "description: $description"

Map map = zigbee.getEvent(description)
if (!map) {
if (description?.startsWith('zone status')) {
map = parseIasMessage(description)
} else {
Map descMap = zigbee.parseDescriptionAsMap(description)

if (descMap?.clusterInt == zigbee.POWER_CONFIGURATION_CLUSTER && descMap.commandInt != 0x07 && descMap.value) {
List<Map> descMaps = collectAttributes(descMap)
def battMap = descMaps.find { it.attrInt == 0x0020 }

if (battMap) {
map = getBatteryResult(Integer.parseInt(battMap.value, 16))
}

} else if (descMap?.clusterInt == 0x0500 && descMap.attrInt == 0x0002) {
def zs = new ZoneStatus(zigbee.convertToInt(descMap.value, 16))
map = translateZoneStatus(zs)
} else if (descMap?.clusterInt == zigbee.IAS_ZONE_CLUSTER && descMap.attrInt == zigbee.ATTRIBUTE_IAS_ZONE_STATUS && descMap?.value) {
map = translateZoneStatus(new ZoneStatus(zigbee.convertToInt(descMap?.value)))
}
}
}

log.debug "Parse returned $map"
def result = map ? createEvent(map) : [:]

if (description?.startsWith('enroll request')) {
List cmds = zigbee.enrollResponse()
log.debug "enroll response: ${cmds}"
result = cmds?.collect { new physicalgraph.device.HubAction(it) }
}
return result
}

private Map parseIasMessage(String description) {
ZoneStatus zs = zigbee.parseZoneStatus(description)

translateZoneStatus(zs)
}

private Map translateZoneStatus(ZoneStatus zs) {
if (zs.isAlarm1Set()) {
return getButtonResult('pushed')
}
}

private Map getBatteryResult(rawValue) {
log.debug "Battery rawValue = ${rawValue}"
def linkText = getLinkText(device)

def result = [:]

def volts = rawValue / 10

if (!(rawValue == 0 || rawValue == 255)) {
result.name = 'battery'
result.translatable = true
result.descriptionText = "${ device.displayName } battery was ${ value }%"

def minVolts = 2.1
def maxVolts = 3.0
def pct = (volts - minVolts) / (maxVolts - minVolts)
def roundedPct = Math.round(pct * 100)
if (roundedPct <= 0)
roundedPct = 1
result.value = Math.min(100, roundedPct)
}

return result
}

private Map getBatteryPercentageResult(rawValue) {
log.debug "Battery Percentage rawValue = ${rawValue} -> ${rawValue / 2}%"
def result = [:]

if (0 <= rawValue && rawValue <= 200) {
result.name = 'battery'
result.translatable = true
result.descriptionText = "{{ device.displayName }} battery was {{ value }}%"
result.value = Math.round(rawValue / 2)
}

return result
}

private Map getButtonResult(value) {
def descriptionText
if (value == "pushed")
descriptionText = "${ device.displayName } was pushed"

return [
name : 'button',
value : value,
descriptionText: descriptionText,
translatable : true,
isStateChange : true,
data : [buttonNumber: 1]
]
}

/**
* PING is used by Device-Watch in attempt to reach the Device
* */
def ping() {
zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS)
}

def refresh() {
log.debug "Refreshing Values"
def refreshCmds = []

refreshCmds += zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS) +
zigbee.enrollResponse()
return refreshCmds
}

def configure() {
// Device-Watch allows 2 check-in misses from device + ping (plus 1 min lag time)
// enrolls with default periodic reporting until newer 5 min interval is confirmed
// Sets up low battery threshold reporting
sendEvent(name: "DeviceWatch-Enroll", displayed: false, value: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID, scheme: "TRACKED", checkInterval: 6 * 60 * 60 + 1 * 60, offlinePingable: "1"])

return zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
zigbee.enrollResponse() +
zigbee.batteryConfig()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2019 SmartThings
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

# Chinese
'''HEIMAN Scene Keypad'''.zh-cn=海曼情景开关
11 changes: 7 additions & 4 deletions devicetypes/smartthings/zigbee-scene-keypad.src/zigbee-scene-keypad.groovy
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ metadata {
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005", outClusters: "0003, 0004, 0005", manufacturer: "REXENSE", model: "HY0048", deviceJoinName: "情景开关 1", vid: "generic-4-button-alt"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005", outClusters: "0003, 0004, 0005", manufacturer: "REXENSE", model: "0106-G", deviceJoinName: "情景开关 1", vid: "generic-6-button-alt"
fingerprint profileId: "0104", inClusters: "0000, 0005", outClusters: "0000, 0005, 0017", manufacturer: "ORVIBO", model: "cef8701bb8664a67a83033c071ef05f2", deviceJoinName: "情景开关 1", vid: "generic-3-button-alt"
fingerprint profileId: "0104", inClusters: "0004", outClusters: "0000, 0001, 0003, 0004, 0005, 0B05", manufacturer: "HEIMAN", model: "E-SceneSwitch-EM-3.0", deviceJoinName: "HEIMAN Scene Keypad", vid: "generic-4-button-alt"

}

Expand Down Expand Up @@ -58,13 +59,15 @@ def parse(String description) {

def parseAttrMessage(description) {
def descMap = zigbee.parseDescriptionAsMap(description)
if (descMap?.clusterInt == 0x0017 || descMap?.clusterInt == 0xFE05) {
if (descMap?.clusterInt == 0x0017 || descMap?.clusterInt == 0xFE05 || descMap?.clusterInt == 0xFC80) {
def event = [:]
def buttonNumber
if (descMap?.clusterInt == 0x0017) {
buttonNumber = Integer.valueOf(descMap.data[0])
buttonNumber = Integer.valueOf(descMap.data[0])
} else if (descMap?.clusterInt == 0xFE05) {
buttonNumber = Integer.valueOf(descMap?.value)
buttonNumber = Integer.valueOf(descMap?.value)
} else if(descMap?.clusterInt == 0xFC80) {
buttonNumber = Integer.valueOf(descMap?.command[1].toInteger()) + 1
}
log.debug "Number is ${buttonNumber}"
event = createEvent(name: "button", value: "pushed", data: [buttonNumber: buttonNumber], descriptionText: "pushed", isStateChange: true)
Expand Down Expand Up @@ -129,7 +132,7 @@ private addChildButtons(numberOfButtons) {
private getChildCount() {
if (device.getDataValue("model") == "0106-G") {
return 6
} else if (device.getDataValue("model") == "HY0048") {
} else if (device.getDataValue("model") == "HY0048" || device.getDataValue("model") == "E-SceneSwitch-EM-3.0") {
return 4
} else if (device.getDataValue("model") == "cef8701bb8664a67a83033c071ef05f2") {
return 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ metadata {
fingerprint mfr: "0300", prod: "0003", model: "0005", deviceJoinName: "ilumin Dimmable Bulb", ocfDeviceType: "oic.d.light"
fingerprint mfr: "0312", prod: "FF00", model: "FF04", deviceJoinName: "Minoston Smart Dimmer Switch"
fingerprint mfr: "0312", prod: "FF00", model: "FF02", deviceJoinName: "Minoston Toggle Dimmer Switch"
fingerprint mfr: "0312", prod: "AA00", model: "AA02", deviceJoinName: "Evalogik Smart Dimmer Switch"
fingerprint mfr: "0312", prod: "C000", model: "C002", deviceJoinName: "Evalogik Smart Plug Dimmer"
}

simulator {
Expand Down
Loading

0 comments on commit b9e5ff2

Please sign in to comment.