From c2c0535892f3630e4114e15762b9ca59110ba53d Mon Sep 17 00:00:00 2001 From: zhangjinkang Date: Tue, 17 Jul 2018 22:09:26 -0400 Subject: [PATCH] remove alarm capabality . Orvibo did not support alarm capability . --- .../Orvibo-Gas-detector.groovy | 43 +++---------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/devicetypes/smartthings/orvibo-gas-detector.src/Orvibo-Gas-detector.groovy b/devicetypes/smartthings/orvibo-gas-detector.src/Orvibo-Gas-detector.groovy index edcb219a225..7dfabfbe68e 100644 --- a/devicetypes/smartthings/orvibo-gas-detector.src/Orvibo-Gas-detector.groovy +++ b/devicetypes/smartthings/orvibo-gas-detector.src/Orvibo-Gas-detector.groovy @@ -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" @@ -31,8 +30,6 @@ 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 { @@ -40,15 +37,11 @@ metadata { 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(){ @@ -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) } @@ -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"]) }