Compare commits

...

2 Commits

2 changed files with 130 additions and 21 deletions

View File

@ -16,6 +16,37 @@
"ssl": false,
"user": "nodered"
},
{
"id": "319c50eef5295f1a",
"type": "mqtt-broker",
"name": "",
"broker": "emqx.devnet.local",
"port": 1883,
"clientid": "nr-awetrix",
"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": "156c0331c926b697",
"type": "fritzbox-in",
@ -25,8 +56,8 @@
"service": "urn:dslforum-org:service:WANDSLInterfaceConfig:1",
"action": "GetInfo",
"arguments": "{}",
"x": 360,
"y": 260,
"x": 340,
"y": 560,
"wires": [
[
"103202b0b37a8b04",
@ -48,15 +79,15 @@
"vt": "str"
}
],
"repeat": "",
"repeat": "120",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 260,
"x": 110,
"y": 560,
"wires": [
[
"156c0331c926b697",
@ -77,8 +108,8 @@
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 610,
"y": 260,
"x": 590,
"y": 560,
"wires": []
},
{
@ -90,8 +121,8 @@
"service": "urn:schemas-upnp-org:service:WANIPConnection:1",
"action": "GetStatusInfo",
"arguments": "{}",
"x": 380,
"y": 340,
"x": 360,
"y": 640,
"wires": [
[
"1069bff298293e62",
@ -112,8 +143,8 @@
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 620,
"y": 340,
"x": 600,
"y": 640,
"wires": []
},
{
@ -121,16 +152,24 @@
"type": "function",
"z": "40aabaff57950a4d",
"name": "extract/store speeds",
"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);\nglobal.set(\"downstream\", downstream);\n\n// generate new payload\nnew_payload.upstream = upstream\nnew_payload.downstream = downstream\nmsg.payload = new_payload\n\nreturn msg\n",
"outputs": 1,
"func": "var oldmsg = msg\nvar new_payload = {}\nmsg.topic = \"fbspeed\"\n\n// Gettin Values from Payload\nvar upstream = oldmsg.payload.NewUpstreamCurrRate\nvar downstream = oldmsg.payload.NewDownstreamCurrRate\n\nvar test = parseInt(oldmsg.payload.NewUpstreamCurrRate).toLocaleString(\"de-DE\")\nvar aw_upstream = parseInt(oldmsg.payload.NewUpstreamCurrRate).toLocaleString(\"de-DE\")\nvar aw_downstream = parseInt(oldmsg.payload.NewDownstreamCurrRate).toLocaleString(\"de-DE\")\n\n\n// Store values globally\nglobal.set(\"upstream\", upstream);\nglobal.set(\"downstream\", downstream);\n\n// generate new payload\nnew_payload.upstream = upstream\nnew_payload.downstream = downstream\nnew_payload.test = test\nmsg.payload = new_payload\nvar msg_up = { payload: aw_upstream }\nvar msg_down = { payload: aw_downstream }\n\nreturn [ msg_down, msg_up, msg ]\n",
"outputs": 3,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 160,
"x": 600,
"y": 460,
"wires": [
[
"70824ab8b807c6a8",
"bbd41200c57cdab7"
],
[
"cf776e17cd07fb03",
"ad03d1bc7e8c9438"
],
[
"5975b0134a7c406e"
]
@ -149,8 +188,8 @@
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 830,
"y": 160,
"x": 970,
"y": 520,
"wires": []
},
{
@ -165,8 +204,8 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 400,
"x": 570,
"y": 700,
"wires": [
[
"5b264dfa75365ea1"
@ -186,8 +225,78 @@
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 810,
"x": 790,
"y": 700,
"wires": []
},
{
"id": "ad03d1bc7e8c9438",
"type": "mqtt out",
"z": "40aabaff57950a4d",
"name": "emqx upstream",
"topic": "awdata/fb/speed/upstream",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "319c50eef5295f1a",
"x": 940,
"y": 300,
"wires": []
},
{
"id": "cf776e17cd07fb03",
"type": "debug",
"z": "40aabaff57950a4d",
"name": "upstream",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 960,
"y": 460,
"wires": []
},
{
"id": "70824ab8b807c6a8",
"type": "debug",
"z": "40aabaff57950a4d",
"name": "downstream",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 970,
"y": 400,
"wires": []
},
{
"id": "bbd41200c57cdab7",
"type": "mqtt out",
"z": "40aabaff57950a4d",
"name": "emqx downstream",
"topic": "awdata/fb/speed/downstream",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "319c50eef5295f1a",
"x": 890,
"y": 240,
"wires": []
}
]

View File

@ -1,3 +1,3 @@
{
"$": "729776b51ddd08df4bcd094bf3fd7b71APmer/6O6DmNWStNO/+cnC3alrVjkcB2xvJ45vJve5bRGwZmO8rJF2vX2rofwAktRgCkM4zMJMexJpAJPdozGVH1Gbo="
"$": "2d7efddb6a1886cb9bd69f558e312ff1KYStdmDRnLopNPbRx76WQwwwx+TOOyhp+jlIhA8zcDzX16KAGoivMoMHeaXd5ek/2lZhkEvGSNT8wKICG+GoHMmR0nuXP2YInCqdzhfOQnjRxb0C2IZ7DASQkgZEVHw7tlJpEJ+gXxa/k1SME2t8rxKlSricrFvXUgJE4+gC/sUdZxo="
}