[BETA] Wink Relay - Custom SmartThings Integration



Unfortunately both my relays are now boot looping and unusable, so I won’t be able to give you any further feedback. One occurred when I tried to factory reset (claims edison.zip signature cant be verified as others have mentioned). The other one just froze up and upon me resetting it also started looping (shows Wink relay splash screen and then restarts). This did occur right after installing the your updated app, but I can’t really see how that would have caused the problem. Likely just coincidence.

Anyways, if anyone has any experience recovering from this situation, I’d be thankful for advice!

(Joshua Lyon (SharpTools.io Dashboard)) #42

Sorry to hear that. I’ve been tempted to factory reset my Wink Relay to test things completely from scratch, but I’ve held off based on the stories that people have soft bricked their Wink Relays after a few factory resets. Hopefully you can get both of them back up and running!

(Joshua Lyon (SharpTools.io Dashboard)) #43

I’ve updated both the SmartApp code and the STWinkRelay app. I am still unable to reproduce the SSDP discovery issue that others in this thread are experiencing, but I’ve done some digging through the UPnP docs and made a couple of minor adjustments to better align with the specification.

In working with @idioffo89 the only other thing we’ve identified is that my SmartThings hub is running what appears to be an older firmware 000.016.000014 whereas his hub is running 000.019.00019

The new version of the APK can be downloaded at:

I’ve also added a built-in update feature into the STWinkRelay application. If you navigate to Settings > General > Update App, it will check for an updated version of the app and allow you to download it. When this feature is used (in the future), be sure to open the app again at least once to get the services started again.


I’ve also adjusted the GitHub repository which holds the SmartApp and Device Type code to allow github integration with the SmartThings IDE making it easier to update the code as I push changes. You can enable this feature by going to Graph (IDE) > SmartApps > Settings and then adding a new repository with:

Owner: joshualyon
Name: STWinkRelay

When you are done adding the repository, you can click Update From Repo > STWinkRelay and then check the box for the Wink Relay code and make sure to check the publish button before pressing “Execute Update”.

Alternatively, you can still update the app the old fashioned way, but make note that the URL for the file has changed (and has been updated in the original post in this thread).

When submitting an error report, please include the following information:

  • SmartThings IDE Logs during the time that you attempted the discovery
    • Filter to just the Wink Relay smartapp so it’s easier to look through it
  • STWinkRelay Logs - submit through the app and provide me your device id
  • IP Address of your Wink Relay and SmartThings Hub
  • The rough time that you ran the discovery
    • And any other information you think might be helpful for troubleshooting!

(Chris Hammerbeck) #44

Just got back from the holiday… Good news…I just installed the latest apk and it almost immediately detected my Wink Relay! Will play with it more tomorrow.

Thanks for the updates!

(Joshua Lyon (SharpTools.io Dashboard)) #45

Awesome! Make sure to tap refresh within the device handler at least once as that sets up the push events from the Wink Relay to SmartThings.

I made a few tweaks to the device handler to fix the shared switch state, so you may want to update the device handler to take advantage of that correction.

(Ragai Meena) #46

You are a genius everything is working, able to detect all relays with much facter sync between physical buttons and smartthings
I have one question, how can I use the bottom and top buttons separately in smartthings automation apps, they show as one device not 2

(Joshua Lyon (SharpTools.io Dashboard)) #47

I’ll look into it. IIRC, SmartThings has support for composite devices. It wasn’t high on my list as I usually just use the direct commands on my SmartApps, but I can see how it would be useful in some SmartApps.


This integration is exactly what I was looking for. I just got it up and running on one of my Relays. I would say that the recent comment regarding the 2 switches being treated as seperate things in SmartThings is essential. In fact, if the the 2 switches, humidity, and temperature could somehow be seen as separate things within SmartThings…it would be perfect. Can this happen?

As of now, it has pretty serious limitations, as when you attempt to setup a lighting automation, you must control both switches at the same time, right?

I would really love be be able to access the the humidity and temp and separate devices to be used in automations to help with controlling ventilation as well…

If you need any assistance with achieving this please let me know. L

Thanks for everything so far!

(Joshua Lyon (SharpTools.io Dashboard)) #49

Glad you are enjoying the integration!

It depends on the SmartApp. Some of the first part SmartApps have fixed commands like on() and off() whereas some of the community SmartApps like CoRE or SharpTools let you pick direct commands like relay1On() and relay1Off() as shown in the screenshot immediately above.

Thanks for your +1 on the composite device though… I’ll look into it.

I might be missing the use case on this part as there’s a lot of device handlers with humidity and temperature combined. What specific use case are you working on that require the temperature and humidity to be separate devices?

The SmartApp and DTH are open source, so if you want to take a stab at it and submit a PR, I’m happy to look at it. :smiley:

(alvarez513@gmail.com) #50

The new version works! I was able to detect and add the relay to smartthings… Now just need to get some ideas in terms of what it can be used for, if you or anyone have any nifty use cases I’d love to hear them.

(Joshua Lyon (SharpTools.io Dashboard)) #51

Right now I just use it as part of an automated routine that turns the lights on before it gets dark. And some basic voice control with Alexa/Google to turn it off.

If I can get the proximity sensor to reliably trigger as a motion sensor, I’d like to use it to automatically turn lights on in a nearby room whenever I walk by the Wink Relay. That way if it’s dark at night and I’m walking through the house, the path in front of me will automatically light up as I walk by various sensors.

Edit: I also have SharpTools on the Wink Relay, so if I ever need a bit more control over things, I just switch over to SharpTools and take the action I need. For example, sometimes I’ll adjust the temperature of the thermostat from my Wink Relay.

Once I’m comfortable that things are stable, I’d like to add a few more features like being able to customize what the button presses on the Wink Relay do. Maybe even have the ability to differentiate between a single tap, double tap, and long-tap to trigger different actions in SmartThings. For example, one of my relays is near the master bedroom, so it would be cool if I could long-press on the bottom button to trigger a routine that turns off all the lights in the house before I walk into the bedroom.

(Joshua Lyon (SharpTools.io Dashboard)) #52

I’ve updated the Device Type Handler to support the requested composite device format. Please make sure to add the new Child Device Handler code referenced in the first post of this thread. It’s also in GitHub, so if you do an Update From Repo, you should see the updated parent DTH and new child DTH. Note that you may have to remove the existing device and rediscover it as I didn’t test the upgrade process thoroughly.

I also made some minor changes to formatting of the Temperature and Humidity tiles and display the proximity value. (Previously, the proximityRaw value was displayed which only showed when you did a manual refresh. The proximity value is updated by push as well as by manual refresh. You can still see the raw values in the Recently tab or via the IDE)

One trade-off of the composite DTH approach is I couldn’t figure out a good way to make the tile names dynamically reflect the child device name, so they have no label now. This probably isn’t the end of the world though as I see each outlet more abstractly as Relay1 and Relay2 since you can technically reassign the buttons to each relay in the official Wink app.

(JZst) #53

Looks pretty cool! Does anything have to be done with the stock Wink Relay app? It’s a pesky little thing that keeps coming back up to foreground, etc.

BTW, have an option to make the background black on the page for night-time reduction of that bright screen. I use Home Assistant on FireFox with Night Reader add on which converts white to black & vice-versa.

(Joshua Lyon (SharpTools.io Dashboard)) #54

As of right now, nothing needs to be done with the stock Wink Relay application. At some point, I plan on integrating the screen on by touch/proximity and button mapping at which point the stock Wink Relay app could be removed.

Thanks for the feedback on the dark mode. I’ve been mulling around a night mode but didn’t originally add it as I figured this might just run in the background while another dashboard served as the frontend. It should be relatively straightforward though so I’ll look into it.

(Ragai Meena) #55

great work, you are way more responsive than smartthings developer, greatly appreciate it and looking forward to more updates


I really appreciate your responsiveness and desire to improve this. I have updated my device handlers and see that the proximity is responding in nearly real time.

I realize that the desired results can probably be accomplished through different means, though I think that an angle towards simplicity needs to become the standard as the “smart home” scene seems to have very little set standards as of yet. I think that the Wink Relay can be a very valuable asset for those of us on the SmartThings platform, and this implementation could serve as the standard for a wal mounted GUI from here out. Though each capability from the Relay needs to be accessible from within the SmartThings architecture.

One implementation for me personally would be to control a space heater in cold bathroom. As of now I have a space heater plugged into a smart outlet. I had planned on installing a multi-sensor of some sort in the bathroom to tell SmartThings that the room is cold during a certain time period when I wake up for work and turn on the heater.
I plan to install a Wink Relay in the bathroom to serve as the light switch. Doing this would also give me access to the room temperature, humidity, and possibly the proximity sensor as well. If the proximity sensor could be be displayed as a motion sensor this would solve many issues with one simple installation.
I could tell the heater to turn on based on low temperature when there is motion. I could also tell the bathroom ceiling vent fan to run during times of high humidity.
These devices being displayed as individual sensors makes the implementation much simpler.

I have very limited programming experience, but I am glad to give it a try.

Again, thank you for your responsiveness and time!

Also, getting the proximity sensor to wake the screen as the stock Wink Relay app does would be a great asset. As of now I have the stock Wink app killed as it brings itself to the forefront of the screen constantly. My intention with this so far is to have it running ActionTiles as the main screen.

(Joshua Lyon (SharpTools.io Dashboard)) #57

Thanks for the feedback. I may be being dense here, but I’m seeing a bunch of great ideas for how to use the sensors, but I’m not seeing any reason why the sensors need to be individual devices. Adding the extra child devices for each sensor increases the complexity of installing the code and maintaining the code and I’m not seeing how showing each sensor as an individual device helps with the provided examples.

With the current design, I have one master device which has the temperature, humidity, and proximity sensors along with standard commands for on/off (which control both lights at once) and a number of extra commands which work well in SmartApps like SharpTools and CoRE. There’s also two child devices which let you individually control each relay on/off which is helpful for some of the built-in SmartThings lighting automations which are limited to on/off commands (eg. they can’t call custom commands like relay1Off() at the parent device level). So with this setup, you can control each relay individually and you can use the sensors to trigger events in the ways you suggested.

Thanks for the can-do attitude - I already updated the code so each relay/switch shows up as a child device (see post 52)! :smile:

It’s on the list! I want to make sure things are nice and stable before I suggest people remove the main Wink app. My proximity sensor never worked well for waking the screen, so I’m not sure what the right trigger value would be for waking the screen though.

My proximity sensor is generally showing a value around 6000-7000 and if I walk right up next to the Wink Relay, sometimes it gets closer to 8000. If I put my finger directly over the sensor, it goes up closer to 65000. It’s almost as if the sensor is just a traditional cell phone proximity sensor that is supposed to detect if the phone is next to your head. Either that or my sensor is just broken. :stuck_out_tongue:

What values are you seeing for your proximity sensor?


My proximity sensor seems to sit at around 1700-1750 if nothing is in front, and goes up to 1800-1850 when I step in front of it, but it tends to fluctuate gradually a bit. Then it goes up to around 48,000 if I put my finger over the sensor. I think an effective way to deal with the sensor and differences between units would be to trigger a motion event based on an increase over a span of time (i.e. 100 “units” in 1 second)

For example let’s say we require a 100 increase in a second to trigger the proximity sensor… At second zero we set the baseline (which might be 1700 for some, 1800 for others, or in your case 6000) then if by the next second the reading has increased by at least 100 we can say we’ve detected motion. If not, we set our baseline to whatever the current value is and check it again for a 100 increase from our new baseline in the next second increment. That way small changes don’t cause it to trigger, and your unit’s baseline wont affect reliability.

Realistically I think we’d need it to be less than 100 to work properly (maybe 50, or somewhere in between). Maybe make the delta adjustable in the app’s settings?

(Joshua Lyon (SharpTools.io Dashboard)) #59

That’s basically what I’m doing at this point. If the sensor value has changed more than 100 units in 0.5 seconds, I push the updated value.

Making the threshold adjustable is seeming more likely as the solution - especially considering each of our Wink Relays are seeing such different base values… I’m not sure that I’d trust the deltas to be the same for each person. Even with the delta of 100, I still get proximity events pushed to SmartThings even when I’m not home.

I may also look at smoothing out some of the noise by looking for an overall delta over a longer period of time. For example, if the value changes from the baseline by 100 and stays at least changed that much in 4-6 cycles, then trigger an event. The downside of this is the motion event wouldn’t trigger for 2-3 seconds.

It would be helpful to have more data points as to what other people are seeing for proximity values to determine the right approach.


Ok, thanks for explaining. I do like the CORE so far, though I have just started using it. I wasn’t really think about that when I asked about separate devices…

I see that I can setup automations using Relay Switch 1 or Relay Switch 2 within CORE, but the serperate switches still won’t be accessible the the things list of the stock smartthings app? I guess the only issue I can think of now is organization. If I had 3 or 4 Relays in my system…would all the individual switches be shown as Relay Switch 1 and Relay Switch 2? Is there a way to name them?

Thanks again!