[Beta] Wink Relay - LAN Integration

Custom integration for connecting the Wink Relay to Hubitat including control of light loads (relays) and 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.

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:

image

The integration is comprised of three components:

  • Custom Android app which runs on the Wink Relay
  • Custom App for automated device discovery
  • Custom Device Driver + Child Device Driver

Included Features

In this initial alpha release, I've focused primarily on the two-way communication between Hubitat 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

*The temperature and humidity will only post an update to Hubitat if they change by more than 0.5 units each.
**The proximity will only change when it has changed more than 100 units.

OEM Disabler

Starting with release 0.3.0, the Android app includes a feature to disable the OEM Wink Relay app and includes the ability to wake the LCD screen based on screen touches or button presses.

Also note that the 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.

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 driver as switch style attributes as well as pushable button attributes. These button events can be used in Rule Machine to trigger actions like controlling other things, changing modes, running scenes, etc.

  • topButton = [ "on", "off"]
  • bottomButton = [ "on", "off"]
  • pushed = [1, 2]
    • 1=top, 2=bottom

Screen Backlight Control
The screen backlight can be controlled with the screenBacklightOn() and screenBacklightOff() commands. These can be called from other custom Apps like Rule Machine.

Installation

High Level Instructions

  1. Open the Hubitat portal on your hub and:
    1. Install the App
    2. Install the Device Driver
    3. Install the Child Device Driver
  2. On the Wink Relay (achieve root and install the custom app):
    1. Root your Wink Relay
      Note: See the Rooting Instructions section below for details.

    2. 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:

      1. Download the STWinkRelay.apk to your computer
      2. Open a command prompt / terminal
      3. Change directory to the location where you downloaded the apk
      cd C:\users\{youraccount}\Downloads
      
      1. Run the installation command:
      adb install -r STWinkRelay_1-1-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.

    3. 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 Hubitat 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.

      image

  3. From the Hubitat portal on your Hub:
    1. Navigate to the Apps tab
    2. Choose to Add a New App
    3. Scroll down to the bottom of the screen and select "STWinkRelay" and tap to continue
    4. Wait for the Device Discovery to complete
    5. After selecting your device from the list, select Save to complete the installation of your device(s)

You should now have a working 'Wink Relay' device (and a couple child devices) in your Devices list! Open the device from your Device 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

:warning: 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
    1. While holding top right switch (physical button) on Relay, press soft reset button underneath faceplate
    2. Continue holding top right button until “System recovery” screen appears
    3. Press bottom switch twice, or until “wipe data/factory reset…” is highlighted
    4. Press top switch once to select “wipe data/factory reset…” option
    5. Screen will display message - “Confirm wipe of all user data? THIS CAN NOT BE UNDONE”
    6. Using bottom switch, navigate down until “Yes - - delete all user data” is selected
    7. “Wiping data… Formatting /data…” screen will appear, followed by original “System recovery” screen
    8. Press top switch to select “Reboot system now” option. “ERROR” may appear on screen, this is normal.
    9. 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

:information_source: 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:

  1. Open the existing STWinkRelay app
  2. Tap the Settings icon in the top-right corner
  3. Tap General > Update
  4. Tap the Get Update button

It will try to download and install the update, but won’t be able to complete it

  1. Navigate back to your homescreen and open the app drawer
  2. Long-press on the existing STWinkRelay app and uninstall it
  3. Open the Downloads app
  4. Select the STWinkRelay_1-1-0a file that should be in the downloads folder already
  5. 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

16 Likes

This rocks! I’ve had two of these things for a while now. Tried using one for the main kitchen lights but it just never worked well. Then the main issue I had is that it loses its state when the power goes out. So if the lights were on and we lost power… everything would turn off, and we couldn’t turn them back on until it finished booting up. But I’d still love to use it in a few rooms! I’m gonna check this out as soon as I can!

4 Likes

@josh

Nice work!

I took a quick look at your DH that you linked in the post above and see that it still has “physicalgraph.device.HubAction” calls in it. I thought all of the “physicalgraph” references had to be changed to “hubitat”. Just curious…

Again - great project and congrats on being the first Hubitat Community Project published!

2 Likes

Thanks for the catch. I’ll double check when I get home. I thought I had replaced all the calls in my code, but I might have forgot to git push my final changes. :stuck_out_tongue:

Edit: I still had the file open in my editor but unsaved! I was able to remote in, save, and push. Should be good now.

Interesting. I had never noticed this with the stock Wink Relay app but my power has been relatively stable. I could add something in my STWinkRelay app that persists the state to storage so it could rehydrate and restore the state whenever it boots up.... unfortunately, their design fundamentally relies on the Android OS to fully boot before it can control the lights.

2 Likes

I updated the driver to properly support the PushableButton capability which makes the integration with several of the stock Hubitat apps easy to use. For example, within the STWinkRelay app I have configured the top button set to control Relay 1 and the bottom button set to do nothing (both send the button event to Hubitat regardless of on-device control configuration). Then in Rule Machine, I setup a trigger to react to the second button being pressed to trigger a nearby set of lights to toggle on.

It's fun seeing it in action - since everything is local it's super fast!

5 Likes

Thanks for sharing this. The httpGet example using hubaction will be very helpful to me. Do you have to use hubAction or is there a direct set of http functions?
EDIT: never mind, stupid q… they do different things.

This is awesome! I picked up a Relay during the black friday sale and finally got around to installing it. Works great with SmartTiles. Few questions: How do you deal with the screen backlight? Calling screenBacklightOn() keeps it on, but as soon as the screen is touched it seems the timeout is enabled again and turns off within 30 seconds. The screenBacklight state doesn’t update to reflect this. Do you know if there’s another setting to disable or modify the internal timeout?

Thanks for working on this, it’s an awesome integration!

I can add a method to the APK to disable the timeout on touch.

Fair warning that I’ve seen some issues with the bottom button presses on the physical switch causing the APK to crash. I looked into it briefly, but have been busy with other projects.

2 Likes

A settings option or command to call to disable the timeout on touch would be great!

Thanks for the heads up. Luckily I have the bottom switch wired up to a light that’s rarely used, and the top button will mostly be controlled by automation.

Hate to bump this old thread—I just received a Wink Relay, and it appears to be corrupt. It gets stuck on the Wink boot logo. Just got off the phone with Wink support, but there’s nothing that can be done to repair it, since Edison.zip is missing.

Does anyone have a copy of Edison.zip they could send me? I’d really love to get this working with Hubitat. :slight_smile: If not, I will return this unit.

Thanks!

Have you checked XDA? I recall some people passing around files for recovering Wink Relays there.

I did; no dice. Maybe I should just buy another one and dump the file from there :laughing:

Have you tried the factory reset (search for Wink Relay hard reset)? I have one of these that got corrupted but was able to get it going again.

2 Likes

I have. Unfortunately, my Edison.zip doesn’t seem to exist (or it is corrupt) on my device.

I have until October 30 to ship it for a return. My preference is to fix it before then and not waste shipping costs.

I don’t suppose you’d be willing to send me a copy of your Edison.zip from your wink’s /firmware folder? Otherwise, I’ve desperately resorted to compiling my own firmware for it from Wink’s github (installed an Ubuntu VM just to compile it).

Sorry I don't have it; I use my Relay stock (just for ActionTiles) and haven't pulled any files off it.

2 Likes

Someone at the SmartThings community had a copy of edison.zip and I haven't needed to use my build of the kernel after all. :slight_smile: I'm hopeful to get this thing working!

I can't get the top button of the relay to trigger a rule. I created the exact same rule for both the top and bottom buttons, but only the bottom button works when I press it. Any ideas why this is happening?

Do you see the top button events coming across in the device page?

I see events that's say topButton that says "on" and "off," but it doesn't ever have a pushed event for "1" where the bottomButton always is preceded by a pushed event for "2".