I’ve developed a custom integration for connecting the Wink Relay to SmartThings and would like to share it with the community. With the integration, you can control the light loads (relays) and get instant status updates for the sensors, light loads, and button presses. The integration is all performed over your local network with no additional dependencies on IFTTT, Stringify, or other cloud services.
This integration was originally written for Groovy and does not work since SmartThings shutdown Groovy in 2023. The source code for the Groovy Device Type Handler (DTH) and SmartApp are open source and available below if anyone from the community wants to take over and port things to an Edge Driver.
Developer Note: I am not personally using Wink Relay devices any more, but the integration remains available for you to use! While I love the form factor, I prefer running a larger wall mounted tablet with the SharpTools.io dashboard now:
The integration is comprised of three components:
- Custom app which runs on the Wink Relay
- Custom SmartApp for automated device discovery
- Custom Device Type Handler
I would emphasize that this is a beta release - several people have tested it at this point, but there may still be outstanding bugs.
Included Features
I’ve focused primarily on the two-way communication between SmartThings and the Wink Relay. This includes the following features:
- Instant Status Updates for:
- Temperature*
- Humidity*
- Proximity**
- Relay 1 and Relay 2
- Top and Bottom Buttons
- Control:
- Relay 1
- Relay 2
- Both relays simultaneously
- Screen backlight
- Additional Features
- Disable base Wink Relay app
- Screen wake on touch
- Buttons control the relays
- Buttons can be mapped to other actions
*The temperature
and humidity
will only post an update to SmartThings if they change by more than 0.5
units each.
**The proximity
will only change when it has changed more than 100
units.
Notable Exceptions
Proximity values are currently sent across as the raw value anytime the raw number changes more than 100
units. It’s not clear to me what the unit of measure is for the proximity sensor, so I’ll need to investigate this further before I feel comfortable adding some logic to map it to a motion
attribute.
I’ve added a wake-on-motion feature to the STWinkRelay APK which lets you set a proximity threshold for waking the screen. Like many others, I found that the proximity values drifted throughout the day. If anyone figures out a better heuristic for waking the screen, please feel free to share it.
Other Features
This release includes a few additional features which are not exposed in the device tiles, but may be helpful in other SmartApps and Integrations.
Wink Relay Buttons
The status of the Wink Relay buttons are mapped to attribute values in the device handler, but do not display in the device tiles. My thought is some people may want to use the buttons to trigger events in other SmartApps. For example, you might use the buttons to trigger an action in WebCoRE or on other Android devices with SharpTools.
Screen Backlight Control
The screen backlight can be controlled with the screenBacklightOn()
and screenBacklightOff()
commands. These can be called from other custom SmartApps like WebCoRE or SharpTools.
Installation
High Level Instructions
- Open the SmartThings IDE and:
- Install the SmartApp
- Install the Device Type Handler
- Install the Child Device Type Handler
- On the Wink Relay (achieve root and install the custom app):
-
Root your Wink Relay
Note: See the Rooting Instructions section below for details. -
Install the STWinkRelay.apk custom app
Note: You can either do this by opening the STWinkRelay APK using your web browser (if you still have it) or install via ADB. For the web-browser approach, make sure you have “Unknown Sources” allowed for installation.ADB Details
For the ADB approach:
- Download the STWinkRelay.apk to your computer
- Open a command prompt / terminal
- Change directory to the location where you downloaded the apk
cd C:\users\{youraccount}\Downloads
- Run the installation command:
adb install -r STWinkRelay_1-0-0a.apk
Note: You will either have to have ADB in your path or have ADB accessible in the same directory in which you have the APK downloaded. If you have installation protection enabled from KingRoot, be sure to approve the installation physically on the device before the timer runs out.
-
Open the custom Wink Relay app at least once
Note: If you have root management enabled, be sure to approve the permission request on the physical device before the timer runs out.
Note: There are a number of services which run in the background including device discovery, services for watching the sensors and buttons, and a web server for SmartThings to send commands to the device. These services are set to automatically start when the device is booted, but you may have to open the app once immediately after installing it in order to kick off the services.
-
- On the SmartThings Mobile App:
- Navigate to the Automation tab at the bottom of the screen
- Navigate to the SmartApps tab at the top of the screen
- Scroll down to the bottom of the screen and select “Add a SmartApp”
- Scroll down to bottom of the list and select “My Apps”
- Find “Wink Relay” and tap to continue.
- Wait for the Device Discovery to complete
- After selecting your device from the list, select Save to complete the installation of your device
You should now have a working ‘Wink Relay’ device in your Things list! Open the device from your Things list and tap refresh to make sure everything is synced up.
Rooting Instructions
Use the Wink Relay wiki entry on ThingsThatAreSmart.wiki as a reference:
http://thingsthataresmart.wiki/index.php?title=Wink_Relay
Important: Stop at step 32. You should not need the Root Package Disabler or any adb commands for this project.
Tips and Tricks:
- You may want to factory reset your Wink Relay before proceeding with the rooting / installation steps (see the section immediately below)
How to Factory Reset
- While holding top right switch (physical button) on Relay, press soft reset button underneath faceplate
- Continue holding top right button until “System recovery” screen appears
- Press bottom switch twice, or until “wipe data/factory reset…” is highlighted
- Press top switch once to select “wipe data/factory reset…” option
- Screen will display message - “Confirm wipe of all user data? THIS CAN NOT BE UNDONE”
- Using bottom switch, navigate down until “Yes - - delete all user data” is selected
- “Wiping data… Formatting /data…” screen will appear, followed by original “System recovery” screen
- Press top switch to select “Reboot system now” option. “ERROR” may appear on screen, this is normal.
- Relay will reboot, and should eventually load main Relay home screen. If home screen does not load, Relay may require one more soft-reset (press button under faceplate).
- You may have to install an old version of Assistive Touch - the Wink Relay is running an old version of Android, so newer versions might not work.
- Many people have chosen to use Firefox instead of Chrome (again, you may have to use an older version of the software)
- In the section about Setting up the Wink Software, this part might not be absolutely required.
- We’ll see if the updates stay available when Wink starts requiring a paid subscription.
- It’s unclear what’s included in the updates, but I believe at least one of the updates changes the default screen resolution
- Some users have noted that the KingRoot website is no longer available, but you can install KingRoot directly from APK Pure
If anyone wants to update the Things That Are Smart Wiki entry, please go ahead and do so! The original wiki entry author posted in this thread that they are supportive of that decision.
Upgrading from Older Versions (<1.0)
How to Upgrade from Old Versions
From the Wink Relay:
- Open the existing STWinkRelay app
- Tap the Settings icon in the top-right corner
- Tap General > Update
- Tap the Get Update button
It will try to download and install the update, but won’t be able to complete it
- Navigate back to your homescreen and open the app drawer
- Long-press on the existing STWinkRelay app and uninstall it
- Open the Downloads app
- Select the STWinkRelay_1-0-0a file that should be in the downloads folder already
- Open the new STWinkRelay app and enjoy!
Alternatively, you can download things manually via a web browser on the Wink Relay (or install via ADB). Instructions are available at http://wink.boshdirect.com