I’ve been using some holiday time to get up to speed on how exactly SmartThings works with groovy more in depth, and specially the Zigbee protocol.
This took me into a heavy journey of reading the ZCL standard, the ST groovy docs, groovy, and re-visiting java and data types.
The Device handler is now written in the latest Zigbee groovy code (zigbee.something()), and I heavily commented it for anyone to understand how a Zigbee device handler works, and other things. Also removed most of the debugs, added some info events, and removed the tiles code, which is no longer needed in the new app.
TL;DR: It now fully works under the new App, Temperature works (measurements are ugly, has an offset setting), Power works, Energy usage works.
Note: I’ve made the fingerprinting specially for the ZNCZ02LM model (CN/AU/NZ/AR), but in theory should work with the other zigbee models since if understood correctly it uses the same clusters. (If you read this and you can, test it by setting the device type in the IDE manually and then send me the fingerprint data if it works (Data and Raw description in the device, in ''My Devices" in the IDE) so I can add it to the code )
Current Version: V1.2 (12 Jan, 2021)
V1.1 (Jan 10, 2021):
- Fix for correct encoding data type
V1.2 (Jan 12, 2021):
- Add health check capability
- more and more comments and learnings
- added data refresh poll setting
- added automatic data poll refresh every X minutes just in case some zigbee message is not reported even if set by configureReporting for any reason
- reorganized code structure so native/non-native methods are understood
Device Handler Code: Xioami Zigbee Smart Outlet DTH :
How to install the device handler:
1.- go into the SmartThings Groovy IDE: SmartThings IDE
2.- go into the tab 'device handlers’
3.- Click on the upper right button '+ Create New Device Handler’
4.- Select the tab ‘From code’
5.- Copy the previous link’s code in there.
6.- Click on the ‘create’ button.
7.- on the upper right corner, click on the ‘save’ button, and then, click on the ‘publish’ button, and select ‘for me’
That’s it!, now adding the Xiaomi Zigbee Smart Outlet should be automatically recognized