4 Types of Gas Detector - Zigbee

Need an outdoor shut-off valve at the meter. No risk there. Only thing is how to power such valve. Battery?

1 Like

Might be an opportunity. Lowes, Home Depot, etc. sell millions of small DIY bath exhaust fans every year. Just upgrade the fan motor....like all of those brushless drills on sale now...

Easy: Gas powered. Gas burns a flame which spins a motor which generates a current which powers the device. Voila!

1 Like

I like where you are going with this. But no flame needed. Use gas flow to spin a turbine to generate power.

:grin: would be good to turn it off, but we'd have to go outside to manually turn it back on.

I wonder if you could use something like this (easy to make your own) and a basic water/gas valve like the Dome and put them on your outside gas valve to turn it on/off.

Where I live, Minnesota, gas meters are indoors. While it might be nice to have a shutoff valve before the meter, the gas company shutoff valve is quite stiff. The ball valve just beyond the meter, for me, is very similar to a water shutoff ball valve and will work with one of the water shutoffs. I do use a water shutoff on the gas feed to my backyard kitchen. It works quite well. Once I know there is a working detector, I will get one and another water shutoff.

Christmas in July! My Aqara Cube showed up from an Ebay seller too.

Those familiar with the size of the Aqara cube will be raising an eyebrow right about now.

Xiaomi has this knack of constantly shocking me with the size of their devices. It's like their world is so much smaller than ours! :rofl:

And if there was any question about certification, it is answered here. It is NOT certified for use outside of Mainland China. So you buy this, don't expect any compensation from your insurance company or a blessing from your local fire department.

My personal statement on this device:

You purchase and use this device, you do so of your own accord and accept any and all associated and potential risks. From this point forward, I do not endorse or recommend it in any way. You are 100% liable for the use and setup of this device. I hold no responsibility for any mishaps, incidents, bodily harm or deaths relating to, or resulting from the installation and use of this uncertified device, which clearly states on the back of the device in English, that it is Only for Mainland China

OK, now, with that out of the way, @veeceeoh here's the fingerprint you need to get started. :smile: Thank you so much for volunteering your time with this.

Great! I actually already have a preliminary beta driver almost ready to share.

However when I looked the device capabilities list in Hubitat developers documentation, I don’t see Gas Detector. So the driver will be using Smoke Detector for now, instead of a custom attribute.

I’ll be posting with a link sometime today.

2 Likes

Beta v0.1b of the Xiaomi Mijia Gas Detector driver is ready to test!

Crossing fingers that this works even just in a basic way...

1 Like

You could install something like this

http://store.flw.com/products/asco-direct-acting-gas-shutoff-valve-8040g022-120-60ac.html?gclid=Cj0KCQjwjrvpBRC0ARIsAFrFuV-UOmbP0UAZHp4YvetcpcATEiJkHqjMihGOv32Y0lzowegb0brlE_8aApCPEALw_wcB

and a Z wave or Zigbee relay to control it.

Nice.. now get to work and fix my driver :smiley:

1 Like

Is your driver the Orbivo one from the ST forum? Not seeing where you posted it.

It pairs fine as Device. Using the Orbivo driver with physicalgraph changed doesn't yield much:

I'm thinking it might have to do with:

import hubitat.zigbee.clusters.iaszone.ZoneStatus
import hubitat.zigbee.zcl.DataType

Things of note right off the bat: For natural gas, which most of us will be using it for, they suggest mounting up high, 0.3m-1m from the ceiling. Above the stove would be my first thought. Unfortunately I don't have an outlet up there.

Also, it has a 3-minute warmup time after powering on and resetting, so grab a drink, kick up your feet and relax.

I believe those lines aren't necessary in a Hubitat driver.

That's what I thought. They're referenced elsewhere:

def parseAttrMessage(String description){
def descMap = zigbee.parseDescriptionAsMap(description)
def map = [:]
if (descMap?.clusterInt == zigbee.IAS_ZONE_CLUSTER && descMap.attrInt == zigbee.ATTRIBUTE_IAS_ZONE_STATUS) {
def zs = new ZoneStatus(zigbee.convertToInt(descMap.value, 16))
map = getDetectedResult(zs.isAlarm1Set() || zs.isAlarm2Set())
}

Don't think the ST driver is very friendly to HE.

Oh, you're talking about the one you posted in an entirely different thread:

:wink:

2 Likes

it works after you use the driver

/**

  • Heiman Natural Gas Sensor
  • 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 hubitat.zigbee.clusters.iaszone.ZoneStatus

metadata {
definition (name: "Heiman Gas Detector", namespace: "hubitat", author: "cuboy29") {

    capability "Configuration"
    capability "SmokeDetector"
    capability "Sensor"
    capability "Refresh"
          
    attribute "smoke", "string"
    
	fingerprint profileID: "0104", deviceID: "113", inClusters: "0000,0003,0500,0009", outClusters: "0003,0019"      
}

}

def parse(String description) {

//log.debug "description: $description"
def descMap = [:]

if (description?.startsWith('zone status')) {
		descMap = parseIasMessage(description)
}else if (description?.startsWith('enroll request')) {
	    List cmds = zigbee.enrollResponse()
	    descMap = cmds?.collect { new hubitat.device.HubAction(it) }
}else if (description?.startsWith('catchall')) {
        descMap = parseCatchAllMessage(description)
}else if (description?.startsWith('read attr'))  {  
        descMap = zigbee.parseDescriptionAsMap(description)
   
        if ((descMap?.cluster == "0500" && descMap.attrInt == 0x0001) && (descMap.value == '002B')){  //Zone Type
            log.debug "Zone Type is Carbon Monoxide (CO) Sensor"
		}else if ((descMap?.cluster == "0500" && descMap.attrInt == 0x0000) && (descMap.value == '01')){  //Zone State
            log.debug "Zone State is enrolled"
		}else if ((descMap?.cluster == "0500" && descMap.attrInt == 0x0002) && ((descMap.value == '0030') || (descMap.value == '0020'))){  //Zone Status
            log.debug "${device.displayName} is cleared"
        }else if (descMap?.cluster == "0000" && descMap.attrInt == 0x0004){  //Manufacture
            sendEvent(name: "manufacture", value: descMap.value)
        }else if (descMap?.cluster == "0000" && descMap.attrInt == 0x0005){  //Model 
            sendEvent(name: "model", value: descMap.value)
        }
}

//def result = descMap ? createEvent(descMap) : [:]	
return descMap   

}

private Map translateZoneStatus(ZoneStatus zs) {
// Some sensor models that use this DTH use alarm1 and some use alarm2 to signify motion
return getGasResult(zs.isAlarm1Set() || zs.isAlarm2Set())
}

private Map getGasResult(value) {

def descriptionText = value ? "${device.displayName} has detected GAS!" : "${device.displayName} is clear!"
log.debug descriptionText
return [
		name			: 'smoke',
		value			: value ? 'detected' : 'clear',
        isStateChange: true,
		descriptionText : descriptionText
]

}

private parseCatchAllMessage(String description) {

Map resultMap = [:]
def descMap = zigbee.parse(description)  
//log.debug descMap.inspect()
return resultMap

}

private Map parseIasMessage(String description) {

ZoneStatus zs = zigbee.parseZoneStatus(description)    
translateZoneStatus(zs)    

}

def refresh() {

log.debug "Refreshing..."
def refreshCmds = []

refreshCmds +=
zigbee.readAttribute(0x0500, 1) +	// IAS ZoneType
zigbee.readAttribute(0x0500, 0) +	// IAS ZoneState
zigbee.readAttribute(0x0500, 2) +	// IAS ZoneStatus
zigbee.readAttribute(0x0000, 7) +	// power source
//zigbee.readAttribute(0x0009, 7) +	// not sure what this cluster do yet
zigbee.readAttribute(0x0000, 4) +	// manufacture
zigbee.readAttribute(0x0000, 5) +	// model indentification
    zigbee.enrollResponse()

return refreshCmds

}

def configure() {

log.debug "Configuring..."

def cmds = [
        //bindings
        "zdo bind 0x${device.deviceNetworkId} 1 1 0x0500 {${device.zigbeeId}} {}", "delay 200",
    ] +  zigbee.enrollResponse(1200) + refresh()

return cmds

}

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.