[Beta] Wink Relay - LAN Integration

community_app
community_driver

#1

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.

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

Included Features

In this initial alpha release, 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

*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.

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
  2. On the Wink Relay (achieve root and install the custom app):
    1. Root your Wink Relay (www.kingroot.net)
      Note: The rooting instructions from ThingsThatAreSmart.wiki are helpful.

    2. Install the STWinkRelay.apk custom app
      Note: You can either do this by opening the 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.

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

      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

You should now have a working 'Wink Relay' device in your Devices list! Open the device from your Device list and tap refresh to make sure everything is synced up.

Detailed Instructions
Coming soon! In the mean-time, use the instructions above and the Wink Relay wiki entry on ThingsThatAreSmart.wiki as a reference:
http://thingsthataresmart.wiki/index.php?title=Wink_Relay


Should this be a driver or an app?
Where to post new Apps and Device Drivers?
Community Device Drivers (FKA Compatible Devices Wiki)
#2

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!


#3

@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!


#4

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.


#5

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.


#6

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!


#7

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.


#8

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!


#9

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.


#10

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.


#11

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!


#12

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


#13

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


#14

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.


#15

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).


#16

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


#17

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!


#18

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?


#19

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


#20

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".