[
    {
        "id": "53b6806fa04eab7b",
        "type": "tab",
        "label": "A-9N System Configuration",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "b6d30433824724fc",
        "type": "ui_switch",
        "z": "53b6806fa04eab7b",
        "name": "",
        "label": "DHCP OFF/ON",
        "tooltip": "",
        "group": "294daea8c18c16bd",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": true,
        "className": "",
        "x": 320,
        "y": 260,
        "wires": [
            [
                "1d39e7b22b27c594"
            ]
        ]
    },
    {
        "id": "1d39e7b22b27c594",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "Is DHCP enable?",
        "func": "//Is DHCP enable?\nif (msg.payload == true) {\n   msg.enabled = false; // disable static IP text input\n    delete msg.payload; // delete payload\n   \n} else {\n    msg.enabled = true; // enable static IP text input\n    delete msg.payload; // delete payload\n}\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 360,
        "wires": [
            [
                "beb8e58e298083c9",
                "d239427e75174bdf"
            ]
        ]
    },
    {
        "id": "cadc8775643eec22",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "enable static IP",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "enabled",
                "v": "true",
                "vt": "bool"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 120,
        "y": 420,
        "wires": [
            [
                "d239427e75174bdf"
            ]
        ]
    },
    {
        "id": "c365796551800af9",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "disable static IP",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "enabled",
                "v": "false",
                "vt": "bool"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 120,
        "y": 460,
        "wires": [
            [
                "d239427e75174bdf"
            ]
        ]
    },
    {
        "id": "d03662bea325a79e",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "DHCP enable",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 110,
        "y": 260,
        "wires": [
            [
                "b6d30433824724fc"
            ]
        ]
    },
    {
        "id": "68cf8335bd7fd0c2",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "DHCP disable",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 110,
        "y": 300,
        "wires": [
            [
                "b6d30433824724fc"
            ]
        ]
    },
    {
        "id": "fbe8fcef05215a38",
        "type": "file in",
        "z": "53b6806fa04eab7b",
        "name": "",
        "filename": "/etc/systemd/network/eth0.network",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 380,
        "y": 60,
        "wires": [
            [
                "857b6e3553f5505e",
                "63b292c2bbec5d08"
            ]
        ]
    },
    {
        "id": "857b6e3553f5505e",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "get ethernet configuration",
        "func": "var content = msg.payload.toString(); // 將文件內容轉換為字符串\n\nvar lines = content.split('\\n'); // 將內容分割成行\nvar dhcpIndex = lines.findIndex(line => line.includes(\"#DHCP=ipv4\")); // 找到包含 \"#DHCP\" 的行的索引\nif (dhcpIndex !== -1) {\n\n  var dhcpLine = lines[dhcpIndex]; // 取得包含 \"#DHCP\" 的行\n  \n  var addressLine = lines.find(line => line.includes(\"Address=\")); // 找到包含 \"Address=\" 的行\n  var gatewayLine = lines.find(line => line.includes(\"Gateway=\")); // 找到包含 \"Gateway=\" 的行\n  var dnsLine = lines.find(line => line.includes(\"DNS=\")); // 找到包含 \"DNS=\" 的行\n \n  var address = addressLine ? addressLine.split(\"=\")[1].trim() : \"\"; // 提取 Address 值\n  address = address.replace(/\\/\\d+$/, \"\"); // 去除 /24\n\n  var gateway = gatewayLine ? gatewayLine.split(\"=\")[1].trim() : \"\"; // 提取 Gateway 值\n  var dns = dnsLine ? dnsLine.split(\"=\")[1].trim() : \"\"; // 提取 DNS 值\n  // 將提取的值存入 msg.payload\n  msg.payload = {\n    \"address\": address,\n    \"gateway\": gateway,\n    \"dns\": dns\n  };\n} else {\n  // 若未找到 \"#DHCP\"，將值設為空\n  msg.payload = {\n    address: '',\n    gateway: '',\n    dns: ''\n  };\n}\n\nreturn msg;\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 690,
        "y": 120,
        "wires": [
            [
                "8a8ebaf65d17badc"
            ]
        ]
    },
    {
        "id": "8a8ebaf65d17badc",
        "type": "link out",
        "z": "53b6806fa04eab7b",
        "name": "讀取Ethernet配置",
        "mode": "link",
        "links": [
            "e001b277ee0728ae",
            "06bbae8705a1953d"
        ],
        "x": 935,
        "y": 120,
        "wires": []
    },
    {
        "id": "d239427e75174bdf",
        "type": "ui_form",
        "z": "53b6806fa04eab7b",
        "name": "Static IP Form",
        "label": "",
        "group": "294daea8c18c16bd",
        "order": 2,
        "width": "6",
        "height": "7",
        "options": [
            {
                "label": "IP Address (Ex. 192.168.0.2)",
                "value": "address",
                "type": "text",
                "required": true,
                "rows": null
            },
            {
                "label": "Gateway (Ex. 192.168.0.1)",
                "value": "gateway",
                "type": "text",
                "required": true,
                "rows": null
            },
            {
                "label": "DNS (Ex. 192.168.0.1)",
                "value": "dns",
                "type": "text",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "address": "",
            "gateway": "",
            "dns": ""
        },
        "payload": "",
        "submit": "submit",
        "cancel": "",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": "",
        "className": "",
        "x": 360,
        "y": 460,
        "wires": [
            [
                "f8b1ec31acf369cd"
            ]
        ]
    },
    {
        "id": "f8b1ec31acf369cd",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "renew ethernet configuration",
        "func": "// var _StaticIpReset = context.get('_StaticIpReset') || false;\n\nvar fileContent = \n`[Match]\nName=eth0\nType=ether\n\n[Link]\nRequiredForOnline=yes\n\n[Network]\n#DHCP\n#DHCP=ipv4\n#STATIC IP\n Address=192.168.0.251/24\n Gateway=192.168.0.1\n DNS=192.168.5.1`;\n\n// if (_StaticIpReset == true){\n// // 將取得的值更新到 abc.txt 檔案的相對應位置\nvar replacedString = fileContent.replace(/Address=.*$/m, 'Address=' + msg.payload.address +'/24');\nreplacedString = replacedString.replace(/Gateway=.*$/m, 'Gateway=' + msg.payload.gateway);\nreplacedString = replacedString.replace(/DNS=.*$/m, 'DNS=' + msg.payload.dns);\n\nmsg.payload = replacedString;\n    // msg.payload = _StaticIpReset;\nreturn msg;\n// } else{ \n    // store the value back\n    context.set('_StaticIpReset', true);\n    // msg.payload = _StaticIpReset;\n    // return msg;\n// }\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 620,
        "y": 460,
        "wires": [
            [
                "6f501736b3179f09"
            ]
        ]
    },
    {
        "id": "6f501736b3179f09",
        "type": "file",
        "z": "53b6806fa04eab7b",
        "name": "",
        "filename": "/etc/systemd/network/eth0.network",
        "filenameType": "str",
        "appendNewline": false,
        "createDir": false,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 940,
        "y": 460,
        "wires": [
            [
                "861e157553b2b263"
            ]
        ]
    },
    {
        "id": "06bbae8705a1953d",
        "type": "link in",
        "z": "53b6806fa04eab7b",
        "name": "",
        "links": [
            "8a8ebaf65d17badc"
        ],
        "x": 185,
        "y": 500,
        "wires": [
            [
                "d239427e75174bdf"
            ]
        ]
    },
    {
        "id": "beb8e58e298083c9",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "enable DHCP configuration",
        "func": "var _DHCPReset = context.get('_DHCPReset') || false;\n\nvar fileContent = \n`[Match]\nName=eth0\nType=ether\n\n[Link]\nRequiredForOnline=yes\n\n[Network]\n##DHCP\nDHCP=ipv4\n##STATIC IP\n# Address=192.168.0.2\n# Gateway=192.168.0.1\n# DNS=192.168.0.1`;\n\nif (_DHCPReset == true){\n    if(msg.enabled == false){\n\n        msg.payload = fileContent;\n        return msg;\n    }    \n} else{\n    _DHCPReset = true;\n    // store the value back\n    context.set('_DHCPReset', _DHCPReset);\n    // msg.payload = _DHCPReset;\n    // return msg;\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 360,
        "wires": [
            [
                "fe03f4aa789203ad"
            ]
        ]
    },
    {
        "id": "fe03f4aa789203ad",
        "type": "file",
        "z": "53b6806fa04eab7b",
        "name": "",
        "filename": "/etc/systemd/network/eth0.network",
        "filenameType": "str",
        "appendNewline": false,
        "createDir": false,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 960,
        "y": 360,
        "wires": [
            [
                "feed309827dab34f"
            ]
        ]
    },
    {
        "id": "c17de0837fe14a05",
        "type": "ui_form",
        "z": "53b6806fa04eab7b",
        "name": "WiFi Setting Form",
        "label": "",
        "group": "d0bacbf3e8fd4630",
        "order": 1,
        "width": "6",
        "height": "5",
        "options": [
            {
                "label": "SSID",
                "value": "ssid",
                "type": "text",
                "required": true,
                "rows": null
            },
            {
                "label": "Password",
                "value": "password",
                "type": "text",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "ssid": "",
            "password": ""
        },
        "payload": "",
        "submit": "submit",
        "cancel": "",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": "",
        "className": "",
        "x": 190,
        "y": 760,
        "wires": [
            [
                "89f8049fe63ec6db"
            ]
        ]
    },
    {
        "id": "89f8049fe63ec6db",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "renew WIFI configuration",
        "func": "var fileContent = \n`ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev\nupdate_config=1\n#country=US\n\nnetwork={\n\tssid=\"ttt\"\n\tpsk=\"12345678\"\n}`;\n\n// // 將取得的值更新到 abc.txt 檔案的相對應位置\nvar replacedString = fileContent.replace(/ssid=.*$/m, `ssid=\"${msg.payload.ssid}\"`);\nreplacedString = replacedString.replace(/psk=.*$/m, `psk=\"${msg.payload.password}\"`);\nmsg.payload = replacedString;\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 760,
        "wires": [
            [
                "5e6e3e4385e7675c"
            ]
        ]
    },
    {
        "id": "61eaf57740bfd888",
        "type": "file in",
        "z": "53b6806fa04eab7b",
        "name": "",
        "filename": "/etc/wpa_supplicant/wpa_supplicant-wlan0.conf",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 500,
        "y": 680,
        "wires": [
            [
                "5f7a43040d808a11"
            ]
        ]
    },
    {
        "id": "5f7a43040d808a11",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "get SSID/PWD configuration",
        "func": "var inputString = msg.payload; // 將輸入字串存入 inputString 變數中\nvar ssid = inputString.match(/ssid=\"(.*?)\"/)[1]; // 使用正規表達式取出 ssid 的內容\nvar psk = inputString.match(/psk=\"(.*?)\"/)[1];\nmsg.payload = {\n    \"ssid\": ssid,\n    \"password\": psk\n  };\n\nreturn msg; // 輸出訊息\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 840,
        "y": 680,
        "wires": [
            [
                "ad7760450244cd2d"
            ]
        ]
    },
    {
        "id": "5e6e3e4385e7675c",
        "type": "file",
        "z": "53b6806fa04eab7b",
        "name": "",
        "filename": "/etc/wpa_supplicant/wpa_supplicant-wlan0.conf",
        "filenameType": "str",
        "appendNewline": false,
        "createDir": false,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 780,
        "y": 760,
        "wires": [
            [
                "3aa44d7249d2c217"
            ]
        ]
    },
    {
        "id": "37247c033116b895",
        "type": "exec",
        "z": "53b6806fa04eab7b",
        "command": "sudo reboot",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 650,
        "y": 980,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "861e157553b2b263",
        "type": "link out",
        "z": "53b6806fa04eab7b",
        "name": "固定IP設定完成",
        "mode": "link",
        "links": [
            "f76ab7621a62ee74",
            "02398d2642ea62ad",
            "23e3ab50d46d8512"
        ],
        "x": 1155,
        "y": 460,
        "wires": []
    },
    {
        "id": "feed309827dab34f",
        "type": "link out",
        "z": "53b6806fa04eab7b",
        "name": "DHCP啟動完成",
        "mode": "link",
        "links": [
            "f76ab7621a62ee74",
            "02398d2642ea62ad"
        ],
        "x": 1175,
        "y": 360,
        "wires": []
    },
    {
        "id": "3aa44d7249d2c217",
        "type": "link out",
        "z": "53b6806fa04eab7b",
        "name": "SSID/PWD設定完成",
        "mode": "link",
        "links": [
            "02398d2642ea62ad"
        ],
        "x": 1015,
        "y": 760,
        "wires": []
    },
    {
        "id": "8b9f1998b372116e",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "DHCP enable",
        "info": "",
        "x": 1310,
        "y": 360,
        "wires": []
    },
    {
        "id": "40a4cfa14d0a2328",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "Static IP Configuration",
        "info": "",
        "x": 1320,
        "y": 460,
        "wires": []
    },
    {
        "id": "0ade979917f176d0",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "Get Ethernet Configuration",
        "info": "",
        "x": 1090,
        "y": 120,
        "wires": []
    },
    {
        "id": "ad7760450244cd2d",
        "type": "link out",
        "z": "53b6806fa04eab7b",
        "name": "讀取SSID/PWD配置",
        "mode": "link",
        "links": [
            "27cc3b31367bafc8"
        ],
        "x": 1025,
        "y": 680,
        "wires": []
    },
    {
        "id": "27cc3b31367bafc8",
        "type": "link in",
        "z": "53b6806fa04eab7b",
        "name": "",
        "links": [
            "ad7760450244cd2d"
        ],
        "x": 35,
        "y": 760,
        "wires": [
            [
                "c17de0837fe14a05"
            ]
        ]
    },
    {
        "id": "9b389b3188b07efa",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "get SSID/PWD configuration",
        "info": "",
        "x": 1220,
        "y": 680,
        "wires": []
    },
    {
        "id": "0f409498286aba0b",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "renew SSID/PWD configuration",
        "info": "",
        "x": 1210,
        "y": 760,
        "wires": []
    },
    {
        "id": "25b92afe2bbe2ff4",
        "type": "ui_text",
        "z": "53b6806fa04eab7b",
        "group": "e133f7573eba5974",
        "order": 1,
        "width": "6",
        "height": "2",
        "name": "顯示有線網路IP訊息",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "className": "",
        "x": 800,
        "y": 1060,
        "wires": []
    },
    {
        "id": "c03a1f8c5d0eb426",
        "type": "ui_toast",
        "z": "53b6806fa04eab7b",
        "position": "dialog",
        "displayTime": "5",
        "highlight": "",
        "sendall": true,
        "outputs": 1,
        "ok": "YES",
        "cancel": "NO",
        "raw": true,
        "className": "notice",
        "topic": "Notice",
        "name": "",
        "x": 330,
        "y": 980,
        "wires": [
            [
                "83740e3a81a5852e"
            ]
        ]
    },
    {
        "id": "77770ef16bd4bdb6",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "提醒訊息",
        "func": "msg.payload =\"System configuration completed. Please reboot the system to prevent any unforeseen issues.<br>required Restart now?\";\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 160,
        "y": 980,
        "wires": [
            [
                "c03a1f8c5d0eb426"
            ]
        ]
    },
    {
        "id": "02398d2642ea62ad",
        "type": "link in",
        "z": "53b6806fa04eab7b",
        "name": "",
        "links": [
            "feed309827dab34f",
            "3aa44d7249d2c217",
            "861e157553b2b263"
        ],
        "x": 35,
        "y": 980,
        "wires": [
            [
                "77770ef16bd4bdb6"
            ]
        ]
    },
    {
        "id": "83740e3a81a5852e",
        "type": "switch",
        "z": "53b6806fa04eab7b",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "YES",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 490,
        "y": 980,
        "wires": [
            [
                "37247c033116b895"
            ]
        ]
    },
    {
        "id": "ceac028f2f3898a4",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "reboot system",
        "info": "",
        "x": 830,
        "y": 980,
        "wires": []
    },
    {
        "id": "d3a17f777bc385e5",
        "type": "exec",
        "z": "53b6806fa04eab7b",
        "command": "ip addr show dev eth0",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 320,
        "y": 1060,
        "wires": [
            [
                "6c51e7f365b78e75"
            ],
            [],
            []
        ]
    },
    {
        "id": "6c51e7f365b78e75",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "讀取目前IP位址",
        "func": "var content = msg.payload;\n\nvar ipRegex = /inet (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})/;\nvar macRegex = /link\\/ether ([0-9a-fA-F:]{17})/;\n\nvar ipAddress = content.match(ipRegex)[1];\nvar macAddress = content.match(macRegex)[1];\n\nmsg.payload = \n    \n     `Network<br><br>IP： ${ipAddress}<br>Mac： ${macAddress}`;\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 560,
        "y": 1060,
        "wires": [
            [
                "25b92afe2bbe2ff4"
            ]
        ]
    },
    {
        "id": "ba8601ddf506473a",
        "type": "exec",
        "z": "53b6806fa04eab7b",
        "command": "ip addr show dev wlan0",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 330,
        "y": 1140,
        "wires": [
            [
                "03dbc2fd5aafdea6"
            ],
            [],
            []
        ]
    },
    {
        "id": "7290e5b8b5295d79",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 1100,
        "wires": [
            [
                "d3a17f777bc385e5",
                "ba8601ddf506473a"
            ]
        ]
    },
    {
        "id": "03dbc2fd5aafdea6",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "讀取目前wifi IP位址",
        "func": "if(msg.payload == \"\") return msg;\n\nvar content = msg.payload;\nvar lines = content.split('\\n'); // 將內容分割成行\nvar inetIndex = lines.findIndex(line => line.includes(\"inet\")); // 找到包含 \"#DHCP\" 的行的索引\nif (inetIndex !== -1) {\n\n   \n\n    var ipRegex = /inet (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})/;\n    var macRegex = /link\\/ether ([0-9a-fA-F:]{17})/;\n\n    msg.payload = content\n    var ipAddress = content.match(ipRegex)[1];\n    var macAddress = content.match(macRegex)[1];\n\n    msg.payload = \n    `Wireless Network<br><br>IP：${ipAddress}<br>Mac：${macAddress}`\n} else { msg.payload = \"\"}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 570,
        "y": 1140,
        "wires": [
            [
                "55206c295c05c611"
            ]
        ]
    },
    {
        "id": "55206c295c05c611",
        "type": "ui_text",
        "z": "53b6806fa04eab7b",
        "group": "e133f7573eba5974",
        "order": 3,
        "width": "6",
        "height": "2",
        "name": "顯示無線網路IP訊息",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "className": "",
        "x": 800,
        "y": 1140,
        "wires": []
    },
    {
        "id": "464772e2f32bf3f7",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 120,
        "y": 40,
        "wires": [
            [
                "fbe8fcef05215a38"
            ]
        ]
    },
    {
        "id": "63b292c2bbec5d08",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "get DHCP status",
        "func": "var content = msg.payload.toString(); // 將文件內容轉換為字符串\n\nvar lines = content.split('\\n'); // 將內容分割成行\nvar dhcpIndex = lines.findIndex(line => line.includes(\"#DHCP=ipv4\")); // 找到包含 \"#DHCP\" 的行的索引\nif (dhcpIndex == -1) {\n    msg.payload = true; // DHCP enable \n  \n} else { msg.payload = false;} // DHCP disable\n\nreturn msg;\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 670,
        "y": 60,
        "wires": [
            [
                "3fd79536014d8b5a"
            ]
        ]
    },
    {
        "id": "23e3ab50d46d8512",
        "type": "link in",
        "z": "53b6806fa04eab7b",
        "name": "",
        "links": [
            "861e157553b2b263"
        ],
        "x": 165,
        "y": 80,
        "wires": [
            [
                "fbe8fcef05215a38"
            ]
        ]
    },
    {
        "id": "3fd79536014d8b5a",
        "type": "link out",
        "z": "53b6806fa04eab7b",
        "name": "get ethernet configuration",
        "mode": "link",
        "links": [
            "9369098a9afca35b"
        ],
        "x": 935,
        "y": 60,
        "wires": []
    },
    {
        "id": "9369098a9afca35b",
        "type": "link in",
        "z": "53b6806fa04eab7b",
        "name": "link in 2",
        "links": [
            "3fd79536014d8b5a"
        ],
        "x": 165,
        "y": 220,
        "wires": [
            [
                "b6d30433824724fc"
            ]
        ]
    },
    {
        "id": "3b28b1db67ca7894",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 200,
        "y": 680,
        "wires": [
            [
                "61eaf57740bfd888"
            ]
        ]
    },
    {
        "id": "afc129fe89b4ef0c",
        "type": "exec",
        "z": "53b6806fa04eab7b",
        "command": "timedatectl list-timezones",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 330,
        "y": 1560,
        "wires": [
            [
                "7469ebfc5d45d267"
            ],
            [],
            []
        ]
    },
    {
        "id": "2549e36f602a75b4",
        "type": "debug",
        "z": "53b6806fa04eab7b",
        "name": "debug 22",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 600,
        "y": 1380,
        "wires": []
    },
    {
        "id": "6dd5e701677763a7",
        "type": "ui_dropdown",
        "z": "53b6806fa04eab7b",
        "name": "",
        "label": "Time Zone",
        "tooltip": "",
        "place": "Select Country",
        "group": "3cb49d1543ee4080",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "",
                "value": "",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 970,
        "y": 1560,
        "wires": [
            [
                "7f02283cbc677887"
            ]
        ]
    },
    {
        "id": "a66c78a17837da55",
        "type": "exec",
        "z": "53b6806fa04eab7b",
        "command": "timedatectl",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 350,
        "y": 1440,
        "wires": [
            [
                "c1c8a0e7ab36367f"
            ],
            [],
            []
        ]
    },
    {
        "id": "7469ebfc5d45d267",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "Time Zone list put into dropdown",
        "func": "var timezones =msg.payload;\nvar timezonesArray = timezones.split('\\n'); // 將內容分割成行\n\nvar options = timezonesArray.map(function (timezone) {\n    // return timezone;\n    var obj = {};\n    obj[timezone] = timezone;\n    return obj;\n});\n\n// var json = {};\n// for (var i = 0; i < timezonesArray.length; i++) {\n//     var timeZone = timezonesArray[i];\n//     json[timeZone] = timeZone;\n// }\n// msg.options = json;\n\n\n\nmsg.options = options;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 630,
        "y": 1560,
        "wires": [
            [
                "a66c78a17837da55",
                "6dd5e701677763a7"
            ]
        ]
    },
    {
        "id": "fcd08475cdd617c9",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "select dropdown item",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "Africa/El_Aaiun",
        "payloadType": "str",
        "x": 140,
        "y": 1660,
        "wires": [
            [
                "6dd5e701677763a7"
            ]
        ]
    },
    {
        "id": "c1c8a0e7ab36367f",
        "type": "function",
        "z": "53b6806fa04eab7b",
        "name": "present time zone",
        "func": "var str = msg.payload;\nvar timezoneRegex = /Time zone: (.*?) \\(/;\nvar match = str.match(timezoneRegex);\n\nvar timezone = match[1];\nmsg.payload = timezone;\nsetTimeout(function () {\n    node.send(msg);  // 輸出 msg\n}, 1000);  // 等待 1000 毫秒（即 1 秒）\n\n\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 590,
        "y": 1440,
        "wires": [
            [
                "6dd5e701677763a7"
            ]
        ]
    },
    {
        "id": "e1b3b054c90f96eb",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "list timezone",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 1560,
        "wires": [
            [
                "afc129fe89b4ef0c"
            ]
        ]
    },
    {
        "id": "817be9342f253031",
        "type": "exec",
        "z": "53b6806fa04eab7b",
        "command": "timedatectl",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 370,
        "y": 1380,
        "wires": [
            [
                "2549e36f602a75b4"
            ],
            [],
            []
        ]
    },
    {
        "id": "0a177530d85a114d",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "read present timezone",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 1380,
        "wires": [
            [
                "817be9342f253031"
            ]
        ]
    },
    {
        "id": "7f02283cbc677887",
        "type": "exec",
        "z": "53b6806fa04eab7b",
        "command": "sudo timedatectl set-timezone",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 970,
        "y": 1660,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "a792c7ec174b3e95",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 90,
        "y": 1440,
        "wires": [
            [
                "a66c78a17837da55"
            ]
        ]
    },
    {
        "id": "d750a411ca72b813",
        "type": "inject",
        "z": "53b6806fa04eab7b",
        "name": "manual input item of dropdown",
        "props": [
            {
                "p": "options",
                "v": "[{\"Africa/Abidjan\":\"Africa/Abidjan\",\"Africa/Algiers\":\"Africa/Algiers\"}]",
                "vt": "json"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 170,
        "y": 1720,
        "wires": [
            [
                "6dd5e701677763a7"
            ]
        ]
    },
    {
        "id": "db59483330ab7e5c",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "read network status",
        "info": "",
        "x": 1010,
        "y": 1060,
        "wires": []
    },
    {
        "id": "aa1221667d220b3a",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "read wireless network status",
        "info": "",
        "x": 1040,
        "y": 1140,
        "wires": []
    },
    {
        "id": "d0047a6e05031e58",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "read present timezone",
        "info": "",
        "x": 820,
        "y": 1380,
        "wires": []
    },
    {
        "id": "7b347b75ed0c87a8",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "renew timezone",
        "info": "",
        "x": 1220,
        "y": 1660,
        "wires": []
    },
    {
        "id": "efd410c48c2c8172",
        "type": "comment",
        "z": "53b6806fa04eab7b",
        "name": "Initialize switch status",
        "info": "",
        "x": 1080,
        "y": 60,
        "wires": []
    },
    {
        "id": "faa550a1.5e6c88",
        "type": "ui_template",
        "z": "53b6806fa04eab7b",
        "group": "e133f7573eba5974",
        "name": "Divider",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "<hr style=\"border: none; border-top: 1px solid #ccc; margin: 0; padding: 0;\">",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 760,
        "y": 1200,
        "wires": [
            []
        ]
    },
    {
        "id": "294daea8c18c16bd",
        "type": "ui_group",
        "name": "Ethernet",
        "tab": "2e17f620493130d6",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "d0bacbf3e8fd4630",
        "type": "ui_group",
        "name": "WIFI Setting",
        "tab": "2e17f620493130d6",
        "order": 3,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "e133f7573eba5974",
        "type": "ui_group",
        "name": "System Info.",
        "tab": "2e17f620493130d6",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "3cb49d1543ee4080",
        "type": "ui_group",
        "name": "Time zone",
        "tab": "2e17f620493130d6",
        "order": 4,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "2e17f620493130d6",
        "type": "ui_tab",
        "name": "A-9N Configuration",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]