Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rolling up master to staging #3764

Merged
merged 22 commits into from
Dec 11, 2018
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e437eae
ICP-7202 - disarming tamper
KKlimczukS Nov 30, 2018
c48b452
ICP-7202 - rename
KKlimczukS Nov 30, 2018
2460e29
Remove tamper capability
KKlimczukS Dec 3, 2018
086e138
add new version orvibo smoke sensor fingerprint.
BYDengS Dec 5, 2018
46bed50
Add new version ORVIBO gas sensor fingerprint.
BYDengS Dec 5, 2018
0e212a4
WWST-1481 update Leedarson bulb model ID
wen33wenS Dec 5, 2018
68794bf
Merge pull request #3743 from wen33wenS/WWST-1481-modelID
tpmanley Dec 5, 2018
e88781e
WWST-1614 creating new DTH for zigbee siren (#3721)
f-yoneyama Dec 5, 2018
5c0b19a
ICP-7369 ONEAPP-8773 add new version orvibo smoke sensor fingerprint.…
BYDengS Dec 5, 2018
53d07e6
ONEAPP-8778 ICP-7395 Add new version ORVIBO gas sensor fingerprint. (…
BYDengS Dec 5, 2018
83d5ac2
Fix the smoke sensor status don't changed in ST app after trigger a s…
BYDengS Dec 6, 2018
bd2e4c3
Fix the smoke sensor status don't changed in ST app after trigger a s…
BYDengS Dec 6, 2018
9676344
Fix the gas sensor status don't changed in ST app after trigger a gas…
BYDengS Dec 6, 2018
a0c70e0
Merge pull request #3747 from BYDengS/ICP-7395
tpmanley Dec 6, 2018
86b63c4
Merge pull request #3746 from BYDengS/ICP-7369
tpmanley Dec 6, 2018
bb83f0f
ICP-7184 Query locks for battery level when power is restored (#3738)
greens Dec 7, 2018
7a9e47f
ICP-7433 [CN][Orvibo][Gas sensor] After claim to the hub, the gas… (#…
BYDengS Dec 10, 2018
b24027d
Merge branch 'master' of https://github.com/SmartThingsCommunity/Smar…
KKlimczukS Dec 10, 2018
b77fbc2
checkInterval - change back to 122 min
KKlimczukS Dec 10, 2018
0848f78
ICP-7208 - checkInterval -> change back to 122 min (#3756)
greens Dec 10, 2018
4408df1
[WWST-2109] Add fingerprint to Aurora MPro Smart. (#3759)
MGoralczykS Dec 11, 2018
c954233
Merge pull request #3763 from SmartThingsCommunity/staging
workingmonk Dec 11, 2018
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
Prev Previous commit
Next Next commit
WWST-1614 creating new DTH for zigbee siren (#3721)
  • Loading branch information
f-yoneyama authored and greens committed Dec 5, 2018
commit e88781e833c6406d9884d083fd238d41c1fa1523
148 changes: 148 additions & 0 deletions devicetypes/smartthings/ozom-smart-siren.src/ozom-smart-siren.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/**
* Ozom Smart Siren
*
* Copyright 2018 Samsung SRBR
*
* 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: "Ozom Smart Siren", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", vid: "generic-siren-2", ocfDeviceType: "x.com.st.d.siren") {
capability "Actuator"
capability "Alarm"
capability "Switch"
capability "Configuration"
capability "Health Check"

fingerprint profileId: "0104", inClusters: "0000,0003,0500,0502", outClusters: "0000", manufacturer: "ClimaxTechnology", model: "SRAC_00.00.00.16TC", deviceJoinName: "Ozom Smart Siren" // Ozom Siren - SRAC-23ZBS
}

tiles {
standardTile("alarm", "device.alarm", width: 2, height: 2) {
state "off", label:'off', action:'alarm.siren', icon:"st.secondary.siren", backgroundColor:"#ffffff"
state "siren", label:'siren!', action:'alarm.off', icon:"st.secondary.siren", backgroundColor:"#e86d13"
}

main "alarm"
details(["alarm"])
}
}

private getDEFAULT_MAX_DURATION() { 0x00B4 }
private getDEFAULT_DURATION() { 0xFFFE }

private getIAS_WD_CLUSTER() { 0x0502 }

private getATTRIBUTE_IAS_WD_MAXDURATION() { 0x0000 }
private getATTRIBUTE_IAS_ZONE_STATUS() { 0x0002 }

private getCOMMAND_IAS_WD_START_WARNING() { 0x00 }
private getCOMMAND_DEFAULT_RESPONSE() { 0x0B }

def turnOffAlarmTile(){
sendEvent(name: "alarm", value: "off")
sendEvent(name: "switch", value: "off")
}

def turnOnAlarmTile(){
sendEvent(name: "alarm", value: "siren")
sendEvent(name: "switch", value: "on")
}

def installed() {
sendCheckIntervalEvent()
state.maxDuration = DEFAULT_MAX_DURATION
turnOffAlarmTile()
}

def parse(String description) {
log.debug "Parsing '${description}'"

Map map = zigbee.getEvent(description)
if (!map) {
if (description?.startsWith('enroll request')) {
List cmds = zigbee.enrollResponse()
log.debug "enroll response: ${cmds}"
return cmds
} else {
Map descMap = zigbee.parseDescriptionAsMap(description)
if (descMap?.clusterInt == IAS_WD_CLUSTER) {
def data = descMap.data

Integer parsedAttribute = descMap.attrInt
Integer command = Integer.parseInt(descMap.command, 16)
if (parsedAttribute == ATTRIBUTE_IAS_WD_MAXDURATION && descMap?.value) {
state.maxDuration = Integer.parseInt(descMap.value, 16)
} else if (command == COMMAND_DEFAULT_RESPONSE) {
Boolean isSuccess = Integer.parseInt(data[-1], 16) == 0
Integer receivedCommand = Integer.parseInt(data[-2], 16)
if (receivedCommand == COMMAND_IAS_WD_START_WARNING && isSuccess){
if(state.alarmOn){
turnOnAlarmTile()
runIn(state.lastDuration, turnOffAlarmTile)
} else {
turnOffAlarmTile()
}
}
}
}
}
}
log.debug "Parse returned $map"
def results = map ? createEvent(map) : null
log.debug "parse results: " + results
return results
}

private sendCheckIntervalEvent() {
sendEvent(name: "checkInterval", value: 30 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
}

def ping() {
return zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS)
}

def configure() {
sendCheckIntervalEvent()

def cmds = zigbee.enrollResponse() +
zigbee.writeAttribute(IAS_WD_CLUSTER, ATTRIBUTE_IAS_WD_MAXDURATION, DataType.UINT16, DEFAULT_DURATION) +
zigbee.configureReporting(zigbee.IAS_ZONE_CLUSTER, zigbee.ATTRIBUTE_IAS_ZONE_STATUS, DataType.BITMAP16, 0, 180, null)
log.debug "configure: " + cmds

return cmds
}

def siren() {
log.debug "siren()"
on()
}

def on() {
log.debug "on()"

state.alarmOn = true
def warningDuration = state.maxDuration ? state.maxDuration : DEFAULT_MAX_DURATION
state.lastDuration = warningDuration

// start warning, burglar mode, no strobe, siren very high
zigbee.command(IAS_WD_CLUSTER, COMMAND_IAS_WD_START_WARNING, "13", DataType.pack(warningDuration, DataType.UINT16), "00", "00")
}

def off() {
log.debug "off()"

state.alarmOn = false
zigbee.command(IAS_WD_CLUSTER, COMMAND_IAS_WD_START_WARNING, "00", "0000", "00", "00")
}