Trigger Linux shell command

Is there a way to trigger a Linux shell command? I assume Hubitat runs on Linux under the hood, but could be wrong. This could be via SSH to an external Linux box on the same network, or Hubitat could maybe make a call to curl or another typically standard Linux command if it does run on Linux.

The only way I can think of is writing a tiny little NodeJS app with Express web server to call a shell command, and having Hubitat make a web call to that. But that seems more complicated.

I'm interested to hear if anyone has accomplished this!

I haven’t heard of anyone doing this. The OS layer is very tightly controlled, as I would expect. That how how they maintain some level of sanity in the hubs.

What is your use case? It could a capability that is exposed in a different way.

2 Likes

I have done this for a few things, and it wasn't that bad. But what are you actually trying to accomplish?

1 Like

I call a node-red node that executes a python script in my setup. Would be one less thing to set up if you already have NR running.

As best as I can tell from what has been described here, the Hubitat platform runs on a JVM that itself is run in a sandbox.

2 Likes

No.

3 Likes

You could write a Hubitat driver that connects via Telnet to a separate Linux machine, and then issue a command via the Telnet session.

Or, you could link NodeRed running on a Linux machine to Hubitat, and simply use a Virtual Switch to trigger a NR Flow that runs a Linux command.

Or….

You get the idea… no direct method, but lots of workarounds. :wink:

4 Likes

I'm trying to make a rule that can cast an rtsp camera (probably via a webpage hosted on Blue Iris) to a Google Home Hub. I was thinking of using catt (Cast All The Things).

That sounds like exactly what I'm looking for. I will check out NodeRed. Thanks for all the suggestions!

3 Likes

This is how I do it for RTSP streams which display as a web page via a motioneye server

You probably don't need node red if you just want to cast a web page with the video feed, RM can send the cast command to the CATT server. I use node red to do this as I'm doing other things with the feed as well.

3 Likes

Would be kind of nice if there was an ssh connection option, wouldn’t think it would introduce additional security risk for either the underlying hub OS or jvm sandbox to be able to establish an outbound ssh tunnel. As long as there isn’t capability to enable any sort of port forwarding, local or remote.

Would be nice to be able to shut off a handful of Linux VMs in the event of a power outage, to conserve the UPS battery. I don’t typically have telnet enabled on these systems and I’ve been too lazy to write some python or something to act as an intermediary to accept the incoming connection.

3 Likes

NodeRed is awesome! I was able to do exactly what I wanted! Thanks for the recommendations, everyone!

3 Likes