[BETA RELEASE] Lutron support in SmartThings using custom Wink Hub software - looking for testers / the adventurous

Hi folks!

The skinny: I have Lutron devices connecting to SmartThings over a rooted Wink Hub, and I’m looking for people to help test this out. There are a few jagged edges, but most of the functionality is solid (see known issues below) - still, expect some finagling with the hub during initial setup.

Currently, this is working with Pico remote controls, which can be used as both minimotes and virtual dimmers (e.g. for lighting control), as well as Caseta in-wall and plug-in dimmers. Other Clear Connect devices should be easy to support, if you’re in the mood to either write them or make hardware donations :slight_smile:

The newest version supports pairing Pico remotes directly to Caseta dimmers through the built-in hardware pairing list of the remotes as well as pairing through the hub. You can maintain both types of pairing simultaneously. Once established, a hardware pairing between a Pico and a Caseta is extremely fast and reliable (far faster than going through the SmartThings hub), just like a light switch should be, and will continue to work if SmartThings or your hub experience downtime.

To install:

This is a two part system. You’ll need both the SmartApp and the Wink Hub software. I suggest using this on a Wink Hub you don’t care about, since this may screw it up if something goes wrong.

The SmartApp lives at https://github.com/mbarnathan/SmartWink/tree/master/build. Just copy the smartapp and all device types into the IDE like any other third-party SmartApp. It’s in the Labs category and the installation process is much like the Philips Hue.

The tarball to extract to the Wink Hub currently lives in the GitHub repo: https://github.com/mbarnathan/SmartWink/blob/master/hub_software/binaries.tar.gz

To install that, copy it to the root of the wink hub, gunzip it, and extract the files from the tar. Reboot the hub, and check that everything is running:

[root@flex-dvt ~]# ps | grep smartwink
1150 root     {lutron-monitor} /bin/sh /usr/share/smartwink/lutron-monitor -
1169 root     {discovery-serve} /bin/sh /usr/share/smartwink/discovery-server
1171 root     socat -u UDP4-RECVFROM:1900,ip-add-membership=239.255.255.250:wlan0,fork,ip-pktinfo,reuseaddr SYSTEM:grep -o -E 'urn:schemas-smartwink:device:SmartWink:1\\|ssdp:all\\|ssdp:discover' | xargs -t -n 1 -r /usr/share/smartwink/discovery-respond $SOCAT_PEERADDR $SOCAT_PEERPORT $SOCAT_IP_LOCADDR 1900 $SOCAT_IP_IF
1174 root     {subscribe-liste} /bin/bash /usr/share/smartwink/subscribe-listen
1176 root     socat TCP-listen:1081,fork,reuseaddr,crnl EXEC:php /usr/share/smartwink/subscribe.php
1217 root     {apron-wrapper} /bin/sh /usr/share/smartwink/apron-wrapper
1222 root     {apron-monitor} /bin/sh /usr/share/smartwink/apron-monitor -

[root@flex-dvt ~]# curl http://localhost/lutron.php
[{"id":9,"serial":11111111,"name":"Caseta Plug-in Dimmer","type":"PID_DIMMER"},
{"id":10,"serial":22222222,"name":"Caseta Wall Dimmer","type":"WALL_DIMMER"},
{"id":11,"serial":33333333,"name":"3 Button Pico with Raise\/Lower","type":"PICO"}]

(Your output will differ, and will be an empty array if you have nothing paired - but the important thing is that you can connect and don’t get a 404).

With those sanity checks out of the way, start up the app and give it a try!

Known issues:

  1. Button press events from Pico remotes are usually delivered in one serial read. Occasionally (~10%) they’re split across two reads, and these presses will not be detected yet.
  2. Devices first install in the “on” state. The device may need to be toggled before it picks up the correct state.
  3. I’ve sometimes seen it take a minute or two after a device is first installed for it to become responsive. I think the write to /database/smartwink_subscriptions is being buffered, if anyone wants to investigate.
  4. I have no idea if any of this works with the SmartThings v2 hub.
  5. The Wink Hub piece needs a proper installer, or firmware. I didn’t package it in this way because I didn’t want to take the chance of bricking my only hub, or running afoul of Wink for redistributing their software.

Looking forward to feedback, and hope this makes people’s setups easier!

Cheers,
Michael

12 Likes

Michael,

I just found your post and I’m trying to figure out how to use your code and whether to grab a second Wink hub to root. Like hundreds of other former Wink users, I have several Caseta/Pico switches that are still controlled by my (unmodified) Wink Hub and do not interface to ST (v2 hub).

I’m surprised there aren’t a few responses. Since you posted, how has it been working?

I’m experienced at rooting my Android devices - is rooting the Wink Hub similar?

I’m surprised as well - I thought this feature was in fairly high demand. It’s generally working well on my setup, with the occasional “is this me or is this SmartThings?” moment (generally, it’s SmartThings, which led me to develop the “Hard Link Pico” SmartApp to manage direct device pairings between Pico and Caseta while also maintaining communication with the hub). There have been a few times when I’ve said “oh, here’s an edge case” and published bugfixes.

Rooting the Wink hub is a little more challenging than rooting an Android device, but not significantly more so. There’s a blog with instructions on how to do it (not going to directly link to it because someone might decide they want to take my post down) - the important thing is to do it on a fresh hub before connecting it to the Internet, since a firmware update makes things harder. Another challenge you may face relates to the fact that only the changed files are present in the tarball: I wrote this after updating to v2.19 of the Wink firmware, which disabled the built-in lighttpd and PHP (thus why they’re back again in my mod). Aside from the hard link app (which relies on Pico pairing functionality that doesn’t exist in early versions of aprond), I don’t see too many reasons why it wouldn’t work on a fresh install, but I haven’t personally tried that.

All in all, if you’re looking to test it out, I’ll be happy to help, but I also make no guarantees your Wink Hub won’t turn into a doorstop :smile:

I just rooted my wink hub. I have 6 lutron caseta switches running amok without local control. Will give this a go tomorrow and report back !!

I’m really interested in this, but I got stuck at rooting. Was your hub updated to current firmware?

I rooted it straight out of the box, since a Wink firmware update eliminates the PHP file that’s used to achieve root. There are still documented ways to root it on a few blogs (I probably shouldn’t post them here), but it does become harder if the firmware’s updated.

Hello Michael, First, Thank you for this work! I really look forward to testing it.

I have a rooted WINK hub which I can access. I managed to get the binaries.tar.gz file to the root, and unzip.
I am not familiar with Linux, and when I try to un-tar the file with the -xvf I get an error on the hub that reads “invalid tar magic”.

Any suggestions?

Thanks again!

Well nevermind my last post, I got beyond that by re-Gziping the files.

I got everything copied over and rebooted the Wink Hub. It returned to a green state, and I am able to SSH into it, but it does not seem to be connecting to the WINK cloud and I am not able to connect with the WINK app.

Any suggestions?

Thanks again,

Yep, the version of tar bundled with wink doesn’t have native gunzip support (the “z” flag), so you need to do the gunzip as a separate command. Glad you got it sorted!

Part of rooting the Wink hub is usually cutting it off from the Wink cloud (there’s something the guide recommends you add to your hosts file that disables communication with it). You can probably reenable that communication by removing the /etc/hosts file entry for api.wink.com, but presumably the hub could phone home with that access. SmartWink itself won’t do anything to stop the Wink hub working as a Wink hub, as far as I know - though I haven’t tried to use it that way.

Sorry for all the questions, but I seem to make progress with each answer you provide. Since our last communication I have been able to bring the Wink Hub online, add it to the SmartWink SmartApp and even pair an unused PICO remote to SmartThings. (I have only started to use SmartThings in the last two weeks, as I am a former Staples Connect user).

Now that I have the PICO added as a device, how can I use it to control a specific light that is also added to SmartThings? Again, sorry if this seems simple, but I am still learning the SmartThings methodology. Once I get this sorted out, I should be able to convert all of my Lutron devices from Staples Connect into SmartThings and shut down that system.

So onto the next issue, if you don’t mind helping. I have moved to adding a Caseta Plug-In dimmer. The SmartWink pairing will find the device and add it to the list of select devices to manage.

When I go to finish and select DONE, I receive an error in the mobile client: Failed to save page: deviceDiscovery.

In the logs I capture:
error physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘PID_DIMMER’ in namespace ‘smartwink’ not found. @ line 328

I have removed the Lutron device and re-added using the aprontest command directly from the hub, but this doesn’t make a difference.

Any suggestions? Thanks!

No worries, this is good feedback :slight_smile:

Sounds like you almost have it! Once the Pico is added, you can use it as either a dimmer device (e.g. connecting it with the Smart Lighting app) or a button controller, like the Aeon minimote (press some buttons and check the “recently” list for the device in SmartThings for the button numbers. IIRC, 2 = on, 3 = middle, 4 = off, 5 = up, 6 = down). Or if you add both a Caseta and Pico, you can tie them together directly using the “hard link Pico” SmartApp, which will be far faster and more reliable than tying them together as SmartThings devices.

The easiest way to ensure that the Wink Hub is recognizing the Pico button press is to press the button and watch the LED on the hub - it should briefly flash brighter to acknowledge the press. You can also check the SmartThings logs to see whether the press was received as a message.

Did you copy pid_dimmer.groovy (https://github.com/quantiletree/SmartWink/blob/master/build/devices/pid_dimmer.groovy) into the device types section? Sounds like your setup just can’t find the file.

Make sure you keep the “smartwink” namespace for the app as well.

That was it! Thanks, now to add four more dimmers and about 7 PICOs. Goodbye Staples Connect!

1 Like

Congrats @quantiletree! You made Hackaday!

3 Likes

Just saw the article on hackaday too. May just be time to open up the wink hub I have new in box that I got for free right when it first came out. I don’t have any lutron devices yet though

Hello Michael,

I have been using and loving your SmartApp for several months. Just recently I noticed that when you select the SmartWink smart app and choose your hub, when you Next to the configuration screen, nothing is displayed but a white screen. Trying to exit the SmartWink app presents an error.

The only reason that I had to go back into this SmartApp is because recently one of my PICO remotes stopped responding and I wanted to trouble shoot.

Have you seen anything wrong lately? I verified that the code on GitHub has not been changed since I installed.

Thanks for the help,
Ryan

Hi Ryan,

Have you first noticed the issue this morning? There was a SmartThings outage earlier today, which could have been screwing things up.

Assuming it’s still happening, go to the SmartThings IDE and open up the logging page, then hit the remote. Does anything appear in the logs? Also do the same while exiting the app - the error you’re seeing should be logged there.

Cheers,
Michael

Thanks for replying Michael.

This is what I see in the logging when in SmartWink:
2:16:58 PM EDT: error java.lang.SecurityException: Creating new class java.lang.IllegalArgumentException is not allowed @ line 357
2:16:45 PM EDT: error java.lang.SecurityException: Creating new class java.lang.IllegalArgumentException is not allowed @ line 357

This is after I leave it on the Select Wink Hub until there is a log entry that it is found, then select NEXT after the hub is found.

Also, the PICO remotes that I use still register on both the WINK hub (the light blinks) and in the logging of Smart Things.

Thanks for any help you can provide.

Ryan

There are sever platform stability issues on ST at the moment, I’d wait to get the all clear from ST before troubleshooting any SmartApps.