I wrote a script that will grab a frame from one of my camera RTSP streams using FFMPEG on a raspberry PI. I'd like to be able to trigger that .sh script using Rule Machine.
I've been trying to set this up using HTTP POST and Node-RED based on what I've been able to find so far online, but I can't get it working for the life of me. Before I spend any more time, I figured I'd ask here as I probably am not even doing this the most efficient way.
What's the most efficient way to trigger a shell script on a raspberry pi using Rule Machine?
You can use a project called OmniThing. This setup allows you to execute a shell command when a virtual switch in Hubitat is changed.
Doing this from Rule Machine is only possible the way you have already tried. Are you not able to get node-red to receive the POST or are you not able to get the script to execute?
The script itself DOES work when ran locally or via ssh so it's not a script problem. I know that I'm just doing something wrong in one of the steps above, and would appreciate any guidance anyone has to offer.
Yeah...you're not setting up node-red to receive a POST message. You have to set up an endpoint which is a lot more complicated than that. I can tell you that OmniThing is a lot more user friendly.
I'll certainly give it a look - though I'm curious as to how I'm not setting it up to recieve a POST message as I thought that I did that properly in the HTTP IN Node?
He is not SENDING a post. He is trying to RECEIVE a POST from Hubitat. Again....someone jumps in without reading the whole thing.
I suggest you read the whole thread. The OP is trying to use Node Red to execute a shell script based on an HTTP message from HE to Node-Red. So, node-red is the receiver, not the sender. So, it would in fact need a response node. Otherwise it won't send the HTTP response to the sender.
Then I maintain you are receiving timeout errors to your messages in Hubitat 100% of the time. Because both what you linked to and what I linked to both show an HTTP response node in them.
Jason, thanks for your help - I'm sorry that others are being so hostile here. I'd appreciate it, when you do get home, if you wouldn't mind sending a screenshot of one of your flows so that I can compare? I don't understand why they would need a response when I'm only sending data in one direction. I guess I need to do more learning on HTTP POST/GET in general before I try to implement this.
How do I configure the debug module to show me if the HTTP Post is being received? Or should it show me that by default?
Just connect the pin from the debug block to the Http in block. If there are any messages sent out of the HTTP in block it should show up in the debug log. Make sure the debug block itself is also turned on.
That's what I did. Hm, so it looks like the POST message isn't getting to node-red, then. I suspect perhaps it's something wrong with how I'm sending from Rule Machine.