Is it possible to retrieve a subflow's module properties from within a flow? I want to make an overview in a dashboard of the actual versions of the subflows.
Hi @psmtvdw
Natively - No
With a little time and effort - maybe.
You will need to use the HTTP Admin API.
Or you could add another output to the subflow, sending all the properties out on startup.
@Colin is your suggestion based on the idea by @marcus-j-davies of using the API? Or is it another approach you had in mind to retrieve for instance the version number from a subflow?
Is the subflow module yours?
If it is, then Colins suggestion is easier - as you can just code the module to output the version on start up.
But, if this is not yours and you need it for all modules you have installed, then the API will likely be where you need to go.
There is another way also, and that is to read the package.json
file - but I don't think that will show any updates that are installed, as it only declares base versions that you installed originally.
Under a standard pi install, the file is: /home/pi/.node-red/package.json
package-lock.json
however, may show actual versions that are installed - But I don't know its format that well.
Sorry, I misunderstood (not reading the question carefully). I thought you meant the subflow instance properties
Basic example of how I implemented this API method to retrieve meta data from all subflows.
[
{
"id": "67d336bad523693e",
"type": "inject",
"z": "a0f09cc0.c983a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 220,
"wires": [
[
"8accf6f2c27aabab"
]
]
},
{
"id": "8accf6f2c27aabab",
"type": "http request",
"z": "a0f09cc0.c983a",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://localhost:1880/flows",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 310,
"y": 220,
"wires": [
[
"75bb9aac476c2bc5"
]
]
},
{
"id": "f5d7c5fe73d56fca",
"type": "debug",
"z": "a0f09cc0.c983a",
"name": "debug 28",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 940,
"y": 220,
"wires": []
},
{
"id": "93b1aa7fbb291d15",
"type": "switch",
"z": "a0f09cc0.c983a",
"name": "",
"property": "payload.type",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "subflow",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 590,
"y": 220,
"wires": [
[
"8c40ffacd81842a9"
]
]
},
{
"id": "75bb9aac476c2bc5",
"type": "split",
"z": "a0f09cc0.c983a",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 450,
"y": 220,
"wires": [
[
"93b1aa7fbb291d15"
]
]
},
{
"id": "8c40ffacd81842a9",
"type": "change",
"z": "a0f09cc0.c983a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.meta",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 760,
"y": 220,
"wires": [
[
"f5d7c5fe73d56fca"
]
]
}
]
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.