[OBSOLETE] LutronPro Caseta v1.0

Sounds like it could be the problem I report it a few days ago; see above, my note that begins “A bit of trouble after updating”. Nate suggested a temporary workaround that did indeed work around the problem: add an entry for the pico in question into the runNodeServer.js file.

Finally upgraded to this. I guess my Lutron bridge hadn’t rebooted until today, because everything was still working fine until it did. With the workaround of adding a section for each Pico in the runNodeServer.js file, everything is working great.

In my github of your old version, I had the ability to link each Pico to a set of lights for on/off, so I wouldn’t have to use a third party app for just simple on/off lights. I guess I never submitted a pull request for that? I miss that feature already… but I’ve got no time to work on it now. Just added them in Smart Lighting instead.

Hey @njschwartz, long time no speak :).
I haven’t updated to your latest because everything has been working ok for my use case. I did update to the latest ST app version this morning and my things list now looks like this.

The ? At the bottom is the LutronPIRaspberry hub device. If I click it it displays the IP and everything as normal and my picks still work. Anyone else seeing this?

Any update on the ramping issue I was seeing?

I’m still seeing “PI/Caseta at [IP address]” and “LUTRON PI” here on My Home. That is on the iOS SmartThings app as updated today 11/29/2017 v 2.11.0 (1425)

Yep…just updated my IPad and it looks fine. It might be an android issue. Anyone with Android and ST 2.11.0 that has my issue?

@njschwartz, it appears that this only affects android but I was able to fix it by adding
type: "lighting"

To line 28 of the Raspberry Pi device handler.
Gotta love ST app updates and all their bug “fixes”. :wink:

Hey guys- I recently updated to this updated node integration from @njschwartz (nice work man!) Unfortunately, I’m having a crashing issue with pico button presses. Via search, I see that some of you have had similar issues which you remedied by manually mapping picos in the lutronpro.js file.

I know how to edit the file obviously, unfortunately i’m not entirely sure what code to add in order to map/make the picos work as expected. If any of you guys the time and wouldn’t mind helping me out, I’d certainly appreciate it! Nate has been super helpful in the past, though it looks like he may be on a bit of a hiatus.

My error from the server log:

About to exit with code: 1
C:\Users\Nick\node_modules\lutronpro\lutronpro.js:367
if(buttonMethods[match][button]) {
^

TypeError: Cannot read property ‘1’ of undefined
at Socket. (C:\Users\Nick\node_modules\lutronpro\lutronpro.js:367:26)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)

I used the very minimum entry, and it seem to do the trick:

var buttonMethods = [
{device: ‘2’},
{device: ‘3’,
4: true,
5: true
}
];

Where my troublesome pico was device 2, yours of course being probably some other device number you can get from the console logging. The device 3 shown above is just to show Nate’s original example as well.

Trying to get this setup on windows and running into a few issues at the end.
Got to the setup smartapp stage and ran into:

PS C:\LutronPro Caseta Server> node runNodeServer.js
Listening on port 5000…
appCert exists! YEAH!!
192.168.2.20
About to exit with code: 1
events.js:183
throw er; // Unhandled ‘error’ event
^

Error: connect ETIMEDOUT 192.168.2.20:8081
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
PS C:\LutronPro Caseta Server> node runNodeServer.js
Listening on port 5000…
appCert exists! YEAH!!
192.168.2.20
Request for Device List
192.168.2.20
reg hub data
Request for Device List
192.168.2.20
reg hub data
Request for Device List
192.168.2.20
reg hub data
Request for Device List
192.168.2.20
reg hub data
About to exit with code: 1
events.js:183
throw er; // Unhandled ‘error’ event
^

Error: connect ETIMEDOUT 192.168.2.20:8081
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
PS C:\LutronPro Caseta Server>

That’s the result of my opening a shell, running the server, and trying to connect in the smartapp. Any guidance? I’m a tad beyond my comfort zone. Thanks.

I had two other stupid questions.
I’ve already got the official Lutron setup going, I’m mostly looking at this for the pico remotes, in particular the two or so that I’d like to control non Lutron devices. Should I add all the devices, all the picos, or just the picos I’m not already using. Is there a negative to having devices listed both here and the official lutron integration?

Lastly I didn’t see anything that would autorun the server, is there? Or is there a prefered method of doing so?

Thanks,
This looks really great.

I’d double (triple?) check your IP addresses in the runNodeServer.js file, making sure the Lutron and SmartThings IP addresses are actually correct for your network. You can probably look in your router’s DHCP list to see where lutron-something and st-something have been assigned. Also, just to reiterate the notes way up above, you have to have a “Pro” Lutron bridge unit to read out the Pico buttons; a regular bridge won’t cut it.

(Just guessing based on the connection timeout error messages. I’ve only set this up on a Raspberry Pi Zero here.)

I believe Nick (the author) has stated that his server will co-exist with the official Lutron smartapp and that you can then just use his for monitoring Pico buttons. I’d personally try adding all the Picos whether your Lutron hub setup has them used locally or not, and see if the ‘used’ ones read out as well as the ‘unused’ ones. I suspect they will but haven’t tried it. btw I’ve had good results coupling the Picos to the “Advanced Button Controller” smart app: it seems very flexible yet easy to set up.

For a Windows host, I guess you could just make a cmd batch file to run and if necessary rerun “node runNodeServer” (with appropriate path names, etc.) and put a shortcut to that cmd file in the Startup folder. Off the top of my head that seems like a rough and ready way to handle the most common restart cases. (Once you have it all rigged up to work, that is!)

maybe something like
:RESTARTLP
@echo off
echo Starting Lutron Pi server
node therightpath\runNodeServer.js
timeout /t 5
goto RESTARTLP

and then just shortcut to that whateveryoucallit.cmd file as
%windir%\system32\cmd.exe /c whateveryoucallit.cmd

though you could also look at something fancier like the node process manager PM2 which appears to also work on Windows, e.g. https://www.npmjs.com/package/pm2-windows-service and some other offerings in npm

Figured out the issue, had a weird problem with the editor I used for the JS file.

It is the Pro, and now I’m picking up all the Picos. I set them all up, but left the actual switches out, I can’t think of how adding them would help, though I’m always open to being corrected.

I was thinking a batch file might be the way to go, but wasn’t sure if there was a cleaner integration. I’ll give a look at the process manager too. Thanks.

Hello all! I apologize for disappearing over the last couple of weeks. I promise I am still around and haven’t abandoned this project. I will try to address everything that has come up here.

TLDR; there is an update to the node server and to the raspberry pi device handler to fix a few bugs!

@huydnguyen I am struggling to recreate the issue you are seeing with the ramping. As long as I only use buttons 4-5 to ramp I cannot make it happen. If I use button 1 for example and hold it long enough that does happen, but that is a know issue with how lutron handles those button presses. I did make some changes to fix other things. Update and see if it still happens and we can go from there.

@ADamL @BHO @noakd8601 You should no longer have that issue with the error when the Pico device isn’t in that buttonmap array. Sorry about that issue and that it took so long to fix.

@stephack Thanks for pointing that out and fixing it for me! Kind of a weird bug that I hadn’t noticed. I added the “type: lighting” to the device handler and updated it to github for anyone else who is having that issue.

@adiventure Glad you got it working. Regarding your question about adding everything vs just the picos, there isn’t really any point in adding the switches too if you are using the built in integration for them. It won’t hurt anything, but will essentially duplicate all the switches which could get confusing. You can add all or just a subset of the picos to achieve whatever you are going for it doesn’t really matter. @BHO gave a pretty good guide for autorunning things. It kinda depends on what your exact goal is. Like he said PM2 is nice and will basically run things in the background for you as well.

Thanks for the response, this is a really neat app.
I was able to set up the smartapp and start mapping buttons, but upon testing there was a different issue. First press (on) worked, but nothing else seemed to. A few restarts later and I’m not getting any control from the pico I was mapping. If it matters I was using the smart lighting app, not core or any other option. Clicking the virtual button works, but not the remote.
Thought I had it going but I’m still seeing one issue, I believe occurring here:

About to exit with code: 1
C:\LutronPro Caseta Server\node_modules\lutronpro\lutronpro.js:367
if(buttonMethods[match][button]) {
^

TypeError: Cannot read property ‘2’ of undefined
at Socket. (C:\LutronPro Caseta Server\node_modules\lutronpro\lutronpro.js:367:26)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:594:20)

I just submitted an update that should fix that issue. Try ‘npm update lutronpro’ and then run it again and I think it should work. Let me know!

That did it, thanks.

Trying and currently failing to work out PM2 now haha.

1 Like

Thanks @njschwartz I turned ramping off since my webcore piston is set of hold or push, but i’ll give it another go and see. Do you happen to have more than one Pico configured? I have 6…

Did you get it to work? I saw your original post before you withdrew it. Let me know! Thanks

Looks like the npm update causes the authentication files to be obsolete. I deleted all the files and it used the new user and password to recreate them. I guess there is are file name differences and that caused the exception trying to open some keyfile… I think is was around line 690.

Very nice job. I can confirm this works on Lutron’s newer Ra2 Select system.

Do you think you can get the 4 button keypads working? Shouldn’t be too much different.