[OBSOLETE] LutronPro Caseta v1.0

@adiventure hmmm, npm is still looking up on the web repository for lutronpi rather than right on your machine. Can you confirm that the /home/pi/lutronpi directory now exists, AND it contains:
bridges lib LICENSE lutronpi.js LutronPiServer.js package.json README.md

where bridges and lib are subdirectories and the other are files.

@bho Got it, the effect had been to move lutronpi-server into lutronpi, instead just renaming.

This look right?

pi@raspberrypi:~ $ npm install lutronpi
npm WARN deprecated node-uuid@1.4.1: Use uuid module instead
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead

ws@0.4.31 install /home/pi/node_modules/tomahawk/node_modules/socket.io/node_modules/engine.io/node_modules/ws
(node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory ā€˜/home/pi/node_modules/tomahawk/node_modules/socket.io/node_modules/engine.io/node_modules/ws/buildā€™
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
bufferutil.target.mk:95: recipe for target ā€˜Release/obj.target/bufferutil/src/bufferutil.oā€™ failed
make: Leaving directory ā€˜/home/pi/node_modules/tomahawk/node_modules/socket.io/node_modules/engine.io/node_modules/ws/buildā€™

ws@0.4.31 install /home/pi/node_modules/tomahawk/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws
(node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory ā€˜/home/pi/node_modules/tomahawk/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/buildā€™
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
bufferutil.target.mk:95: recipe for target ā€˜Release/obj.target/bufferutil/src/bufferutil.oā€™ failed
make: Leaving directory ā€˜/home/pi/node_modules/tomahawk/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/buildā€™
npm WARN saveError ENOENT: no such file or directory, open ā€˜/home/pi/package.jsonā€™
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open ā€˜/home/pi/package.jsonā€™
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.

  • lutronpi@2.0.0-beta.1
    added 324 packages from 165 contributors in 110.879s
    [!] 70 vulnerabilities found [510 packages audited]
    Severity: 22 Low | 30 Moderate | 18 High
    Run npm audit for more detail

pi@raspberrypi:~ $

Yep, that looks more like it. npm seems to agree that itā€™s installed ā€œlutronpi@2.0.0-beta.1ā€ which is correct, plus added a whole boatload of packages (node modules) to support it.

Now to see if it runs! (usefully)

@BHO Almost there haha.

Gotten as far as the app stage, but Iā€™m getting no discovered servers. The discovery bit in the instructions seems to be about discovering the lutron hub, so Iā€™m not sure how to troubleshoot this piece.

Thanks again.

@adiventure - Iā€™ve pushed this into a private thread direct to you while we get this sorted. I suspect the server is still not quite up and running, entirely.

For anyone watching at home: problem appears to be resolved and the currently posted code includes the fix.

2 Likes

Everything is working great for me. Iā€™ve got 12 Picos by the way.

Terrific, thanks - thatā€™s exactly the kind of testing I canā€™t do from here. Let me know if anything looks/acts weird, or any suggestions, etc. I wish I could do something about the turn-around time lag on Pico button pushes/repeats, but Iā€™m pretty sure the real problem is upstream in the SmartThings infrastructure.

Yeah I agree. It works fine without ramping anyways but I think it would be a worthwhile project, if I knew how, to work on the node side ramping that you were referring to. I tried the contact open/closed but webcore didnā€™t see each individual button as a contact sensor. I think I have an idea of a work around for this but ran out of time. Not entirely confident itā€™ll help anyways.

Oh! Here is an additional bit of info that might help with the contact sensor experiments. Kind of depends on what webcore lets you do.

When SmartThings expanded their ā€œbuttonā€ capability to allow for multiple buttons on the same device, they just tacked on an additional data field: buttonNumber. So when you get a button press, the event has a name of ā€˜buttonā€™, an action of ā€˜pushedā€™ or ā€˜heldā€™, and a data map containing buttonNumber=n (where n is the button number within the device, like Picoā€™s 1-5, usually).

However, thereā€™s no such thing OFFICIALLY for multi-contact contact devices. So I made one up, exactly like button but instead for an event name of ā€˜contactā€™ and an action of ā€˜openā€™ or closedā€™, I give you also a data map of contactNumber=n (where n is the Pico button number).

So if webcore lets you examine the incoming eventā€™s data field, you should be able to tell one Pico button from another by checking for contactNumber value.

1 Like

Iā€™m getting this error when I try and start. I looked back at the readme and perhaps I missed it - do I need to configure my username/password for the certificate generation? I used gitclone for the install.

pi@raspberrypi:/opt $ node lutronpi/lutronpi
/opt/lutronpi/lutronpi Version 2.0.0 2018.05.10 1200Z
bridgeDiscoverList=%o [ ā€˜lutronā€™ ]
Requiring /opt/lutronpi/bridges/lutron-discover
Discovering lutron bridgesā€¦
ā€¦Lutron Bridge mDNS found / now 1 service(s): Sun Jun 24 2018 08:17:05 GMT+0000 (UTC)
ā€¦Lutron Bridge mDNS Host: lutron-01f046fa.local IP: 172.16.16.26
ā€¦Lutron Bridge mDNS Name: Lutron Status
ā€¦Lutron Bridge mDNS FQDN: Lutron Status._lutron._tcp.local
ā€¦Lutron Bridge mDNS MAC: 50:65:83:e8:47:3d
bridgeConnectList=%o [ BridgeConnect {
bType: ā€˜lutronā€™,
bID: ā€˜01F046FAā€™,
bIP: ā€˜172.16.16.26ā€™,
bAuth: null,
bInst: null } ]
Requiring /opt/lutronpi/bridges/lutron-bridge
Caught exception: undefined
/opt/lutronpi/bridges/lutron-bridge.js:853
j = tempList.push(( ({href,Name}) => ({href,Name}) )(buttons[i])) - 1;
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensionsā€¦js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at tryRequire (/opt/lutronpi/node_modules/try-require/index.js:18:16)
at bridgeOperationModuleRequire (/opt/lutronpi/lutronpi.js:668:15)
at bridgeAllInitFound [as _onTimeout] (/opt/lutronpi/lutronpi.js:827:9)
at Timer.listOnTimeout (timers.js:92:15)

@e8link Eric - if it got that far, your credentials should be fine, itā€™s already talking to the Lutron bridge. What I think is going on here is that I mightā€™ve been a little too optimistic (and undertested) on support for older versions of Node. I suspect youā€™re running node v5.xx or even older? ( node -v will tell you). I notice some of the logging is wonky also but specifically I think your node is not understanding the (destructuring) code line that is ^ pointed out in the error log.

If you are running node V5 or older (or a very early V6), I suspect there was a version warning logged by ā€˜npm installā€™ but (I am now surprised to find!) that is purely cautionary. If Iā€™m right, Iā€™ll embellish the readme file to make the installation stricter.

Thatā€™s maybe more than you really want to knowā€¦ anyhow:

Can you tell me what version of node youā€™re using ( via node -v ) for my own diagnostic purposes, and
Can you update to say node V8 or V9 to see if that bypasses the problem? (Havenā€™t tested V10/V11 as yet)

Sorry for the trouble, thanks for the feedback.

Sorry to have such a newbie question but I am struggling to get this app to install on my system. I was able to get the original version from nick installed easily. I am running node v8 and npm v6. Trying to run node lutronpi/lutronpi the script starts and exits saying no bridges specified or discoverd. I modified the LutronPiServer.js file per the below:

  • commented out the line to try with no parameters (received the same no bridges error)
  • uncommented the line where it will ask for authentication if necessary:
    lutronpi.startup( {{type:ā€œLutronā€,id:ā€œmyserialhereā€, ip:ā€œ192.168.1.124ā€ } );
    the bottom of my bridge only has a number below the barcode, it is 8 numbers start with 0 (looking at data of when nicks app starts it shows the smart bridge as dev1 and has a serial number entry - this is different than anything on the back of the bridge itself.
    So, I keep getting the bridge not found, and cant seem to get past itā€¦any help is greatly appreciated!

@ssizelove Sorry for the trouble: weā€™re all newbies with respect to this newer version, only a few folks have tried it other than me, so itā€™s still shaking out.

I donā€™t know why the bridge discovery isnā€™t working, but thatā€™s tricky to debug from here, so youā€™re quite right to try the specified-startup scheme. Hopefully Lutron hasnā€™t changed something in its discovery schema for some update of their bridges.

Your example showed me that I had a typo (or two!) in the explanatory comments in LutronPiServer.js for a couple of startup examples, including the one you tried. Specifically, one too many { brackets. Iā€™ve fixed that in the github copy, but just try taking one { bracket out:

lutronpi.startup( {type:ā€œLutronā€,id:ā€œmyserialhereā€, ip:ā€œ192.168.1.124ā€ } )

Iā€™d think that the IP must be correct if Nateā€™s V1 app is working ok for you (talking to the Lutron bridge, that is). That 8-digit number starting with 0 near the barcode on the bottom of the bridge should be its serial number, which you can use for the id: (Not that it matters, but: it should actually be the hexadecimal equivalent of the decimal serial number shown for device 1 in Nateā€™s appā€™s startup, as received from the bridge itself).

Anyway, give that adjustment a try and see if it then sees the bridge. If you get it going and want to try to help diagnose the discovery problem, let me know.

Thanks for the quick reply Bill! And sorry about calling Nate Nickā€¦at least it started with the same letter lol.

I confirmed that the serial I have is the hex equivalent to what Nate shows, so it is certainly the same device.

UGH - I knew I would make a small issue and cause a delay :slight_smile: ā€¦ I have been modifying the LutronPiServer.js file and kept running ā€˜node lutronpi/lutronpiā€™ and should have ran ā€˜node lutronpi/LutronPiServerā€™ ā€¦ once I woke up and did that properly it found my caseta bridgeā€¦running now actually looking for the st hub. Thanks a million!

The main thing I am trying to do is allow me to configure two 4 button picos to then run an exhaust fan for certain times depending on which buttons are pressed, and also have the logic of if the fan is already running and it is turned on again from one of the picos it resets the timer to start again. Originally I was writing my own script but came across the lutronpro Nate implemented, I got that running but then noticed it didnt work for 4button. In my home script I have RadioRa2 keypads being monitored and executing Caseta commands controlling lights that lutron said couldnt be done lol. I came across all this when I realized recently the ssh function had been disabled. Lutron likes to keep it interesting and proprietary for sure.

Ha! I was going to suggest that possibility too, but figured ā€œnahā€¦ no wayā€ :stuck_out_tongue:

Well, this version should work with the 4-button Picos natively ā€“ at least it does for mine here with Caseta bridges, though I havenā€™t gotten reports back from anyone with an RA2 setup yet.
One thing that might be slightly useful to you is that you can assign any single Pico button as a ā€œfavoriteā€ (via that Picoā€™s device page config, the gear icon), and that button will be available right on the main SmartThings device screen.

Glad you got it going, let me know if you run across anything interesting or alarming!

Oh, given that discovery isnā€™t working for your Lutron bridges, itā€™s possible that it may not work for the SmartThings hub either. They both use the same Bonjour discovery mechanism. Might be something ā€˜oddā€™ in your local network, like various bits being on different subnets (since Bonjour may not route between them). So in short, if you canā€™t discovery the SmartThings hub either, just add its IP address (or its local DNS host name) as a 2nd parameter after the bridge spec. There are a couple of examples of that in the LutronPiServer.js file also.

One other thing i should clarify is that this version of the app requires ā€˜matchingā€™ SmartThings SmartApp and device handlers ā€“ it wonā€™t work with Nateā€™s previous versions. See the FORM section of the README file if youā€™ve not already found the required new SmartThings files (which are in separate GitHub repository, along with an additional README for them).

All is well now - it works! Couple notes, at least what I sawā€¦ For some reason starting the server the same way today as I did yesterday worked, it discovered the ST hub. Yesterday it wouldnā€™t. I have a flat network so not sure what could be up there. Also, when trying to add the picos from lutronpi in the smartapp on my phone I was not able to view the pico in webCoRe until I uninstalled all of the lutronpro pieces. When I would go through the lutronpi interface and select the pico I want and then tap next through to scense, the last tap of done (or whatever that said :slight_smile: ) a green bar would pop up saying all good and then a red bar would pop up with an error. After removing the lutronpro pieces the same steps worked great.

@ssizelove hmmm, not sure what webcoreā€™s problem was with the Picos; lutronpi (newer) and lutronpro (older) use completely different SmartThings network IDs (device IDs) so the same Pico, as ā€œparentedā€ by those apps, should appear as entirely separate SmartThings devices to webcore. Or so Iā€™d think, but maybe an overlap in the names/labels made it unhappy (?). Never messed with webcore, but I should.
EDIT: on 2nd read, I see now that you got that red error popup from the lutronpi smartapp after config, not from webcore. I am guessing the problem is that both lutronpi and lutronpro by necessity use the same network ID for the child device created to represent the node server itself, and SmartThings doesnā€™t allow two devices to have the same network ID. All the other child devices (representing physical Lutron products) wonā€™t overlap between the two setups, but it only takes the one conflict to error out. (The technical reason is that ST requires a LAN-connected device like the node server to be associated with a child device whose network ID is set to the deviceā€™s MAC address, so that the ST hub knows where to route unsolicited incoming LAN messages.) I guess Iā€™ll have to make a note of that in the README.
(As a side note, I imagine both smart apps could work simultaneously if they were attached to their respective node servers running on different devices, or even just interfaces, with different MAC addressesā€¦ even if the respective node servers were talking to the same Lutron bridge(s). But that way lies madness.)

This might be ultra basic, but whatā€™s the process to update the server by terminal?