SmartThings Community

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


(Keith G) #1032

[BETA UPDATE] Xiaomi Aqara Vibration Sensor (Model DJR11LM) SmartThings DTH v0.9b

This version finally adds a open/close capability to the DTH, using code graciously shared by GitHub user @_Oltman. His code calculates the angle position of the sensor based on its XYZ accelerometer reports, and allows the user to set and store open/close positions that are then linked to SmartThings contact sensor capability, with open and closed states.

The new DTH code can be grabbed from here.

Changes & Fixes

  • Added NEW FEATURE: Open/Close position, which links to the Contact Sensor capability. Using code kindly shared by GitHub user @_Oltman, custom open and close positions can be stored by pressing the Set Open and Set Closed UI tile buttons while the sensor is in your desired open & closed positions. Once set, the DTH will generate contact - open and contact - closed events when the sensor is in nearly the same positions.
  • Added two new UI tiles to display current Motion (vibration) and Acceleration (tilt) states
  • Changed “Vibration Level” UI tile to more representative name “Recent Activity Level”
  • Removed icon displayed in main sensor status tile
  • Added “refresh” tile that can be used to initialize blank UI tiles if needed
  • Changed the 3-Axis tile to display the calculated position angles instead of the raw accelerometer values
  • Reorganized UI tiles
  • Changed the method to initially set and display hardware Sensitivity level when the sensor is paired (If the sensor is already installed, either press the new “refresh” tile (bottom right) or open preferences and press “save” to set up the Sensitivity level UI button
  • Added code to initialize Recent Activity Level and Last Angle Change UI tiles to display “–” if no reported values have been received yet when the sensor is paired. If this doesn’t work, they can be manually initialized either by pressing the new “refresh” tile (bottom right) or opening preferences and pressing “save”
  • Improved the code that cycles through the 3 levels when Sensitivity level UI button is pushed
  • Fixed mapSensorEvent to correctly set a status reset timer of 2 seconds for Tilt or Drop events
  • Changed the timer reset code for Tilt/Drop events: If a Vibration/Shock event is followed by any Tilt or Drop events, the main UI tile will display “Tilt” or “Drop” for approximately 2 seconds, and then change back to display the “Vibration/Shock” status until the Vibration/Shock reset timer is finished (or until another different event occurs.)
  • Moved code to reset to Stationary status from updated() to configure() so that that status isn’t reset to Stationary when preference settings are saved, instead only resetting it when the sensor is first paired
  • Added info log messages to report open/close/unknown position
  • Added info log messages to report successfully set open/close positions
  • Various code cleanup/reorganization and formatting fixes

Screenshots of updated User Interface

(A vibration event results in motion - active state)

(A tilt event results in acceleration - active state)

(The open/close/unknown status is displayed in a separate small tile,
because other events can happen simultaneously.)

(Here are the rest of the UI tiles)

NOTES

  • After updating to this new DTH code, I recommend opening preferences and pressing save. That should fix any issues that some users have been reporting about the Sensitivity Level UI button not working.
  • I still cannot confirm that the command to change the hardware sensitivity is working. On the SmartThings platform, no confirmation message is received from the sensor.
  • No contact - open or contact - closed events will be sent until both the open and closed positions are set. If the open and closed are set for the same position, then it that position will only report contact - closed.
  • Although not officially supported by the contact sensor capability, when the sensor is in any position outside the set open and closed positions, a contact - unknown event will be sent and the tile will display “unknown”.
  • The open/close position algorithm uses a margin of error value to allow for some variance from the stored open/closed positions set by the user. This is not user adjustable yet, but may be added to the preference settings in a future release.

(Super Mouse Dv) #1033

Sorry for disappearing for a bit … Family issues … ANYWAYS. I just started playing with the NEW DH and leaps and bounds better than the last version. I can get it to light up lights by using it as an inactive/active Trigger
So Im going to try it as a way of turning on my Bedroom light via bumping the door:)see if that works :slight_smile: I will be testing it more soon… But so far AWESOME…


(Marc Zamora) #1034

May I ask what’s the use of the sensor be blind for 60 seconds?
If u use it for open lights for example. It means the light will not turn on after atleast 60 seconds.

I don’t understand why this feature. If anyon is so kind to explain me pls.
As well if I setup a motion reset of 10 seconds it doesn’t work. so the motion sensor loses it’s functionality for me.


#1035

The blind time is the time after a motion when the device will not “see” another motion. So a motion detected will turn the light on, but if you turn it off immediately, it’ll be ~60 seconds before another motion will turn it on again.

Its for that reason that your 10 second reset does not do what you’re expecting.


(Marc Zamora) #1036

Thanks for ur reply!
Now I understand that behaviour but I don’t understand why that…what’s the use to have that blind time? I want my sensors to detect at all times, not every 60 seconds.


#1037

I guess to save batter life.

But, can you solder (or do you have a 4B pencil)…


(Brian Spranger) #1038

Anyone else just have nearly all their xiaomi devices drop over the last two days?

I have somewhere between 30-40 xiaomi devices most of which have been connected and stable for over a year. Yesterday I noticed I lost about half of them, today nearly all the remaining ones have dropped.

Does this have anything to do with the firmware release they announced last week?


(Darren) #1039

Last week I had a slew of these devices drop off too from buttons, motion and door sensors.

It gets tiring having to readd and then reconfigure rules when it happens :joy:


(Mark Poole) #1040

It could be something in the update but more likely is when the update happened and your hub restarted these Xiaomi devices connected through a different Zigbee repeating device that does not work with those devices. Search on Xiaomi and Iris 3210-L to better understand what’s going on with those devices.


#1041

I have had some drop too that have been solid for the past year or more. From aquara motion sensor, button, magic cube
I don’t have any going through a repeater and they all dropped at different times so maybe something to do the with the update


(Mark Poole) #1042

While this post is related to Hubitat the information related to Xiaomi devices applies on Smartthings.


(Bill Padley) #1043

Slightly lost here
have a new aqara Vibration sensor …I have loaded the device handler here and published it
Xiaomi Aqara Vibration Sensor

  • Model DJT11LM (thats what I have)
  • Version 0.9b

added a new device I think correctly …should I even be doing this or trying to pair with the instructions at top of this page without adding the device manually?

now in the smarthings app it shows up as stationary how exactly do I PAIR with the actual sensor? tried a long press on the device it flashes blue but then no motion appears to show in the smarthings page of “right now” only thing that shows up under "recently " tab is battery runtime oct 24 2018

any help much appreciated…new to all this !

Bill P


(Alec McLure) #1044

Hey @ArstenA, Brian
Mine are all solid on 000.024.00011 - is that what you have?

That said I did have one new Aqara temp/humidity that dropped because it had connected to a SmartThings Plug instead of to the hub or to one of three XBEEs. Once I got it on an XBEE it did fine.

Alec


(Brian Spranger) #1045

I am on the same version.

The only other zigbee devices I have is a xbee router which I know works.

So they dropped from the hub.


(Mark Poole) #1046

I was never able to figure out how zigbee devices were being routed with Smartthings. How are you able to determine this?


(Alec McLure) #1047

Using an Xbee device and XCTU software as detailed in @adam_walker 's excellent Zigbee - from flakey to stable

The Xbees also work as repeaters for both Xiaomi and non-Xiaomi devices.


(Mark Poole) #1048

Thanks for confirming that Alec.

I ordered one of those more than a month ago and it was backordered. Supposed to be in my mailbox tomorrow. I have that thread bookmarked.

I was hoping you were going to tell me of something I’d not stumbled on in STs. In Hubitat there is Zigbee logging that shows additional numbers you can sort of piece the routing together. It also helps to at a quick glance figure out when the mesh has gone bad.


(Mark Poole) #1049

Another question for you @AlecM, have you been able to determine how far away that Xbee device acts as a good repeater?


(Keith G) #1050

Your screenshot shows a correctly paired device, however…

When you did that long press, you put the sensor into pairing mode again, which means that the SmartThings hub wouldn’t see it anymore.

In a nutshell, the process goes like this:

  1. Create a new device handler (under My Device Handlers in your IDE) using the custom DTH code for your Xiaomi device.
  2. Add a Thing in the SmartThings Classic mobile app (the “+” button at the top of the My Home tab of the app)
  3. Put your Xiaomi device into pairing mode by long-pressing it’s reset/pairing button.
  4. Once paired, it will appear in the ST mobile app, ready to rename to whatever you’d like. If the device handler wasn’t matched to the device, it will show up as a “Thing”, and you’d need to manually assign the device handler in your IDE.
  5. Start using your device.

After a Xiaomi device is paired, you don’t need to long-press the reset/pairing button again, unless it gets dropped from your SmartThing Hub’s network.

Until you use some SmartApp to set up some kind of automation based on using the vibration sensor as a trigger, you will only see visual feedback when viewing the UI (user interface) for the device, by pressing on the device’s name in the list of the My Home tab of the SmartThings Classic mobile app.

Remember that the status of “Stationary”, “Vibration”, “Tilt”, etc. is just visual feedback, and each kind of action corresponds to a linked capability which is what SmartThings uses for automations in SmartApps. Here’s a chart showing the corresponding SmartThings events:

UI displays SmartThings event Time until status is reset ST event on reset
VIBRATION motion = active User-set (default = 65 sec) motion = inactive
TILT acceleration = active 2 seconds acceleration = inactive
DROP button 1 = pushed 2 seconds n/a
STATIONARY (see note below) n/a n/a
Open contact = open n/a n/a
Closed contact = closed n/a n/a

NOTE: The main UI tile will display “STATIONARY” after all status reset timers have finished. So for example, if the sensor detects vibration and then tilt, the UI will display “VIBRATION”, then “TILT” for about 2 seconds, then go back to displaying “VIBRATION” until the 65 second reset timer is finished, and finally will display “STATIONARY.”

It’s also important to note that the main UI tile display is independent of the open/closed/unknown UI tile, because it is totally possible for the sensor to be put into the user-set open or close position while other events (vibration and/or tilt) are happening.


(Marc Zamora) #1051

Thanks for ur answer,

I’m not much into solder, but i might try it.
It happens with all motion sensors? I just purchased the newSamsung motion sensors v3 and I wonder if i will have same behaviour with them or it’s just the Xiaomi.

Thanks for ur time.