[OBSOLETE] Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)

Hi, after quit osram plug and install ikea bulb signs the issues continues.

Some idea?, the devices near the hub disconnect not too much but other… Every day much times, door sensor, temperature and push buttons.
The ikea bulb disconnect too!!!, I don’t know why.
There are new dh for Xiaomi aqara temperature sensor and push?

I have Phillips hue with bulbs and no problem, perhaps this interfere with the other zigbee lan?.

Thanks.

I have no idea why you are having these problems, because of not enough information about what is happening.

The DH (device handler) does not affect any problems with Xiaomi / Aqara devices staying connected or not. Connection problems are because of other reasons.

Possibly some very welcome news about new Aqara ZigBee devices:

Currently there is no information about whether these new devices will work with SmartThings hubs, however.

2 Likes

[UPDATE] Xiaomi Temperature / Humidity Sensor DTH v1.3.1

For Xiaomi’s round sensor, model WSDCGQ01LM

temp

Detailed Change List

  • added model designation to header section of code
  • added additional fingerprint lines to help with correctly choosing this DTH when pairing this sensor model

Just gonna drop this tidbit. I got the Xiaomi Natural Gas sensor. It more or less works the same as the smoke alarm and reports the same IAS zone alarms for the actual alarm and test. There’s just no battery as its a plug in unit only (as are all explosive gas sensors as they suck too much power for batteries)

Here’s a DTH for it dervived from the smoke alarm however I am a stickler for using the zigbee library a bit more for parsing and using the natural gas nomenclature instead of smoke and a little other tweaks.

Use at your own risk (test it safely, doesn’t take much gas to set it off), but it does work fine for me. But the non-wireless function isn’t impacted by Zigbee and personally this is a nifty little Zigbee alarm I can shove in the kitchen that is much smaller (and more aesthetically attractive) than the plain Kidde one I have and very out of the way. I just wanted something that could alert me remotely cause why not.

A notable item is that on power-on-reset (you plug it in again), it will generate a sequence of clear-gas alarm-clear-selftestalarm-clear in rapid succession. After that it will also flash green/red for awhile until it fully warms up and goes active with a solid green.
Also the alarm itself is “ramped up” when it does go off or is tested, i.e. it starts low and each beep it gets louder.

/**
 *  Xiaomi Mijia Honeywell Natural Gas Detector
 *  Version 0.02
 *
 *  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.
 *
 *  Known issues:
 *	Xiaomi sensors do not seem to respond to refresh requests // workaround... push physical button 1 time for refresh
 *	Inconsistent rendering of user interface text/graphics between iOS and Android devices - This is due to SmartThings, not this device handler
 *	Pairing Xiaomi sensors can be difficult as they were not designed to use with a SmartThings hub, for this one, normally just tap main button 3 times
 *  Natural gas alarm on power-on-reset generates a sequence of clear-alarm-clear-tested-clear alarm statuses in rapid succession, appears to be intentional
 *
 *  Fingerprint Endpoint data:
 *        01 - endpoint id
 *        0104 - profile id
 *        0101 - device id
 *        01 - ignored
 *        07 - number of in clusters
 *        0000 0004 0003 0001 0002 000A 0500 - inClusters
 *        02 - number of out clusters
 *        0019 000A - outClusters
 *        manufacturer "LUMI" - must match manufacturer field in fingerprint
 *        model "lumi.sensor_natgas" - must match model in 
 */
 
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
import physicalgraph.zigbee.zcl.DataType

metadata {
	definition (name: "Xiaomi Mijia Honeywell Natural Gas Detector", namespace: "mroszko", author: "mroszko") {
		capability "Health Check"
		capability "Sensor"
        
		command "enrollResponse"
		command "resetClear"
		command "resetDetected"
        
        attribute "natgas", "enum", ["detected","clear","tested"]
        
		attribute "lastTested", "String"
		attribute "lastTestedDate", "Date"
		attribute "lastCheckinDate", "Date"
		attribute "lastCheckin", "string"
		attribute "lastNatGas", "String"
		attribute "lastNatGasDate", "Date"		
        
        fingerprint endpointId: "01", profileID: "0104", deviceID: "0101", inClusters: "0000 0004 0003 0001 0002 000A 0500", outClusters: "0019 000A", manufacturer: "LUMI", model: "lumi.sensor_natgas", deviceJoinName: "Xiaomi Honeywell Natural Gas Detector"
	}

	preferences {
		//Date & Time Config
		input description: "", type: "paragraph", element: "paragraph", title: "DATE & CLOCK"    
		input name: "dateformat", type: "enum", title: "Set Date Format\nUS (MDY) - UK (DMY) - Other (YMD)", description: "Date Format", options:["US","UK","Other"]
		input name: "clockformat", type: "bool", title: "Use 24 hour clock?"
	}
    
	// simulator metadata
	simulator {
		// Not Applicable to Thing Device
	}

	tiles {
		multiAttributeTile(name:"natgas", type: "lighting", width: 6, height: 4) {
			tileAttribute ("device.natgas", key: "PRIMARY_CONTROL") {
           			attributeState( "clear", label:'CLEAR', icon:"st.alarm.smoke.clear", backgroundColor:"#ffffff")
					attributeState( "tested", label:"TEST", icon:"st.alarm.smoke.test", backgroundColor:"#e86d13")
					attributeState( "detected", label:'SMOKE', icon:"st.alarm.smoke.smoke", backgroundColor:"#ed0920")   
 			}
            tileAttribute("device.lastNatGas", key: "SECONDARY_CONTROL") {
                		attributeState "default", label:'Natural gas last detected:\n ${currentValue}'
			}	
		}
        
		valueTile("lastTested", "device.lastTested", inactiveLabel: false, decoration: "flat", width: 4, height: 1) {
            		state "default", label:'Last Tested:\n ${currentValue}'
		}
        
		valueTile("lastCheckin", "device.lastCheckin", inactiveLabel: false, decoration:"flat", width: 4, height: 1) {
            		state "lastCheckin", label:'Last Event:\n ${currentValue}'
        }
            
		main "natgas"
		details(["natgas","lastTested", "lastCheckin"])
	}
}

// Parse incoming device messages to generate events
def parse(String description) {
	log.debug "${device.displayName}: Parsing description: ${description}"
    
	// Determine current time and date in the user-selected date format and clock style
	def now = formatDate()    
	def nowDate = new Date(now).getTime()
    
	// Any report - test, gas, clear in a lastCheckin event and update to Last Checkin tile
	// However, only a non-parseable report results in lastCheckin being displayed in events log
	sendEvent(name: "lastCheckin", value: now, displayed: false)
	sendEvent(name: "lastCheckinDate", value: nowDate, displayed: false)
    
	def map = zigbee.getEvent(description)
	if(!map) {
        if (description?.startsWith('zone status')) {
            map = parseZoneStatusMessage(description)
            if (map.value == "detected") {
                sendEvent(name: "lastNatGas", value: now, displayed: false)
                sendEvent(name: "lastNatGasDate", value: nowDate, displayed: false)
            } else if (map.value == "tested") {
				sendEvent(name: "lastTested", value: now, displayed: false)
				sendEvent(name: "lastTestedDate", value: nowDate, displayed: false)
			}	
        } else {
			map = parseAttrMessage(description)
        }
    }
    else {
		log.debug "${device.displayName}: was unable to parse ${description}"
		sendEvent(name: "lastCheckin", value: now) 
	}
    
    log.debug "${device.displayName}: 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 parseAttrMessage(description) {
	def descMap = zigbee.parseDescriptionAsMap(description)
	def map = [:]
    
    log.debug "Got attr message ${descMap}"
    
	return map
}

// Parse the IAS messages
private Map parseZoneStatusMessage(String description) {
	ZoneStatus zs = zigbee.parseZoneStatus(description)
    
	def result = [
		name: 'natgas',
		value: value,
		descriptionText: ''
	]
    
    //alarm 2 - test alarm
    //alarm 1 - natgas alarm

    if (zs.isAlarm2Set()) {
        result.value = "tested"
        result.descriptionText = "${device.displayName} has been tested"
    } else if (zs.isAlarm1Set()) {
        result.value = "detected"
        result.descriptionText = "${device.displayName} has detected natural gas"
    } else if (!zs.isAlarm1Set() && !zs.isAlarm2Set()) {
        result.value = "clear"
        result.descriptionText = "${device.displayName} is all clear"
    }
    return result
}


def formatDate() {
	def correctedTimezone = ""
	def timeString = clockformat ? "HH:mm:ss" : "h:mm:ss aa"

	// If user's hub timezone is not set, display error messages in log and events log, and set timezone to GMT to avoid errors
	if (!(location.timeZone)) {
		correctedTimezone = TimeZone.getTimeZone("GMT")
		log.error "${device.displayName}: Time Zone not set, so GMT was used. Please set up your location in the SmartThings mobile app."
		sendEvent(name: "error", value: "", descriptionText: "ERROR: Time Zone not set, so GMT was used. Please set up your location in the SmartThings mobile app.")
	} else {
		correctedTimezone = location.timeZone
	}
	if (dateformat == "US" || dateformat == "" || dateformat == null) {
		return new Date().format("EEE MMM dd yyyy ${timeString}", correctedTimezone)
	} else if (dateformat == "UK") {
		return new Date().format("EEE dd MMM yyyy ${timeString}", correctedTimezone)
	} else {
		return new Date().format("EEE yyyy MMM dd ${timeString}", correctedTimezone)
	}
}

def resetClear() {
	sendEvent(name:"natgas", value:"clear")
}

def resetDetected() {
	sendEvent(name:"natgas", value:"detected")
}
4 Likes

Door sensor - Isn’t it possible to add a delay here? It will notify immediately if I open the freezer door.

So you don’t want to be notified immediately when a contact open event happens?

That’s not appropriate to add to the device handler. You should create that in whatever Smart App you are using for your automation.

I don’t use it personally, but I’m quite sure WebCoRE has the ability to add a delay to notify on any kind of event.

There are a couple of webcore pistons that combine for freezer monitoring. I use it to do exactly what you are requesting. Can’t find the topic at the moment. I’ll update if I do.

Hello,

I am new to Smartthings community. I have bought v2 hub (Firmware Version: 000.026.00012 ) and some other things including Aqara Button WXKG11LM (model: lumi.sensor_switch.aq2). I am using bspranger DTH version 1.4.3. I can pair the button with my hub and it works well (single click, double click, etc.), but it always disconnects after a while (sometimes its one hour, sometimes two hours) and i have to do the pairing procedure again. Is there some trick to fix this? I have Aqara temp humidity sensor too, and there is no such problem whith this one… Thx for reply

Are you using any ZigBee devices that are mains-powered (plugged into a wall socket)?

If yes, then here’s the likely reason why:

Note that your Aqara Temp-Humidity sensor could have no issues because it is connected directly to your SmartThings Hub, rather than through a ZigBee repeater device.

Either way, I highly recommend having a look at this thread I started on the forums of another hub, Hubitat, which works very similarly to a SmartThings Hub and has the same potential for issues with Xiaomi / Aqara devices:

Thank you for help. I have a Smart Outlet, that was in the box with v2 hub. So if i understand it correctly, that could be the problem… Is there a way to use ZigBee device repeater and Aqara devices together (like the aqara button should stay closer to hub than to ZigBee repeater)?

Maybe, but it’s not guaranteed. By design, ZigBee devices may choose the best available route to connect through, and that route can change at any time as conditions or the topography of the network change. For the vast majority of ZigBee devices, users have no control of how, when, or where they choose to connect to any particular repeater (or directly to the hub). It is just the “nature” of mesh networking.

A good method to determine whether the Aqara Button is dropping off of the network because its connecting via the SmartThings Outlet is to unplug the outlet. Then re-pair the Aqara Button, and wait and see if it maintains its connection for more than a couple hours. If possible, continue that test for a full day (with the outlet unplugged). If the Aqara Button is still connected then it is almost a certainty it has trouble when connecting via the SmartThings Outlet.

Then if you still want to use the outlet, you could try using it in a location where it’s further from the Aqara Button than your hub is, but again this does not guarantee that the Aqara Button won’t decide to connect via the outlet.

What could be the problem? I was notified 2-3 times that the door was open - it wasn’t. In the application, the sensor is open (it is not) and the last two entries are “Contact of Xiaomi Aqara Door Sensor is: Closed”. How is it possible to close twice without opening?

Screenshot_20190724-210609|230x500

I suspect the reason is due to faulty sensor hardware.

It is not the device handler. The device handler just creates events for the hub each time it receives and open / close message from the sensor.

Also, I see that you are using the new Samsung Connect mobile app. All of the Xiaomi / Aqara device handlers in the GitHub/bspranger/Xiaomi repository cannot supported in the new Samsung Connect mobile app, because of Samsung’s Developer policy on integration of hub-connected devices:

To integrate a hub-connected device, you need a SmartThings-compatible hub and to be enrolled as an organization member in Developer Workspace.

None of the people who helped create any Xiaomi / Aqara device handlers are employees of Xiaomi / Aqara, so they cannot be “enrolled as an organization member” which means they cannot create hub-connected device integrations supported in the new Samsung Connect mobile app.

If you are having hardware issues with your Aqara Door / Window sensor(s), I recommend contacting the vendor who sold you the sensor(s), or Aqara directly.

1 Like

Does anyone know if the current curtain moror DTH in
github willl work on the newer aqara b1 curtain motor ?

Hello everyone! I recently bought the “Xiaomi / Aqara air conditioning gateway”

It is an air conditioning controller and a hub. On github I discovered that someone wrote an integration with “Home Assistant”

Is there any way that it can be used to write an integration with ST?
Greetings to the whole community.
P.

Gateway means it is also a ZigBee hub, just like the SmartThings Hub.

For each ZigBee network there can only be one coordinator/hub. So this plug cannot be used a normal device. Software that links the entire Xiaomi / Aqara air conditioning gateway Zigbee network with it’s own devices to the SmartThings Hub would be needed.

There is already an integration for the normal Xiaomi / Aqara gateway. You should ask about Xiaomi / Aqara air conditioning gateway integration on this thread:

Great! Thanks!!!

Aye.
FYI, the door/window sensors use a magentic reed switch. They are most likely getting damaged due to shock and vibe in shipping. I ended up replacing the reed switches on 2 of them because after some bench testing they were pretty much sticking and shifting around not very well in response to the magnet.
One can fix it themselves if they have a soldering iron and just order a new reed switch off digikey (50 cents ea + $5 shipping) or just order new door/window widgets (~$11?) and hope for the best.

Hi,

Have you ever considered, that the repeaters are working correctly, but the hub is not decoding the messages?

I have Osram outlets, SmartThings outlets, and a single Osram bulb, as wired zigbee devices.
For many months I haven’t had any issue with connected devices far away from the hub. (I mean in a cellar, where there is no chance of direct connection.) The messages were passed through one or two repeaters to the hub without any issue. I have even paired the devices at that location, an Aqara leak sensor and an Aqara temp/humidity sensor. I haven’t had any issue with any of them for months, then one day, the temp/humidity sensor stopped reporting. I’ve tried to re-pair it at the location, no luck. Replaced battery, no luck. Moved closer, no luck. Tried to pair another sensor a new one next to the Hub, that worked. Turned out that devices just next to the Hub are able to pair. The same happened with open/close sensors, and other temp/humidity sensors too. Some devices stop sending messages, and other ones start sending messages again after days without any messages.
Topology of the network? Then why a wall socket stops to be able to communicate too. (Samsung one…) I think more and more, that the code how repeaters are handled has been changed in the Hub or in the cloud.
But I will purchase some Tradfri devices. Have you tried their signal repeater too? Is it working as expected? Or just the sockets?

Gabor