Using SmartApp to execute Linux script?


I did some poking around, but couldn’t find anything. So I’m going to ask. Is there a way to have SmartThings send a script to a Linux server?

I have a fairly complicated NAS set up in my basement (who doesn’t?) that I’d like to automate some things with. I’d like to be able to control startup and shutdown. So the shutdown is a little involved, and needs a script to shut all of the various services down that aren’t managed by the native shutdown command. I’d like to be able to kick that off with SmartThings, and then have SmartThings finish by shutting off a z-wave or Wemo power source.

Because of my motherboard bios, to turn the server back on all I need to do is restore power to the z-wave/wemo switch, and it comes right back up.

Outside of that the ability to send an SSH script is huge, because it allows me to do just about anything else. Granted, it’s a security hole, and we’re not running this on any bank systems, but I’ll live. Is it possible with SmartThings?

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

SmartThings will let you contact any http/https endpoint, so the preferred approach is to use node.js or some other simple web server and create a list of REST-API webpoints to call from a DTH or SmartApp.

But… well… not much stops you from creating a REST-API endpoint that takes a shell command as input.


Sounds like I have a RasPi in my future. I never thought I needed one til now. :smile: Thanks!

(Chris) #4

raspi with node.js and/or python is great, I have one with 5 separate processes listening for web requests to handle different things that are not natively supported by ST. CoRE (powerful community developed rules engine) can make web requests based on pretty much any trigger or combination of triggers you can dream up.

(Manny) #5

Interesting. Can you point me to a thread or some site that explains how to do this?

I have two node.js servers running that I’ve set up following someone else’s instructions: one for Envisalink/ademco alarm panel integration and one for chromecast Cast web service for announcing events to my speakers.

Hopefully it’s not too much more complicated than that.



I’d love to know more about this too. I basically would want to run pm2 commands to start/stop homebridge, openhab, etc.