Announcing: Update to v1.0 for all Xiaomi device handlers (except ZigBee Outlet)
Available now from the bspranger/Xiaomi repository on GitHub.
Change & Fixes:
All Xiaomi device handlers
• Now standardized across all device handlers
• Reorganized preference settings into groups with headings
• Added notes to clarify some settings
• Battery reporting now standardized across all device handlers
• Improved code to avoid incorrect reported values
• Battery Changed date automatically set when device is paired
• Removed display of Last Checkin events from “Recently” tab of mobile app
• Removed unnecessary debug log messages displayed to Live Logging in IDE
• Added new informative debug log messages to some DTHs
• Centered smaller tiles displayed in user interface
• Renamed “Last Checkin” tile to “Last Event”
• All preference setting defaults are handled correctly
• Fixed / removed all code known to cause errors
• Cleaned up / organized code
• Code is better documented with comments to help others understand how it works
• Removed outdated change log in header section (refer to GitHub for history of all changes)
Button device handlers
• “Held” button mode now called “Momentary”
• Unused time setting removed from “original” Xiaomi button preferences
Door / Window sensor device handlers
• Improved responsiveness of open/close events
• Last Opened date no longer displays time of close events
Motion Detector sensor device handlers
• The motion detected preference setting now works correctly
Temperature / Humidity sensor device handlers
• Added option to record and display temperature in main tile as integer (takes effect on next temp report)
• Added daily high/low temperature & humidity tracking
• Added preferences to display daily high/low temp and/or humidity in main tile
• Changed temperature offset preference to allow decimal values to 0.1 precision
Prior to this update, whenever sensor sent any report, at the same time Last Checkin date/time event was also recorded and displayed in the events log / Recently tab of the mobile app. However Xiaomi devices never actually “check in”, and so the lastCheckin events are basically redundant and cluttering up the Recently tab.
The best and only way to know if your idle Xiaomi device is still connected is battery reports. All Xiaomi devices send a battery report roughly every 50-60 minutes. I have seen single missed battery reports a few times with my dozen Xiaomi sensors, so I’d say if there hasn’t been any battery reports for 2 hours, then check whether the sensor is still connected by a short-press of its reset button. That will send a message that will show up in the SmartThings IDE Live Logging page, if the sensor is still connected.
Despite the removal of lastCheckin events being displayed, they are still logged as a state change and can be viewed in IDE > Devices > your device and click lastCheckin in the Current States section of the page. Also, lastCheckin is still used for the renamed “Last Event” tile displayed in the UI for any Xiaomi device in the ST mobile app. So a quick look at that tile will tell you when the device last sent any report to the hub.
On both the “original” Xiaomi and Aqara buttons, two modes are available: Momentary and Toggle. Toggle works the same with both buttons - every time the button is pressed, the device handler alternates between pushed & released.
However, the Momentary mode works differently on each of the two types of buttons. The “original” Xiaomi button sends a pushed message to the hub when the button is pressed, and when the button is released, it sends a released message. So the Momentary mode in the “original” Xiaomi button device handler just passes on that information to SmartThings, and then either the devices you control or SmartApps can be set to do different actions based on how long the button is held for.
On the other hand, the Aqara button only sends a pushed message to the hub when it is pressed. So there is no way to know how long an Aqara button is held, because it does not send a released message. Because of this, the Momentary mode in the Aqara button device handler has to emulate a hold and release action by using a customizable timer. The length of time until the released message is sent to the hub by the device handler can be set in the preference setting called “Minimum time in seconds for a press to clear”. If Momentary mode is selected, and the “Minimum time…” preference is set to 5 seconds, when the button is pressed, SmartThings will see that it remains pushed for 5 seconds, and then released.
In normal operation both types of Xiaomi Motion Sensors are “blind” for 60 seconds after they detect motion, in order to save on battery usage. After 60 seconds, the hardware resets and is ready to detect motion again. This 60 second reset delay cannot be changed. However, in the device handler, there is a preference setting to change how long the “motion detected” state remains active, called MOTION RESET. The default is the same as the hardware delay, but it can be changed to any length of time, longer or shorter. Just remember that this setting only affects how long Motion Detected is reported to SmartThings.
NOTE: When first paired to a hub, both types of Motion Sensors run in test mode, for about 2 hours. During the test mode, the sensor can detect motion every 3-5 seconds, which can be useful for deciding the best placement of the sensor. During test mode, we recommend setting the MOTION RESET setting to 6-8 seconds to make it easier to determine whether the sensor is working well at the location you have chosen. After finishing with testing, then the MOTION RESET setting can be changed to a different length of time, according to your preference. Finally, the Aqara motion sensor can also be manually put into test mode for about 2 hours, by a short-press of the hardware reset button.
Temperature / Humidity sensors
The standard method of SmartThings temperature sensor device handlers is to display temperatures as integers, so we have added this capability as an option. The default is the same as before, displaying the reported temperature with 0.1 precision. When the “display as integer” option is changed, it will take effect on the next temperature report from the sensor.
The new daily high/low temperature and humidity feature allows the display of one, both, or neither sets of high/low temperatures and humidity percentages at the bottom of the main tile. The high/low temperatures are only displayed as integers because when displayed with the high/low humidity, there isn’t enough room to keep all the information on one line. The device handler resets both sets of high/low between midnight and 1:00 in the morning every day, and will update all values even if the display isn’t active. Note that the high/low display is designed for convenience. For long-term recording of changes in temperature and humidity, its recommended to use a SmartApp such as Simple Event Logger.
As with any major update of software, there is a good chance that something was missed, so please feel free to post any questions or feedback.