Hey @kevinGodell could you please help me again sir? I'm using a function node with an MQTT IN node attached. I can send an MQTT messgae to "start" the ffmpeg spawn node of yours, but when I try to stop the ffmpeg spawn node, it essentially ignores it. Even when the flow is idle or has been redeployed, and I send the stop message through MQTT, it actually starts the stream. I've tried to analyze your code in the node itself to see if there's something to give me a clue, but honestly I'm not experienced enough to know how your kill process is executed.
Here is a couple of different examples of the coding I've attempted with the function node:
#1
var payload = msg.payload; //get payload
if (msg.payload == "on") {
msg.action = {
"command": "start"
};
return msg;
}
else if (msg.payload == "off") {
msg.action = {
"command": "stop"
};
return msg;
}
return null;
#2
var payload = msg.payload; //get payload
if (msg.payload == "on") {
msg.action = {
"command": "start"
};
return msg;
}
else if (msg.payload == "off") {
msg.SIGKILL = {
"command": "stop"
};
return msg;
}
return null;
Here is what my flow looks like. I have the function node notionally acting like PiR sensor to trigger the camera when motion is detected. The debug output shows when the spawn node was started with the mqtt, but it shows how it was ignored when I tried to stop it. The kill process was done via the direct inject.