[
    {
        "id": "31618d27828dae08",
        "type": "tab",
        "label": "LoRaWAN ",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "cbdb4c82270b0826",
        "type": "exec",
        "z": "31618d27828dae08",
        "command": "",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 830,
        "y": 140,
        "wires": [
            [
                "7907c08935553e55"
            ],
            [],
            []
        ]
    },
    {
        "id": "b57e207d1ab5ecf0",
        "type": "function",
        "z": "31618d27828dae08",
        "name": "MS48-LR read LHT65N's temperature control RS232 relay",
        "func": "var data = msg.payload[\"deviceInfo\"];\nvar decode = msg.payload[\"object\"];\nvar alarm = 25; //Set the alarm temperature\n\nif (decode[\"Ext_sensor\"] == \"Temperature Sensor\") {\n    var f_port = msg.payload[\"fPort\"];\n    var f_cnt = msg.payload[\"fCnt\"];\n    var data2 = decode;\n    var bat = data2[\"BatV\"];\n    var bat_status = data2[\"Bat_status\"];\n    var ext_sensor = data2[\"Ext_sensor\"];\n    var hum_SHT = data2[\"Hum_SHT\"];\n\n    var tempC_DS;\n    if (\"TempC_DS\" in data2) {\n        tempC_DS = data2[\"TempC_DS\"];\n    } else {\n        tempC_DS = data2[\"TempC_TMP117\"];\n    }\n    var tempC_SHT = data2[\"TempC_SHT\"];\n\n    var temperature = tempC_SHT;\n    \n    if (temperature > alarm) {\n        msg.payload = \"echo -e -n '\\\\x55\\\\x56\\\\x00\\\\x00\\\\x00\\\\x01\\\\x01\\\\xAD' >  /dev/ttyS2\";//ON\n        msg.topic = \"Temperature:\"+ tempC_SHT +\"High Temperature Detected\";\n        node.send([msg, null]);\n    } else  {\n        msg.payload = \"echo -e -n '\\\\x55\\\\x56\\\\x00\\\\x00\\\\x00\\\\x01\\\\x02\\\\xAE' >  /dev/ttyS2\";//OFF\n        msg.topic = \"Temperature:\"+ tempC_SHT +\"Low Temperature Detected\";\n        node.send([msg, null]);\n    }\n} else {\n    msg.payload = \"No temperature sensor data found\";\n    msg.topic = \"No Temperature Sensor\";\n    node.send([msg, null]);\n}",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 410,
        "y": 140,
        "wires": [
            [
                "cbdb4c82270b0826"
            ]
        ]
    },
    {
        "id": "7907c08935553e55",
        "type": "debug",
        "z": "31618d27828dae08",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1040,
        "y": 140,
        "wires": []
    },
    {
        "id": "9ff88c09ca0fed63",
        "type": "mqtt in",
        "z": "31618d27828dae08",
        "name": "LHT65N",
        "topic": "application/90dac8fe-b753-4551-ab98-84a0e1c13587/device/70b3d57ed005e6cc/event/up",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "1af37f0f852dec1b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 100,
        "y": 140,
        "wires": [
            [
                "b57e207d1ab5ecf0"
            ]
        ]
    },
    {
        "id": "c192d47f3fd7bf2a",
        "type": "inject",
        "z": "31618d27828dae08",
        "name": "ON",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "echo -e -n \"\\x55\\x56\\x00\\x00\\x00\\x01\\x01\\xAD\" > /dev/ttyS2",
        "payloadType": "str",
        "x": 610,
        "y": 60,
        "wires": [
            [
                "cbdb4c82270b0826"
            ]
        ]
    },
    {
        "id": "222a36d65112e6fb",
        "type": "inject",
        "z": "31618d27828dae08",
        "name": "OFF",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "echo -e -n \"\\x55\\x56\\x00\\x00\\x00\\x01\\x02\\xAE\" > /dev/ttyS2",
        "payloadType": "str",
        "x": 610,
        "y": 100,
        "wires": [
            [
                "cbdb4c82270b0826"
            ]
        ]
    },
    {
        "id": "3995734c13f3e004",
        "type": "comment",
        "z": "31618d27828dae08",
        "name": "When the temperature is greater than 25℃, the RS232 relay is controlled ON",
        "info": "When the temperature is greater than 25℃, the RS232 relay is controlled ON",
        "x": 430,
        "y": 200,
        "wires": []
    },
    {
        "id": "760c46fa3d1d265b",
        "type": "comment",
        "z": "31618d27828dae08",
        "name": "When the temperature is less than 25℃, the RS232 relay is controlled OFF",
        "info": "When the temperature is less than 25℃, the RS232 relay is controlled OFF",
        "x": 420,
        "y": 240,
        "wires": []
    },
    {
        "id": "88e6566fb83efd98",
        "type": "comment",
        "z": "31618d27828dae08",
        "name": "The MS48-LR RS232 interface corresponds to /dev/ttyS2",
        "info": "",
        "x": 370,
        "y": 280,
        "wires": []
    },
    {
        "id": "1af37f0f852dec1b",
        "type": "mqtt-broker",
        "name": "",
        "broker": "10.130.2.53",
        "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": ""
    }
]