silang521 发表于 2024-3-22 21:39:03

分享一下格式化过的,直接复制粘贴就行

[
    {
      "id": "2c2c3be32c085667",
      "type": "tab",
      "label": "爱快系统信息V2.0",
      "disabled": false,
      "info": ""
    },
    {
      "id": "7e912416d539be36",
      "type": "debug",
      "z": "2c2c3be32c085667",
      "name": "ACL-MAC",
      "active": false,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "targetType": "msg",
      "statusVal": "",
      "statusType": "auto",
      "x": 800,
      "y": 360,
      "wires": []
    },
    {
      "id": "fae72fe3e40be763",
      "type": "mqtt in",
      "z": "2c2c3be32c085667",
      "name": "MAC限网开关接收",
      "topic": "cmnd/ikuai/acl",
      "qos": "2",
      "datatype": "auto",
      "broker": "854a61c87270b850",
      "nl": false,
      "rap": true,
      "rh": 0,
      "inputs": 0,
      "x": 110,
      "y": 280,
      "wires": [
            [
                "a850f81f97c18cf0"
            ]
      ]
    },
    {
      "id": "eec6094e6fa6575c",
      "type": "inject",
      "z": "2c2c3be32c085667",
      "name": "10m'更新限网状态",
      "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
      ],
      "repeat": "600",
      "crontab": "",
      "once": true,
      "onceDelay": "2",
      "topic": "",
      "payload": "",
      "payloadType": "date",
      "x": 130,
      "y": 500,
      "wires": [
            [
                "7ff150da9f24d11b"
            ]
      ]
    },
    {
      "id": "422d615e49b03d09",
      "type": "debug",
      "z": "2c2c3be32c085667",
      "name": "整理后的系统信息",
      "active": false,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "targetType": "msg",
      "statusVal": "",
      "statusType": "auto",
      "x": 830,
      "y": 240,
      "wires": []
    },
    {
      "id": "bfa7ee77d2b8793e",
      "type": "mqtt out",
      "z": "2c2c3be32c085667",
      "name": "ikuai",
      "topic": "ikuai/int",
      "qos": "",
      "retain": "",
      "respTopic": "",
      "contentType": "",
      "userProps": "",
      "correl": "",
      "expiry": "",
      "broker": "854a61c87270b850",
      "x": 810,
      "y": 140,
      "wires": []
    },
    {
      "id": "552df1d30c2a267e",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "账号参数",
      "func": "var username=\"admin\" ; //用户名\nvar pass = \"ff303c2ss3fa1584seaaaafb2wwwc7dcf\"; //密码MD5加密值\nvar ip=\"192.168.1.1:8880\";//爱快IP加端口\nglobal.set(\"ip\", ip);\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nmsg.payload = `{\"username\": \"${username}\",\"passwd\":\"${pass}\",\"pass\":\"c2FsdF8xMXNoMTIzNDU2\",\"remember_password\":\"\"}`;\nmsg.url = 'http://'+ip+'/Action/login';\n\nreturn msg;",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 360,
      "y": 40,
      "wires": [
            [
                "483fe70d6de6c849"
            ]
      ]
    },
    {
      "id": "aaaf8c0f9239c9ff",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "整理结果",
      "func": "const rmsg={};\nmsg.payload ={\n    \"cpu\": msg.payload.Data.sysstat.cpu.replace(\"%\", \"\"),//CPU信息,可做多个CUP平均值\n    \"cputemp\":msg.payload.Data.sysstat.cputemp,//CPU温度\n    \"memory\": msg.payload.Data.sysstat.memory.used.replace(\"%\", \"\"), \n    \"online_user\":msg.payload.Data.sysstat.online_user.count,\n    \"connect_num\":msg.payload.Data.sysstat.stream.connect_num,\n    \"upload\":msg.payload.Data.sysstat.stream.upload, \n    \"total_down\":msg.payload.Data.sysstat.stream.download\n    }\nreturn msg;\n",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 660,
      "y": 140,
      "wires": [
            [
                "422d615e49b03d09",
                "bfa7ee77d2b8793e"
            ]
      ]
    },
    {
      "id": "fb9186f4099b2613",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "保存cookie",
      "func": "var cookie = msg.headers[\"set-cookie\"];\nglobal.set(\"cookie\", cookie);\nreturn msg;",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 710,
      "y": 40,
      "wires": [
            [
                "be39a8868377510c"
            ]
      ]
    },
    {
      "id": "a850f81f97c18cf0",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "开关限网cmnd",
      "func": "const rmsg={};\nconst cmnd = msg.payload;\nswitch (cmnd){\n    case \"10\":\n    rmsg.id=\"1\";//mac限网ID\n    rmsg.action=\"down\";//限网开up/关down\n    break;\n    case \"11\":\n    rmsg.id=\"1\";//mac限网ID\n    rmsg.action=\"up\";//限网开up/关down\n    break;\n    case \"20\":\n    rmsg.id=\"2\";//mac限网ID\n    rmsg.action=\"down\";//限网开up/关down\n    break;\n    case \"21\":\n    rmsg.id=\"2\";//mac限网ID\n    rmsg.action=\"up\";//限网开up/关down\n    break;\n    case \"30\":\n    rmsg.id=\"3\";//mac限网ID\n    rmsg.action=\"down\";//限网开up/关down\n    break;\n    case \"31\":\n    rmsg.id=\"3\";//mac限网ID\n    rmsg.action=\"up\";//限网开up/关down\n    break;\n    case \"40\":\n    rmsg.id=\"4\";//mac限网ID\n    rmsg.action=\"down\";//限网开up/关down\n    break;\n    case \"41\":\n    rmsg.id=\"4\";//mac限网ID\n    rmsg.action=\"up\";//限网开up/关down\n    break;\n    }\nreturn rmsg;\n",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 360,
      "y": 280,
      "wires": [
            [
                "23f451bab059d7ba"
            ]
      ]
    },
    {
      "id": "23f451bab059d7ba",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "MAC_ALC限网",
      "func": "var cookie = global.get(\"cookie\");\nvar ip = global.get(\"ip\");\n\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['cookie'] = cookie;\nmsg.payload = `{\"func_name\":\"acl_mac\",\"action\":\"${msg.action}\",\"param\":{\"id\":\"${msg.id}\"}}`;\nmsg.url = 'http://' + ip +'/Action/call';\nreturn msg;",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 560,
      "y": 280,
      "wires": [
            [
                "6c563cabecf54d48"
            ]
      ]
    },
    {
      "id": "cb97d1e4113f7f0b",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "整理结果",
      "func": "var data=msg.payload.Data.data\nvar id ;\nvar enabled;\nmsg={};\nmsg.payload={};\nvar dalen = data.length;\nfor(var i=0;i<dalen;i++){\n    id = data.id;\n    if (data.enabled==\"yes\"){\n      enabled =\"ON\";\n      }else{\n            enabled = \"OFF\";\n            }\n            msg.payload = enabled;\n            }\nreturn msg;\nreturn msg;",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 860,
      "y": 440,
      "wires": [
            [
                "7e912416d539be36",
                "cdf692300fd5fabc"
            ]
      ]
    },
    {
      "id": "7ff150da9f24d11b",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "请求更新限网状态",
      "func": "msg.action=\"show\";//限网开up/关down\nmsg.id=\"\";//mac限网ID\nreturn msg;",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 330,
      "y": 440,
      "wires": [
            [
                "2dd5b4d5cc02327f"
            ]
      ]
    },
    {
      "id": "af744a977946c193",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "请求系统信息",
      "func": "var cookie = global.get(\"cookie\");\nvar ip = global.get(\"ip\");\n\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['cookie'] = cookie;\nmsg.payload = `{\"func_name\":\"homepage\",\"action\":\"show\",\"param\":{\"TYPE\":\"sysstat,ac_status\"}}`;\nmsg.url = 'http://' + ip +'/Action/call';\nreturn msg;\n",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 320,
      "y": 140,
      "wires": [
            [
                "d7a94c9712ee6ce2"
            ]
      ]
    },
    {
      "id": "2dd5b4d5cc02327f",
      "type": "function",
      "z": "2c2c3be32c085667",
      "name": "MAC_ALC限网",
      "func": "var cookie = global.get(\"cookie\");\nvar ip = global.get(\"ip\");\n\nmsg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['cookie'] = cookie;\nmsg.payload = `{\"func_name\":\"acl_mac\",\"action\":\"${msg.action}\",\"param\":{\"id\":\"${msg.id}\"}}`;\nmsg.url = 'http://' + ip +'/Action/call';\nreturn msg;",
      "outputs": 1,
      "timeout": 0,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 560,
      "y": 440,
      "wires": [
            [
                "b134d64590a2ecde"
            ]
      ]
    },
    {
      "id": "be39a8868377510c",
      "type": "debug",
      "z": "2c2c3be32c085667",
      "name": "login",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "targetType": "msg",
      "statusVal": "",
      "statusType": "auto",
      "x": 870,
      "y": 40,
      "wires": []
    },
    {
      "id": "25626fb7e0af0a12",
      "type": "inject",
      "z": "2c2c3be32c085667",
      "name": "2小时重新登录一次",
      "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
      ],
      "repeat": "7200",
      "crontab": "",
      "once": true,
      "onceDelay": 0.1,
      "topic": "",
      "payload": "",
      "payloadType": "date",
      "x": 140,
      "y": 40,
      "wires": [
            [
                "552df1d30c2a267e"
            ]
      ]
    },
    {
      "id": "483fe70d6de6c849",
      "type": "http request",
      "z": "2c2c3be32c085667",
      "name": "发送登录请求",
      "method": "POST",
      "ret": "obj",
      "paytoqs": "ignore",
      "url": "",
      "tls": "",
      "persist": false,
      "proxy": "",
      "insecureHTTPParser": false,
      "authType": "",
      "senderr": false,
      "headers": [],
      "x": 540,
      "y": 40,
      "wires": [
            [
                "fb9186f4099b2613"
            ]
      ]
    },
    {
      "id": "bb9bbbe268ff6273",
      "type": "inject",
      "z": "2c2c3be32c085667",
      "name": "10秒更新系统信息",
      "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
      ],
      "repeat": "10",
      "crontab": "",
      "once": true,
      "onceDelay": 0.1,
      "topic": "",
      "payload": "",
      "payloadType": "date",
      "x": 130,
      "y": 140,
      "wires": [
            [
                "af744a977946c193"
            ]
      ]
    },
    {
      "id": "d7a94c9712ee6ce2",
      "type": "http request",
      "z": "2c2c3be32c085667",
      "name": "发送请求",
      "method": "POST",
      "ret": "obj",
      "paytoqs": "ignore",
      "url": "",
      "tls": "",
      "persist": false,
      "proxy": "",
      "insecureHTTPParser": false,
      "authType": "",
      "senderr": false,
      "headers": [],
      "x": 500,
      "y": 140,
      "wires": [
            [
                "aaaf8c0f9239c9ff",
                "9a38cc04ad825160"
            ]
      ]
    },
    {
      "id": "9a38cc04ad825160",
      "type": "debug",
      "z": "2c2c3be32c085667",
      "name": "未整理的系统信息",
      "active": false,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "true",
      "targetType": "full",
      "statusVal": "",
      "statusType": "auto",
      "x": 750,
      "y": 80,
      "wires": []
    },
    {
      "id": "b134d64590a2ecde",
      "type": "http request",
      "z": "2c2c3be32c085667",
      "name": "发送请求",
      "method": "POST",
      "ret": "obj",
      "paytoqs": "ignore",
      "url": "",
      "tls": "",
      "persist": false,
      "proxy": "",
      "insecureHTTPParser": false,
      "authType": "",
      "senderr": false,
      "headers": [],
      "x": 720,
      "y": 440,
      "wires": [
            [
                "cb97d1e4113f7f0b"
            ]
      ]
    },
    {
      "id": "cdf692300fd5fabc",
      "type": "mqtt out",
      "z": "2c2c3be32c085667",
      "name": "ikuai/acl",
      "topic": "stat/ikuai/acl",
      "qos": "0",
      "retain": "",
      "respTopic": "",
      "contentType": "",
      "userProps": "",
      "correl": "",
      "expiry": "",
      "broker": "854a61c87270b850",
      "x": 820,
      "y": 540,
      "wires": []
    },
    {
      "id": "6c563cabecf54d48",
      "type": "http request",
      "z": "2c2c3be32c085667",
      "name": "发送请求",
      "method": "POST",
      "ret": "obj",
      "paytoqs": "ignore",
      "url": "",
      "tls": "",
      "persist": false,
      "proxy": "",
      "insecureHTTPParser": false,
      "authType": "",
      "senderr": false,
      "headers": [],
      "x": 740,
      "y": 280,
      "wires": [
            [
                "7ff150da9f24d11b"
            ]
      ]
    },
    {
      "id": "854a61c87270b850",
      "type": "mqtt-broker",
      "name": "",
      "broker": "127.0.0.1",
      "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": {},
      "sessionExpiry": ""
    }
]

奈何心善 发表于 2024-3-23 17:50:19

这个好,看看,学习下

michael655 发表于 2024-3-23 19:08:59

学习学习一下!感谢分享!

上帝在堕落 发表于 2024-3-24 21:33:18

学习学习!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

ReddotCleaner 发表于 2024-3-27 13:39:14

upnp的不能正常显示,看看这个

358954592 发表于 2024-3-27 13:50:29

爱快路由器?

yanxl 发表于 2024-3-27 17:16:24

谢谢分享!!!

theatrics 发表于 2024-3-27 18:35:40

谢谢大佬分享

zxyny1989 发表于 2024-3-28 01:23:08

adxr 发表于 2024-3-21 12:41
高格也差不多的,抓一下包改一下

关键我是小白,不会:L

[email protected] 发表于 2024-3-28 09:40:52

谢谢分享
页: 1 [2] 3
查看完整版本: 让爱快路由器对接HASS 版本2.0 全用Node-RED+MQTT实现