generate payload with speed

This commit is contained in:
nodered-awetrix 2025-02-13 21:09:13 +01:00
parent e3d4b61f93
commit e201ded460

View File

@ -29,7 +29,8 @@
"y": 260, "y": 260,
"wires": [ "wires": [
[ [
"103202b0b37a8b04" "103202b0b37a8b04",
"ec93c31d21242a8a"
] ]
] ]
}, },
@ -113,5 +114,42 @@
"x": 620, "x": 620,
"y": 340, "y": 340,
"wires": [] "wires": []
},
{
"id": "ec93c31d21242a8a",
"type": "function",
"z": "40aabaff57950a4d",
"name": "extract/store sppeds",
"func": "var oldmsg = msg\nvar new_payload = {}\nmsg.topic = \"fbspeed\"\n\n// Gettin Values from Payload\nvar upstream = oldmsg.payload.NewUpstreamMaxRate\nvar downstream = oldmsg.payload.NewDownstreamCurrRate\n\n// Store values globally\nglobal.set(\"upstream\", upstream, \"file\");\nglobal.set(\"downstream\", downstream, \"file\");\n\n// generate new payload\nnew_payload.upstream = upstream\nnew_payload.downstream = downstream\nmsg.payload = new_payload\n\nreturn msg\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 160,
"wires": [
[
"5975b0134a7c406e"
]
]
},
{
"id": "5975b0134a7c406e",
"type": "debug",
"z": "40aabaff57950a4d",
"name": "mqtt-payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 830,
"y": 160,
"wires": []
} }
] ]