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

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

I have uploaded the newest beta device handler code, and after a bunch of testing I feel comfortable calling this the first “stable” beta version.

The new DTH code can be grabbed from here.

Changes

  • The UI main tile now displays correct vibration, tilt, and drop events as they happen
  • Main UI tile displays these statuses: “Stationary”, “Vibration/Shock”, “Tilt”, or “Drop”
  • The secondary information in the main UI tile has been changed to display the date/time of the most recent event of any kind
  • The other UI tiles have been rearranged to 3-Axis & Battery in first row, Angle Change, Vibration Level, and Sensitivity Level in the second, followed by the Battery Changed date in the last row
  • Events for vibration (Motion = active), tilt (Acceleration = active), and drop (Button = pushed) correctly occur and are displayed in events list
  • Added user preference setting for time until Vibration/Shock status is cleared and Motion state reset to inactive. The default is 65 seconds.
  • Tilt (Acceleration = active) events are now automatically reset after 2 seconds to “Stationary” / Acceleration = inactive
  • Drop event status is now automatically reset after 2 seconds to “Stationary”
  • The hardware sensitivity level setting can now be changed by pressing the “Sensitivity Level:” UI tile. The preference setting for setting the sensitivity level has been removed. I cannot confirm whether the level change command is actually taking effect, however.
  • Fixed parsing of model name message when reset button is short-pressed
  • Changed device Health Check interval time to 3 hours, 2 minutes to allow two missed check-ins before Health Check (if enabled) marks the sensor as “offline”
  • Changed battery report log message from [debug] to [info] log message type
  • Minor fixes to formatting of event / log message output

Still to do

  • Implement open/close position functionality, using Accelerometer XYZ values to store user-set positions, which trigger Contact = open / close events
  • Find some way to make use of the reported “vibration level” values
  • Clean up of UI

Screenshot of new UI tile arrangement:

NOTES:

As mentioned in my post a few days ago, it’s important to understand the relationship between the status displayed in the mobile app user interface (“vibration/shock”, “tilt”, & “drop”) and what events these are generating in SmartThings to make use of in your home automation SmartApps. While the main tile can display multiple statuses/events, in the events list for the device, you’ll see they match up with specific sensor capabilities, which are cleared out after different periods of time, as follows:

UI displays SmartThings event Time until status is reset ST event on reset
Vibration/Shock Detected Motion = active User-set (default = 65 sec) Motion = inactive
Tilt Detected Acceleration = active 2 seconds Acceleration = inactive
Drop Detected Button 1 = pushed 2 seconds n/a

This sensor is a fairly complicated and quirky device, and it’s difficult working with the way that it sends messages that can interrupt previous events. For example, after a vibration detection message is sent, both tilts and drops can be detected almost immediately after, but if the sensor continues to be on a vibrating surface, a subsequent vibration detected message may or may not come 60 seconds later. So how the sensor is to be used and properly mounting it to get the events you need will be important considerations.

Unfortunately, there is no feedback message when the command to change the hardware sensitivity level is sent. So I’m still not sure if it’s working or not. Repeat shock tests with a consistent level of force aren’t easy to do, and that would be a good way to check if the sensitivity level is actually changing. Any “field testing” of this would be greatly appreciated.

Many thanks to @CopyCat73 and @ oltman (on GitHub) for input and code change suggestions that went into this latest beta version.

2 Likes