Skip to content

Commit

Permalink
remove alarm capabality .
Browse files Browse the repository at this point in the history
Orvibo did not support alarm capability .
  • Loading branch information
jinkangzhangS committed Jul 18, 2018
1 parent 22b48c5 commit c2c0535
Showing 1 changed file with 6 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ metadata {
definition(name: "Orvibo Gas Detector", namespace: "smartthings", author: "SmartThings", runLocally: false, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, mnmn: "SmartThings", vid: "generic-smoke") {
capability "Smoke Detector"
capability "Configuration"
capability "Alarm"
capability "Health Check"
capability "Sensor"
capability "Refresh"
Expand All @@ -31,24 +30,18 @@ metadata {

simulator {
status "active": "zone status 0x0001 -- extended status 0x00"
status "alarm" : "read attr - raw: E91D0100090C000000210000, dni: E91D, endpoint: 01, cluster: 0009, size: 0C, attrId: 0000, result: success, encoding: 21, value: 0001"
status "off" : "read attr - raw: E91D0100090C000000210000, dni: E91D, endpoint: 01, cluster: 0009, size: 0C, attrId: 0000, result: success, encoding: 21, value: 0000"
}

tiles {
standardTile("smoke", "device.smoke", width: 2, height: 2) {
state("clear", label:"Clear", icon:"st.alarm.smoke.clear", backgroundColor:"#ffffff")
state("detected", label:"Smoke!", icon:"st.alarm.smoke.smoke", backgroundColor:"#e86d13")
}
standardTile("alarm", "device.alarm", width: 2, height: 2) {
state "off", label:'off', action:'alarm.siren', icon:"st.alarm.alarm.alarm", backgroundColor:"#ffffff"
state "siren", label:'siren!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
}
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 1, height: 1) {
state "default", action: "refresh.refresh", icon: "st.secondary.refresh"
}
main "smoke"
details(["smoke","alarm","refresh"])
details(["smoke","refresh"])
}
}
def installed(){
Expand All @@ -61,8 +54,6 @@ def parse(String description) {
if(!map){
if (description?.startsWith('zone status')) {
map = parseIasMessage(description)
}else if(description?.startsWith('read attr')){
map = parseAlarmMessage(description)
}else{
map = zigbee.parseDescriptionAsMap(description)
}
Expand All @@ -76,55 +67,33 @@ def parse(String description) {
}
return result
}
def parseAlarmMessage(String description){
def descMap = zigbee.parseDescriptionAsMap(description)
def map = [:]
if (descMap?.clusterInt == 0x0009 && descMap.value) {
map = getAlarmResult(descMap.value == "0000" ? false :true)
}
return map;
}
def parseIasMessage(String description) {
ZoneStatus zs = zigbee.parseZoneStatus(description)
return getDetectedResult(zs.isAlarm1Set() || zs.isAlarm2Set())
}
def getDetectedResult(value) {
def detected = value ? 'detected': 'clear'
String descriptionText = "${device.displayName} smoke ${detected}"
String descriptionText = "${device.displayName} smoke ${detected}"
return [name:'smoke',
value: detected,
descriptionText:descriptionText,
translatable:true]
}
def getAlarmResult(value) {
def alarm = value ? 'siren': 'off'
String descriptionText = "${device.displayName} alarm ${alarm}"
return [name:'alarm',
value: alarm,
descriptionText:descriptionText,
translatable:true]
}
def siren() {
sendEvent(name: "alarm", value: "siren")
}
def off() {
sendEvent(name: "alarm", value: "off")
}
def refresh() {
log.debug "Refreshing Values"
def refreshCmds = []
refreshCmds += zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER,zigbee.ATTRIBUTE_IAS_ZONE_STATUS) +
zigbee.readAttribute(0x0009,0x0000)
refreshCmds += zigbee.readAttribute(zigbee.IAS_ZONE_CLUSTER,zigbee.ATTRIBUTE_IAS_ZONE_STATUS)
return refreshCmds
}
/**
* PING is used by Device-Watch in attempt to reach the Device
* */
def ping() {
log.debug "ping "
log.debug "ping"
refresh()
}
def configure() {
log.debug "configure"
sendEvent(name: "checkInterval", value:20 * 60 + 2*60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID, offlinePingable: "1"])
//The gas heart beat is 30 mintues, so we set double time for one package loss.
sendEvent(name: "checkInterval", value:30 * 2 * 60 + 2*60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID, offlinePingable: "1"])
}

0 comments on commit c2c0535

Please sign in to comment.