[OBSOLETE] Wink Relay - Custom SmartThings Integration

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.

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.

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?

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!

Hi Josh,
Just wanted to say thank you so much for the time and energy put towards this. Please let us know when the wink app is no longer needed. I just set my relay up, and am not logging in to wink. Again, many thanks!

1 Like

Hi !
He work perfectly , thank you! But ActionTiles is not able update state of child device, only parent devices.

Is it possible to fix that ???

Kind of. I had written some code to automatically rename the children devices based on the parent device, but didn’t finish wiring it up. I’ve pushed some updated code for the parent device handler which should handle this now. Whenever the parent device is renamed, the children will automatically be named the same as the parent but with “(Switch n)” appended.

Will do. I need to do some work on preventing android from killing the services when they’re not in the foreground. Android has a tendency to kill off background services by default, but there are a few steps I should be able to take to make it extremely unlikely that Android will kill off the STWinkRelay services.

This sounds more like a question for the ActionTiles guys. Maybe @tgauchat has some thoughts?

I tested with SharpTools and I’m able to see the state of the child devices and parent devices.

That doesn’t sound true.

ActionTiles will reflect the state of any device / Thing that is authorized to the “ActionTiles V6 (Connect)” SmartApp: As long as the Device conforms 100% to a standard Capability.

Seems to load fine based on a quick test.
image

@T1tentrum does the SmartThings app reflect the state of the individual switches properly?

Edit: I see what they’re talking about now. If I control the child switch directly in Action Tiles, the state is reflected properly, but if I control the switch from SmartThings or using the parent switch, the child switch doesn’t stay in sync in ActionTiles.

1 Like

Does the state of Attribute “switch” (not “switch1” or “switch2” or any variation thereof) show the update in the IDE under My Devices / Current States?

Events received by ActionTiles should also be observable in Live Logging.

Thanks!

The events show up, but there’s something else weird going on as if I setup a push event on a child device with SharpTools I don’t get the push events either (but I can query the device status and get the correct status). IIRC, ActionTiles is dependent on push events too, so I’d hazard a guess it’s related.

image

I’ll look into it further… maybe run some tests with the sample virtual composite DTH SmartThings put together as it could just be something fundamentally weird with composite devices and the way the child calls actions in the parent and the parent updates state in the children.

1 Like

in smartthings the condition of the child device is reflected very quickly but the state of the parents is very long and sometimes I refresh manually.

if I go to smartthings and go to ActionTilesV6 and just press save. ActionTiles will put the switches in good condition?

It should force sync to the current values shown in Current States in the IDE. Give it a try?

I push top button on wink relay. After, I push SAVE on ActionTilesV6 and my switch synchronized.

It looks like the child devices not updating their state properly is a known platform issue affecting multiple device handlers:

And:

Once the platform issues are resolved, I would expect the event issues with Wink Relay child switches to be resolved.

1 Like