Remote Update Single Tab of Flow

I have a flow that runs on a few dozen remote Pis. The flow contains ten tabs, each of which I've exported an individual json file for on my development machine. I'd like to deploy only the updated flows instead of the entire flow to all the remote nodes automatically if that's possible. Most of the customization for each machine is done on one tab and since certain nodes can't be configured at runtime, this approach would be best for updates. I've spent hours looking through the admin API docs but I'm just not understanding them.

Thank you,

otdm-tools from my project can help you.
As one of function it have option to import / export flows from Node-RED instance from linux command line.
I'm using it to prepare .deb what is also a option for you if you want to deploy something more then one flow. To make it packitso link ...

Currently working on import export subflows -> to -> .deb :slight_smile:

I was just looking at the docs and I don't see how your project would help. What am I missing?

You want to remotly update / manipulate flow's on remote instances of Node-RED.
So otdm-tools can help you with sourcing desire flow from custom host get json of it then you can propagate it or make automatic update per host.
otdm-tools one more time to import it to different Node-RED instance.
So you don't need to know curl and http api for Node-RED :slight_smile:

The problem is that I'm not seeing in your documentation how that's done.

look for argument or any -dxxxx
-dnrfByUid in help of otdm-tools.
also in section ( idea of otdm driverProto ):

there is a explanation what is driverProto and why it's easy.

example for now is:

  • to get list of tabs and id's -dnrfByUid "*" -oFile '/tmp/tabsResList.json'

  • to get one tab to .json file -dnrfByUid "bf43b163cb91aff3" -oFile '/tmp/tabID_bf43b163cb91aff3.json'

  • to import it to different instance you can do it from host A to host B( by: -forceHost -dnrfByUid "1" -act "POST" -iFile "/tmp/tabID_bf43b163cb91aff3.json"

  • to import it on host B from host B -dnrfByUid "1" -act "POST" -iFile "/tmp/tabID_bf43b163cb91aff3.json"

It's in manual :slight_smile: looking forward to your feedback !

It's probably just me, but I'm just not getting it. The installation docs alone are confusing the hell out of me. All I want is a simple solution to copying one tab of a flow from one Pi running Node Red to a few dozen out in the field. It seems like it should be simple. Thanks anyways. I'll just stick with the time-consuming process.

No it is not just you.

What don't you understand about the admin API (though I have not actually used it)? If you want to update one flow tab then it looks as if you need

I'm able to get an authentication token just fine, but I can't figure out how to take the contents of my json for the tab I want to replace and put that into the curl statement.

Does this help

Let's assume I export one tab of my flow to a json file and then read the contents into a variable ($JSON)...

curl -H "Authorization: Bearer A_SECRET_TOKEN" -X PUT http://remotehost:1880/flow/91ad451.f6e52 -d "$JSON"

If that's how it's done then yes and thank you. :slight_smile:

You have to put the string into the command. Are you putting the curl command into the command field in an exec node? If so then select Append msg.payload and a function node before it do

msg.payload = `"${$JSON}"`
return msg

I have used the template literals syntax as you need the string to be surrounded by quotes and that that is an easy way to do it.

Personally I would not use that as the name of a variable, it is too confusing.

I hadn't planned on putting it in Node Red quite yet. I just wanted to get it working from the command line. I'll do it whatever way works best if I can actually figure out how to do it. It's just been too much trouble trying to figure it out so far.

I only used JSON in the example to see if I was even understanding it correctly, which im obviously not. I have several individual tabs I want to update as needed, so I'd probably just use the tab names for my variables.

In the command line you should just be able to put the json text in between the quotes.

In node-red it should be more efficient to use an http request node, though sometimes it can be tricky working out exactly how to do that.

I'll give that a go! Thank you for the help!

Can you help me make it more accessible? As a author of oiyshTerminal I don't know what is difficult or simple for someone else.

I don't even know where to begin. I went to the page you linked to (otdm tools) and can't even figure out how to get started with it. I looked at the pages linked on the right side of the page, including the installation manual that tells me I need an Android device to get started and then a whole bunch of other things. What do I really need for just otdm-tools?

I can appreciate the fact that you definitely put a lot of effort and time into creating your software, but I can't even figure out how to use just one piece of it.

I created an application that monitors all the rides in a theme park. There is a Pi installed at each ride running the same application in Node Red that monitors certain data and sends all the data back to another Pi running Node Red to save and display the data. The application is divided into a number of tabs and all I want is the ability to deploy an updated JSON file of specific tabs to the Pis in the field. It sounds like it should be fairly simple, but I'm finding that it's nowhere near being even relatively simple.

Why don't you just deploy the whole flows file if you do not have the experience to understand the API?

The first tab of the flow contains settings that I can't set at runtime and each piece of equipment is different (different PLC, different tags, etc.). If I overwrite that part of the flow, then I have to log in to each Pi individually and update the settings. It would be OK if the ethip-in, pccc-in, and dde nodes allowed for passing all the parameters to them and runtime but they don't, so I need to leave the first tab alone.

The documentation for the admin API is lacking something. With your help and further research, I was able to create a curl request that ended up deleting the tab at the destination and inserted a blank tab (no name, no content). I'm somewhat close to having it figured out, but it shouldn't be this difficult.

I don't think it is, though I haven't done it myself. Don't you just need to use PUT/flow/:id with the flow JSON?