[Deprecated] Xiaomi / Aqara ZigBee device drivers (possibly may no longer be maintained)

Sylvania Smart + (not type A) is compatible. Ikea Trådfi light bulbs are said to be compatible, so perhaps their outlet shipping soon will be too. I asked some of the europeans on the ST forum that have already received the plugs, if they have Xiaomi devices and could map their network to see if their working for that, but I've had no response.

I'm trying to digest the xbee info in other threads, it looks interesting except for the wait on the parts.

1 Like

Yep. Still waiting myself. Months now. If you're in the US you have a better chance getting parts than me though. Also if you go for a Zigbee 2 version instead of the Zigbee 3 version I'm waiting on, then it will be faster.

The Zigbee 2 versions will work just fine and do what you need. I'm just buying a future is all my wait is about.

1 Like

I'm excited to give it a try. I ordered an xbee s2 and a waveshare usb adapter from ebay so we'll see if this helps my xiaomi sensors.

what is the status of the xiaomi 2018 aqara vibration sensor on hubitat? I have an application for 6 of them, but I don't want to buy them until I'm sure they're supported. Thx

[BETA] v0.5b of NEW Aqara Vibration Sensor Device Driver

The beta device driver code can be found here.

This sensor has quite a variety of features, which can be used in a number of ways / applications. Here is a chart to show how its functions are mapped to Hubitat events that can then be used with Apps for various automations:

Sensor Function Hubitat event Notes
Vibration/Shock Detected motion = active motion inactive is timer-based
Tilt Detected acceleration = active acceleration inactive is timer-based
Tilt Angle tiltAngle = value Custom attribute (see notes below)
Drop Detected button 1 = pushed
XYZ accelerometer values contact = open/closed see notes below
Activity Report values Custom attribute see notes below
Change sensitivity level n/a not yet working

Notes:

  • Sensor Status: Purely for use in a Hubitat Dashboard, the custom attribute sensorStatus can be used for displaying the following states: Stationary, Vibration, Tilt, and Drop. The Open / Close states are not displayed because they can occur simultaneously during a vibration detected (motion = active) state.

  • Vibration/Shock detection: The sensor does not seem to work well for clothes washer / dryer cycle detection, and also no message is sent when the sensor is stationary. If "heavy" enough vibration continues, the sensor only sends subsequent vibration/shock detected messages every 60 seconds, so the device driver will is set up to reset motion to inactive after 65 seconds as a default, with a user-adjustable reset time in the preference section of the device details page (see screenshot below).

  • Tilt detection: The sensor sends a tilt detected message when it has been rotated in any direction, and both a Tilt Angle value message and XYZ accelerometer values message are sent when the sensor stops moving and has come to a resting position. Because Tilt detected is assigned to the acceleration capability, it also resets to acceleration inactive using a timer - in this case, 2 seconds, not user-adjustable. The reason for 2-seconds is purely to give a visual indicator in a Hubitat Dashboard if the custom attribute sensorStatus is used. However, since acceleration is state-based, it needs to be reset to inactive when no more tilts are detected after some length of time.

  • Tilt Angle: This value is sent after the sensor has been rotated and come to a resting position. It is a relative value, so in other words, the difference in angle from the sensor's previous resting position. There doesn't seem to be any built-in Hubitat capability that is well suited to assign to this data, so it is assigned to the custom attribute tiltAngle for events that can be used in WebCoRE, by a custom App, or displayed in a Hubitat Dashboard. It is not useful for determining an absolute open or closed position, however, which is why the XYZ Accelerometer value message data is used for that purpose.

  • Drop detection: The sensor sends this message whenever a free-fall drop is detected. It seemed best assigned to a trigger action, so button 1 pushed is used.

  • XYZ Accelerometer values: These values are sent after the sensor has been rotated and come to a resting position. Unlike the Tilt Angle report, they are absolute values, and in the device driver are converted to a 3-axis angle position. Although this calculated position is not extremely accurate, it is consistent enough to use for setting and storing absolute open and close positions. This is accomplished by putting the sensor in each position and then pressing the "Set Open" or "Set Closed" buttons in the device view page while logged into the Hubitat Hub (see screenshot below). The conversion to 3-axis positions includes a "margin of error" to allow for positions that don't exactly match the stored user-set position. I may make this margin value available for users to change in the device preferences.

  • Change Sensitivity Level: The sensor has 3 hardware sensitivity levels: low, medium, and high. Changing the level requires pushing the "Change Sensitivity Level" button in the device view page (see screenshot below). However, because no "level changed successfully" message from the sensor is passed on by the Hubitat hub (or in SmartThings, for that matter) and the current level cannot be queried by the Hubitat driver, I have not yet been able to confirm that the level change command works correctly. So I can't currently guarantee it will work on the Hubitat platform. I plan on opening a new forum thread to ask about the best method for sending the ZigBee write attribute command in this case. EDIT: This has been changed in the v0.7b beta driver, but is still not yet working.

An example screenshot from the device details page of my Aqara Vibration Sensor using the beta device driver:

4 Likes

Keith, wow that was fast getting out the beta DH for the Aqara vibration sensor and it's working great. This very tiny device has quite a few neat capabilities, and the reasonable prices for all these xiaomi sensors really helps in putting a system together.

Thank You

I have been playing with the QBKG03LM double button no neutral wall light switch. When the left button is pushed this turns on the relay in the device direct, you get the following in the log:

dev:6422018-11-17 10:01:11.738:debugparse description2: read attr - raw: 1C86040006100000100000001001, dni: 1C86, endpoint: 04, cluster: 0006, size: 10, attrId: 0000, encoding: 10, value: 0000001001

dev:6422018-11-17 10:01:11.453:debugparse description2: read attr - raw: 1C86020006160000100100F02300861C03, dni: 1C86, endpoint: 02, cluster: 0006, size: 16, attrId: 0000, encoding: 10, value: 0100F02300861C03

When you press again it turns the relay off and you get:

dev:6422018-11-17 10:03:17.461:debugparse description2: read attr - raw: 1C86040006100000100000001001, dni: 1C86, endpoint: 04, cluster: 0006, size: 10, attrId: 0000, encoding: 10, value: 0000001001

dev:6422018-11-17 10:03:17.133:debugparse description2: read attr - raw: 1C86020006160000100000F02300861C03, dni: 1C86, endpoint: 02, cluster: 0006, size: 16, attrId: 0000, encoding: 10, value: 0000F02300861C03

So I can see from the above that the endpoint for the button is 4 and the endpoint for the relay is 2, when you press the right button you get the same but the endpoint for the button is 5 and the endpoint for the second relay is 3. On the relay turning on and off value changes.

I have modifies a driver to use with this wallswitch and it is below

/**
 *
 *  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.
 *
 *  Modified from DTH and simic by a4refillpad and modded again by picturepete
 
 *  08/2018 first release
 */

metadata {
    definition (name: "Aqara 2 Button Wired Test", namespace: "picturepete", author: "picturepete") {
        capability "PushableButton"
        capability "Switch"
              
        command "on"
		command "off"
		command "on2"
        command "off2"
		
        attribute "numberofbuttons", "3"
        attribute "switch2","ENUM", ["on","off"]
        attribute "lastCheckin", "string"
	    attribute "buttonPressed", "String"
    } 

}

// Parse incoming device messages to generate events
def parse(String description) {
   log.debug "Parsing '${description}'"
   def value = zigbee.parse(description)?.text
   def endpoint = description.split(",").find {it.split(":")[0].trim() == "endpoint"}?.split(":")[1].trim()
   def cluster	= description.split(",").find {it.split(":")[0].trim() == "cluster"}?.split(":")[1].trim()
   def attrId = description.split(",").find {it.split(":")[0].trim() == "attrId"}?.split(":")[1].trim()
   def valueHex = description.split(",").find {it.split(":")[0].trim() == "value"}?.split(":")[1].trim()
   log.debug "Parse: $value"
   Map map = [:]
   
	if (cluster == "0006") {
		// Parse button press: endpoint 04 = left, 05 = right, 06 = both
		map = parseButtonPress(Integer.parseInt(endpoint))
	}
	else if (description?.startsWith('read attr -')) {
		map = parseReportAttributeMessage(description)
	}
    else if (description?.startsWith('on/off: ')){
    	def resultMap = zigbee.getKnownDescription(description)
   		log.debug "${resultMap}"
        
        map = parseCustomMessage(description) 
    }
	
	log.debug "Parse returned $map"
    //  send event for heartbeat    
    def now = new Date()
    sendEvent(name: "lastCheckin", value: now)
    
	def results = map ? createEvent(map) : null
	return results;
}




private Map parseButtonPress(value) {
	def pushType = ["", "Null", "Relay1", "Relay2", "Right", "Left", "Both"]
	def descText = "${pushType[value]} button${(value == 6) ? "s" : ""} pressed (Button $value pushed)"
	displayInfoLog(descText)
	displayDebugLog("Setting buttonPressed to current date/time for webCoRE")
	sendEvent(name: "buttonPressed", value: now(), descriptionText: "Updated buttonPressed (webCoRE)")
		return [
		name: 'pushed',
		value: value,
		isStateChange: true,
		descriptionText: descText
		
		]
	
}

  private def displayDebugLog(message) {
	if (debugLogging) log.debug "${device.displayName}: ${message}"
}

  private def displayInfoLog(message) {
	if (infoLogging || state.prefsSetCount != 1)
		log.info "${device.displayName}: ${message}"
}

def off() {
    log.debug "off()"
	sendEvent(name: "switch", value: "off")
	"st cmd 0x${device.deviceNetworkId} 2 6 0 {}"
}

def on() {
   log.debug "on()"
	sendEvent(name: "switch", value: "on")
	"st cmd 0x${device.deviceNetworkId} 2 6 1 {}"
}

def off2() {
    log.debug "off2()"
	sendEvent(name: "switch2", value: "off")
	"st cmd 0x${device.deviceNetworkId} 3 6 0 {}"
}

def on2() {
   log.debug "on2()"
	sendEvent(name: "switch2", value: "on")
	"st cmd 0x${device.deviceNetworkId} 3 6 1 {}"
}

This works and in the device control you can turn the relays on and off and you can see the buttons being reported, however if you press the button it activates the relay but it isn't reported to the driver, I am unsure how to do this, if anyone can help that would be great. I also do not know how to make a child device so when you want to create a rule etc you cannot see the second relay, but you can create a virtual switch using virtual device sync, this creates two switches but you can delete the first switch which you can control from the main DH.

It also is reporting on both buttons being pressed and also on another cluster number 1 and I am unsure what it is reporting here.

Any ideas or pointers on how I can get the DH to report the relays on a button press would be greatly appreciated.

The logs for switching by pressing the button on are below:

2018-11-19 08:49:27.959 pm debugParse returned [name:pushed, value:4, isStateChange:true, descriptionText:Right button pressed (Button 4 pushed)]

dev:6422018-11-19 08:49:27.957 pm infoDouble No Neutral Switch: Right button pressed (Button 4 pushed)

dev:6422018-11-19 08:49:27.956 pm debugParse: null

dev:6422018-11-19 08:49:27.955 pm debugParsing 'read attr - raw: 1C86040006100000100000001001, dni: 1C86, endpoint: 04, cluster: 0006, size: 10, attrId: 0000, encoding: 10, value: 0000001001'

dev:6422018-11-19 08:49:27.592 pm debugParse returned [name:pushed, value:2, isStateChange:true, descriptionText:Relay1 button pressed (Button 2 pushed)]

dev:6422018-11-19 08:49:27.588 pm infoDouble No Neutral Switch: Relay1 button pressed (Button 2 pushed)

dev:6422018-11-19 08:49:27.584 pm debugParse: null

dev:6422018-11-19 08:49:27.583 pm debugParsing 'read attr - raw: 1C86020006160000100100F023B9861C03, dni: 1C86, endpoint: 02, cluster: 0006, size: 16, attrId: 0000, encoding: 10, value: 0100F023B9861C03'

And this is the log for switching off by pressing the button:

2018-11-19 08:50:37.916 pm debugParse returned [name:pushed, value:4, isStateChange:true, descriptionText:Right button pressed (Button 4 pushed)]

dev:6422018-11-19 08:50:37.914 pm infoDouble No Neutral Switch: Right button pressed (Button 4 pushed)

dev:6422018-11-19 08:50:37.910 pm debugParse: null

dev:6422018-11-19 08:50:37.909 pm debugParsing 'read attr - raw: 1C86040006100000100000001001, dni: 1C86, endpoint: 04, cluster: 0006, size: 10, attrId: 0000, encoding: 10, value: 0000001001'

dev:6422018-11-19 08:50:37.692 pm debugParse returned [name:pushed, value:2, isStateChange:true, descriptionText:Relay1 button pressed (Button 2 pushed)]

dev:6422018-11-19 08:50:37.689 pm infoDouble No Neutral Switch: Relay1 button pressed (Button 2 pushed)

dev:6422018-11-19 08:50:37.686 pm debugParse: null

dev:6422018-11-19 08:50:37.684 pm debugParsing 'read attr - raw: 1C86020006160000100000F023B9861C03, dni: 1C86, endpoint: 02, cluster: 0006, size: 16, attrId: 0000, encoding: 10, value: 0000F023B9861C03'

Peter, I have a working driver for the neutral variant of your switch (QBKG11LM/QBKG12LM), it supports the button, switch, and energy monitoring capailities.

It may or may not work for you, but you can give them a try: Hubitat/Drivers at master · guyeeba/Hubitat · GitHub

It needs a generic child switch driver as well, because I try to avoid cutom commands as much as possible, but the code can be easily modified to suit your needs...

Hi, thrown it at the switch and it creates the child devices and the second child device works, detecting the button press and the relay state, these are on endpoint 2 for the relay and 4 for the button, Cannot get first child to work, the endpoints for the second button is 5 and the relay 3 all of them are on cluster 6. Not too sure how you define the separate child devices and endpoints. The logs show:
(starting at the bottom and working up, left button pressed, and right button pressed.

2018-11-26 08:28:54.330 pm debugDouble No Neutral Switch: []

dev:6422018-11-26 08:28:54.328 pm warnOn/off cluster attribute 0 for non-switch endpoint 5

dev:6422018-11-26 08:28:54.324 pm debugDouble No Neutral Switch: read attr - raw: 1C86050006100000100000001001, dni: 1C86, endpoint: 05, cluster: 0006, size: 10, attrId: 0000, encoding: 10, value: 0000001001

dev:6422018-11-26 08:28:53.831 pm debugDouble No Neutral Switch: []

dev:6422018-11-26 08:28:53.828 pm warnOn/off cluster attribute 0 for non-switch endpoint 3

dev:6422018-11-26 08:28:53.825 pm debugDouble No Neutral Switch: read attr - raw: 1C86030006160000100000F0233F861C03, dni: 1C86, endpoint: 03, cluster: 0006, size: 16, attrId: 0000, encoding: 10, value: 0000F0233F861C03

dev:6422018-11-26 08:28:44.543 pm debugDouble No Neutral Switch: []

dev:6422018-11-26 08:28:44.542 pm warnOn/off cluster attribute 0 for non-switch endpoint 4

dev:6422018-11-26 08:28:44.539 pm debugDouble No Neutral Switch: read attr - raw: 1C86040006100000100000001001, dni: 1C86, endpoint: 04, cluster: 0006, size: 10, attrId: 0000, encoding: 10, value: 0000001001

dev:6422018-11-26 08:28:43.972 pm debugDouble No Neutral Switch: []

dev:6422018-11-26 08:28:43.960 pm debugDouble No Neutral Switch: read attr - raw: 1C86020006160000100100F023CF861C03, dni: 1C86, endpoint: 02, cluster: 0006, size: 16, attrId: 0000, encoding: 10, value: 0100F023CF861C03

Any pointers?

Cheers Pete

maaaan, I hate these Aqara devices, they all work differently... but: I double-checked my drivers, and...
and I have something that seemingly does what you want, but it's just an early work-in-progress.

The strange part is having a DTH like this means that I have a double-button-no-neutral-switch, but I can't find it anywhere (only a single button variant).... whatever, I uploaded a new file to github (Aqara QBKG03LM-QBKG04LM BETA.groovy), please try it, and if it works, I'll revisit these no-neutral switches and hack an acceptable driver for them.

They are very annoying, the no neutral version seems to use cluster 6 for the relay and the button, endpoints being 2 and 3 for the relays and 4 and 5 for the buttons, my driver works fine with these but as said earlier doesn't register the relays state if you manually press the buttons. These are really good switches as they can directly replace switches here in the UK and look good. There definitely seems to be an opening for someone to make a good looking wall light switch, all the ones I see available are either silly money or just weird looking. These cost £22.00 in the UK and the wireless equivalent £12.00. BTW you pair the switch by holding the left button until the light/relay switch off.

The DH works perfectly with all 16 of my double Aqara Light switches (neutral version). Child devices are created after selecting 2 buttons in the options and pressing Save on the parent device.

I will move my single button Aqara neutral switches off of SmartThings tonight and test.

Thank you so much @guyeeba and @peter for your efforts.

All tested tonight and the driver works well.

pete

You do get this in the log, unsure as to what the switch is trying to report

2018-11-27 07:39:09.570 pm infoUnknown message: read attr - raw: 325A0100005A01FF42296410006510016E20006F20010121E40C03281E05210500082116260A2100009923000000009B210000, dni: 325A, endpoint: 01, cluster: 0000, size: 5A, attrId: FF01, encoding: 42, value: 296410006510016E20006F20010121E40C03281E05210500082116260A2100009923000000009B210000

I'm working on it :slight_smile:

It's a periodic message (the infamous FF01), it comes... maybe once in every hour? I'm waiting...

Is support for the door/contact sensor for the 2017 or 2018 version? Or does it not matter? D

Doesn't matter unless @veeceeoh says it does. He ported these drivers for HE and is very good at keeping up with them and the new versions. The first post has all the drivers. The "Original" and Aqara door/window sensors are connected.

I'm using the button, door window (original Aqara version), motion, leak and temp/humidity/pressure sensor. All work perfectly.

the reason I asked is there's the Original Xiaomi (non Aqara branding), Aqara, and now 2017/2018 Aqara (though, I'm assuming 2017 is the first Aqara)? Or quite possibly Aliexpress is not entirely accurate in listing

1 Like

I get you. The latter is probably the most accurate assessment. Keith will chime in if I'm wrong, but he is pretty on top of this and would have said they're not compatible. I have no actual idea what any of that Original vs Aqara stuff means. Everything I've ordered from Gearbest and the one thing I ordered off ebay all came in boxes labelled Aqara. So even my door/window sensors that are supposedly the "Original" were labelled Aqara on the box.