snapshot of nodered

This commit is contained in:
2025-10-01 19:50:39 +02:00
parent c70f1ac71d
commit 08c0e70336
3 changed files with 320 additions and 12 deletions

View File

@@ -16,6 +16,13 @@
"tours": {
"welcome": "4.1.0"
}
}
},
"menu-menu-item-palette": true,
"debug": {
"filter": "filterCurrent"
},
"menu-deploymenu-item-node": true,
"menu-deploymenu-item-full": false,
"menu-menu-item-sidebar": true
}
}

View File

@@ -13,6 +13,22 @@
"disabled": false,
"info": ""
},
{
"id": "35ae2530c60e1b03",
"type": "tab",
"label": "Data",
"disabled": false,
"info": "",
"env": []
},
{
"id": "828acdf03ca58b4b",
"type": "tab",
"label": "Borgmatic",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f017ed81.199d2",
"type": "ui_tab",
@@ -72,7 +88,7 @@
{
"id": "acbce132.6eef4",
"type": "mqtt-broker",
"name": "mosquitto",
"name": "mosquitto [teslamate]",
"broker": "mosquitto",
"port": "1883",
"clientid": "",
@@ -83,7 +99,7 @@
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthQos": "2",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
@@ -194,6 +210,37 @@
}
}
},
{
"id": "06c0b68418098ff9",
"type": "mqtt-broker",
"name": "mosquitto [borgmatic]",
"broker": "mosquitto",
"port": 1883,
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": 4,
"keepalive": 60,
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "94fe8f4d.0557d",
"type": "function",
@@ -253,7 +300,8 @@
"name": "topic-stored",
"links": [
"2e575816.e13368",
"cb1580bf.27615"
"cb1580bf.27615",
"0c351a6c8e96e3c2"
],
"x": 395,
"y": 240,
@@ -340,7 +388,8 @@
"y": 140,
"wires": [
[
"892aaba0.903858"
"892aaba0.903858",
"d282a891141c5143"
]
]
},
@@ -351,15 +400,18 @@
"name": "store topic",
"func": "var short_topic = msg.topic.substring(17);\n\n// create object to be used by Grafana data source\nvar tmp = [];\ntmp.push(msg.payload);\ntmp.push(parseInt(new Date().getTime()));\nglobal.set(short_topic,tmp);\nmsg.topic = short_topic;\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 140,
"wires": [
[
"22bcecd8.fac734",
"8491f8d1.1365f8"
"8491f8d1.1365f8",
"d282a891141c5143"
]
]
},
@@ -682,6 +734,23 @@
"y": 91,
"wires": []
},
{
"id": "d282a891141c5143",
"type": "debug",
"z": "868e4cd7.9fc578",
"name": "msg",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 410,
"y": 300,
"wires": []
},
{
"id": "5bf1c557.464144",
"type": "function",
@@ -779,7 +848,6 @@
"y": 980,
"wires": [
[
"dea66ad4.245ca",
"df6e0dc2.ac982"
]
]
@@ -799,10 +867,7 @@
"x": 550,
"y": 80,
"wires": [
[
"dea66ad4.245ca",
"eb20a524.af3ba"
]
[]
]
},
{
@@ -849,5 +914,241 @@
"wires": [
[]
]
},
{
"id": "7d872e85d99aee28",
"type": "http request",
"z": "35ae2530c60e1b03",
"name": "",
"method": "POST",
"ret": "txt",
"paytoqs": "body",
"url": "http://192.168.2.200:8000/state",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 690,
"y": 140,
"wires": [
[
"fb81418e6b46530e"
]
]
},
{
"id": "0c351a6c8e96e3c2",
"type": "link in",
"z": "35ae2530c60e1b03",
"name": "link in 1",
"links": [
"8491f8d1.1365f8"
],
"x": 185,
"y": 160,
"wires": [
[
"24fd317ac4ec1276"
]
]
},
{
"id": "f36f3ed1ae28ee17",
"type": "mqtt in",
"z": "35ae2530c60e1b03",
"name": "",
"topic": "dev/cars/1/#",
"qos": "2",
"datatype": "auto-detect",
"broker": "acbce132.6eef4",
"nl": false,
"rap": false,
"inputs": 0,
"x": 200,
"y": 300,
"wires": [
[
"24fd317ac4ec1276"
]
]
},
{
"id": "24fd317ac4ec1276",
"type": "switch",
"z": "35ae2530c60e1b03",
"name": "",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "state",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 580,
"y": 300,
"wires": [
[
"7d872e85d99aee28",
"fb81418e6b46530e"
]
]
},
{
"id": "f1efdc7cb2328a70",
"type": "inject",
"z": "35ae2530c60e1b03",
"name": "",
"props": [
{
"p": "topic",
"vt": "str"
},
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "dev/cars/1/state",
"payload": "online",
"payloadType": "str",
"x": 220,
"y": 420,
"wires": [
[
"24fd317ac4ec1276"
]
]
},
{
"id": "13e8537dd143437c",
"type": "inject",
"z": "35ae2530c60e1b03",
"name": "",
"props": [
{
"p": "topic",
"vt": "str"
},
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "dev/cars/1/state",
"payload": "offline",
"payloadType": "str",
"x": 220,
"y": 480,
"wires": [
[
"24fd317ac4ec1276"
]
]
},
{
"id": "fb81418e6b46530e",
"type": "debug",
"z": "35ae2530c60e1b03",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 830,
"y": 500,
"wires": []
},
{
"id": "e50d0883efd82937",
"type": "mqtt in",
"z": "828acdf03ca58b4b",
"name": "",
"topic": "borgmatic/stats/#",
"qos": "2",
"datatype": "auto-detect",
"broker": "06c0b68418098ff9",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 150,
"y": 260,
"wires": [
[
"2cc041d2f5a4a7ee"
]
]
},
{
"id": "2cc041d2f5a4a7ee",
"type": "function",
"z": "828acdf03ca58b4b",
"name": "function 1",
"func": "// for (const [key, value] of Object.entries(msg.payload)) {\n// node.send({\n// topic: \"borgmatic/split/\" + key,\n// payload: value\n// });\n// }\nfunction flatten(obj, prefix, baseTopic, result) {\n for (const [key, value] of Object.entries(obj)) {\n const newPrefix = prefix ? prefix + \"/\" + key : key;\n if (value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n flatten(value, newPrefix, baseTopic, result);\n } else {\n result.push({\n topic: baseTopic + \"/\" + newPrefix,\n payload: value\n });\n }\n }\n}\n\nlet result = [];\n\nflatten(msg.payload, \"\", msg.topic || \"borgmatic/split\", result);\n\n// return multiple messages\nreturn result;\n\n// return null; // because we already emitted messages",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 240,
"wires": [
[
"50a0bb8c03545b5c"
]
]
},
{
"id": "50a0bb8c03545b5c",
"type": "debug",
"z": "828acdf03ca58b4b",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 360,
"y": 120,
"wires": []
},
{
"id": "13e002897ab3b6ab",
"type": "mqtt out",
"z": "828acdf03ca58b4b",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "06c0b68418098ff9",
"x": 650,
"y": 240,
"wires": []
}
]

View File

@@ -1,3 +1,3 @@
{
"$": "1d4315da3fd9e82ab75d1738ee507abd6XrO6UzWOWgWt3KOOTe80+p9PkYSp0LOQqmQvtmoH/S7ZQ+/ukDC1XCZSvZukb0QUnrsSG929ejm/KsPwlV1+H0vzGtDiAn6GWA+N7J67exm2biVCKMAwNd9jQgxfkaeVcOK/MplGnUHfUpLoL5KN7VfkOOXDECokENoLodkjU/ATtowaVnugNs/xrqhGyV0USvEnR8k4cIuKOJocS7p1i2GbpJ72U5Iy20V84yF4MnqEHGKUCJNN8yfal9IsnFJQyuR9xueyAtYppJBDBKCXmQMDhNofVc10zZRelpgrtJizzT2Y0N1nS/I6d7rC7FireYdk6wmmw=="
"$": "e913c971033173c4957c7f93df45df2bTOuT6LqHoqV6KLMMPG9AxSsJN+kqFDtrgDBs8UGInfNYhYYOZ5udbfIP2/SydlUFR/TBU5JFJORfxxRrgTeV89WoiFEq6pUZmjKreB1gLSRjlxI8C08R+lYpbsk3X+i2QkgGqI02P0vRYBnNcSTVIblWs7ojRZOHx5CPRRguWbEV7lFccQQGzdnl5zMkQmccqQqPx85uOkspWWiIouFNSYy4e6gHVgK27el3SiggcaY133l35tayCnVepIZu5k5SDJsRb27tiEVkw2IAyXEuyXavYniwqCkvZrxtlxZQ1PIQXh/g07qkdehsOZIvSFCKnAb8X6CqKQ6kJGn18FJ488p8DccuVnXQrSsswi9IisJZxvTpFtt4DffPGThF79TG6+gZNiIqhgtOM7kl9WKbhdfoO0WjTv9hEnvSCXTxRbUpwASUfj3E12jb/XOQ9wkDrgLqbTFlzw1qs8JXRHAX3LgW6A=="
}