Beginner - Sending mulitple AT commands in sequence to a serial interface (raspberry pi with USB dongle)

Hi .. I am new to both Node-RED and the forum..
I am kind of stuck and hoping someone can send me in the right direction -
Setup - Raspberry Pi 3 - LTE USB dongle
Due to lack of internet in the house I am setting the node red up - I would like to send SMS trough a USB dongle..
And I am able to now. By first using a function to send payload

var num = "+45xxxxxxxx";
var at_cmd = "AT+CMGS=\""+num+"\""; 
msg.payload=at_cmd+"\r";
return msg;

Then insert a delay for 2 seconds . and then using function to send the second payload

var sms_msg = "Temperature low";
msg.payload=sms_msg+"\x1A";
return msg;

This is working fine.

But when I would like to add a second number to send a SMS to in parallel with the one above - then I am not in control of the sending of AT commands to the USB interface - and ending up getting ether errors or mixing the at commands - so i'll include the "at_cmd+" from sequence1 as text in the sequence2 SMS

The question - what would be best practice - set some kind of flag in the sequence1 to stop sequence2 - or a switch node before the serial interface?

BR Jan Eriksen

Hi and welcome.

I am confused by what you mean "to send a SMS to a parallel with the one above".

parallel is the problem here. Could you elaborate on what you mean there?

Doing this would be one way of doing what you want.
I hope you can understand what I am meaning.

The inject node is there to simulate a message arriving and to get things going.

the first function node does the first bit you mentioned and the first debug node goes to the code to do the

var num = "+45xxxxxxxx";
var at_cmd = "AT+CMGS=\""+num+"\""; 
msg.payload=at_cmd+"\r";
return msg;

The next function node will send the second part.

Then the last one does the third command you are wanting to do.

This is my flow now - and in short.
Inject - reads the temperature on the 2 sensors every 5 sec. and if the state is belowe 24 C on Temp1 sensor - 2 different phones gets the sms "Temp1 Low" and thats okay now, when i got the delay in. But If both Temp1 and Temp2 changes state at the same time, or when I deploy - the state is set at the same time, then the AT commands is mixed up from the 2 flow.

First part of the flow

[
    {
        "id": "ab3d9378cba2a69c",
        "type": "tab",
        "label": "Flow 4",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "456ac1f426159150",
        "type": "sensor-ds18b20",
        "z": "ab3d9378cba2a69c",
        "name": "Temp1",
        "topic": "",
        "sensorid": "28-021317ba0faa",
        "timer": "3",
        "repeat": false,
        "x": 330,
        "y": 200,
        "wires": [
            [
                "9894e78d2cafdb69",
                "762fd6988e76c6f8",
                "7c8cf407622df33d"
            ]
        ]
    },
    {
        "id": "9894e78d2cafdb69",
        "type": "ui_gauge",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "group": "3b4b41a454fdbea4",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Temp1",
        "label": "C",
        "format": "{{value}}",
        "min": 0,
        "max": "40",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 550,
        "y": 280,
        "wires": []
    },
    {
        "id": "762fd6988e76c6f8",
        "type": "ui_chart",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "group": "3b4b41a454fdbea4",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "Temp1",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 550,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "7c8cf407622df33d",
        "type": "switch",
        "z": "ab3d9378cba2a69c",
        "name": "Switch between On and Off",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "24",
                "vt": "num"
            },
            {
                "t": "lte",
                "v": "24",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 580,
        "y": 200,
        "wires": [
            [
                "35d874550817f0d3"
            ],
            [
                "dfd71c249d6aec9e"
            ]
        ]
    },
    {
        "id": "cd4009e040bb100a",
        "type": "rpi-gpio out",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "pin": "21",
        "set": "",
        "level": "0",
        "freq": "",
        "out": "out",
        "bcm": true,
        "x": 1140,
        "y": 180,
        "wires": []
    },
    {
        "id": "dfd71c249d6aec9e",
        "type": "change",
        "z": "ab3d9378cba2a69c",
        "name": "ON",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 810,
        "y": 240,
        "wires": [
            [
                "e07c1a5de4c88d0a",
                "cd4009e040bb100a",
                "d5113d3e059ddd67"
            ]
        ]
    },
    {
        "id": "35d874550817f0d3",
        "type": "change",
        "z": "ab3d9378cba2a69c",
        "name": "OFF",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 810,
        "y": 200,
        "wires": [
            [
                "cd4009e040bb100a",
                "e07c1a5de4c88d0a",
                "d5113d3e059ddd67"
            ]
        ]
    },
    {
        "id": "daed55a025e13af7",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45xxxxxxxx",
        "func": "var num = \"+45xxxxxxxx\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\n\n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1440,
        "y": 240,
        "wires": [
            [
                "e77004374c606002",
                "13f10f748a517135"
            ]
        ]
    },
    {
        "id": "e8b146c8bbeb51e3",
        "type": "serial out",
        "z": "ab3d9378cba2a69c",
        "name": "Serail-Out",
        "serial": "93485f7d.0073f",
        "x": 2360,
        "y": 340,
        "wires": []
    },
    {
        "id": "0421b41ac42c9932",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45yyyyyyyy",
        "func": "var num = \"+45yyyyyyyy\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\n\n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1960,
        "y": 360,
        "wires": [
            [
                "ce31756f4f28f90e",
                "13f10f748a517135"
            ]
        ]
    },
    {
        "id": "e07c1a5de4c88d0a",
        "type": "trigger",
        "z": "ab3d9378cba2a69c",
        "name": "Trigger on low",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "0",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1160,
        "y": 240,
        "wires": [
            [
                "daed55a025e13af7"
            ]
        ]
    },
    {
        "id": "fa2cb9762b48bad0",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45xxxxxxxx",
        "func": "var num = \"+45xxxxxxxx\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1440,
        "y": 460,
        "wires": [
            [
                "6202c61b75518bed",
                "8c85e9641002b16a"
            ]
        ]
    },
    {
        "id": "6433a70de4096dfd",
        "type": "serial out",
        "z": "ab3d9378cba2a69c",
        "name": "Serail-Out",
        "serial": "93485f7d.0073f",
        "x": 2360,
        "y": 560,
        "wires": []
    },
    {
        "id": "b1576d3428389c16",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message - Temp1 Normal",
        "func": "var sms_msg = \"Temp1 Normal\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2010,
        "y": 520,
        "wires": [
            [
                "7aa45a64475a9327",
                "8c85e9641002b16a"
            ]
        ]
    },
    {
        "id": "6202c61b75518bed",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "2 sec. delay",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1730,
        "y": 520,
        "wires": [
            [
                "b1576d3428389c16"
            ]
        ]
    },
    {
        "id": "36da162b38e559e5",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45yyyyyyyy",
        "func": "var num = \"+45yyyyyyyy2\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2000,
        "y": 580,
        "wires": [
            [
                "51cdee925e4a9515",
                "8c85e9641002b16a"
            ]
        ]
    },
    {
        "id": "0835e74319b64d94",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message - Temp1 Normal",
        "func": "var sms_msg = \"Temp1 Normal\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2010,
        "y": 640,
        "wires": [
            [
                "8c85e9641002b16a"
            ]
        ]
    },
    {
        "id": "51cdee925e4a9515",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "2 sec. delay",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1730,
        "y": 640,
        "wires": [
            [
                "0835e74319b64d94"
            ]
        ]
    },
    {
        "id": "7aa45a64475a9327",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "2 sec. delay",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1730,
        "y": 580,
        "wires": [
            [
                "36da162b38e559e5"
            ]
        ]
    },
    {
        "id": "d5113d3e059ddd67",
        "type": "trigger",
        "z": "ab3d9378cba2a69c",
        "name": "Trigger on normal",
        "op1": "0",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "0",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "1",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1170,
        "y": 300,
        "wires": [
            [
                "fa2cb9762b48bad0"
            ]
        ]
    },
    {
        "id": "4b5a646321a1da5c",
        "type": "inject",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 150,
        "y": 200,
        "wires": [
            [
                "456ac1f426159150"
            ]
        ]
    },
    {
        "id": "78f49080734fbfdd",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message - Temp1 Low",
        "func": "var sms_msg = \"Temp1 low\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1960,
        "y": 300,
        "wires": [
            [
                "fec72d9e6be55e7f",
                "13f10f748a517135"
            ]
        ]
    },
    {
        "id": "9429809b41a30d45",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message - Temp1 low",
        "func": "var sms_msg = \"Temp1 low\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1960,
        "y": 420,
        "wires": [
            [
                "13f10f748a517135"
            ]
        ]
    },
    {
        "id": "ce31756f4f28f90e",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "3 sec. delay",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1730,
        "y": 420,
        "wires": [
            [
                "9429809b41a30d45"
            ]
        ]
    },
    {
        "id": "e77004374c606002",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "3 sec. delay",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1730,
        "y": 300,
        "wires": [
            [
                "78f49080734fbfdd"
            ]
        ]
    },
    {
        "id": "fec72d9e6be55e7f",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "3 sec delay",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1730,
        "y": 360,
        "wires": [
            [
                "0421b41ac42c9932"
            ]
        ]
    },
    {
        "id": "13f10f748a517135",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Do nothing",
        "func": "\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2350,
        "y": 240,
        "wires": [
            [
                "e8b146c8bbeb51e3",
                "ba32d65c15d97588"
            ]
        ]
    },
    {
        "id": "8c85e9641002b16a",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Do nothing",
        "func": "\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2350,
        "y": 440,
        "wires": [
            [
                "6433a70de4096dfd",
                "821dc5a62e90b779"
            ]
        ]
    },
    {
        "id": "ba32d65c15d97588",
        "type": "debug",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2570,
        "y": 240,
        "wires": []
    },
    {
        "id": "821dc5a62e90b779",
        "type": "debug",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2570,
        "y": 440,
        "wires": []
    },
    {
        "id": "3b4b41a454fdbea4",
        "type": "ui_group",
        "name": "Temp1",
        "tab": "dbc3af9fe5f50809",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "93485f7d.0073f",
        "type": "serial-port",
        "serialport": "/dev/ttyUSB3",
        "serialbaud": "9600",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "waitfor": "",
        "newline": "\\n\\r",
        "bin": "false",
        "out": "char",
        "addchar": "false",
        "responsetimeout": ""
    },
    {
        "id": "dbc3af9fe5f50809",
        "type": "ui_tab",
        "name": "Floes",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]```

Second part of the flow

[
    {
        "id": "ab3d9378cba2a69c",
        "type": "tab",
        "label": "Flow 4",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "058e3fb12774f792",
        "type": "sensor-ds18b20",
        "z": "ab3d9378cba2a69c",
        "name": "Temp2",
        "topic": "",
        "sensorid": "28-030997790878",
        "timer": "3",
        "repeat": false,
        "x": 290,
        "y": 180,
        "wires": [
            [
                "00879db046f76ce5",
                "944efa2e5fab7809",
                "0880415b2616e7b2"
            ]
        ]
    },
    {
        "id": "00879db046f76ce5",
        "type": "ui_gauge",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "group": "ba9be29e7ac01f9d",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Temp2",
        "label": "C",
        "format": "{{value}}",
        "min": 0,
        "max": "40",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 470,
        "y": 280,
        "wires": []
    },
    {
        "id": "944efa2e5fab7809",
        "type": "ui_chart",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "group": "ba9be29e7ac01f9d",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "Temp2",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 470,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "cef813c19f3b2b94",
        "type": "serial in",
        "z": "ab3d9378cba2a69c",
        "name": "Serial-In",
        "serial": "93485f7d.0073f",
        "x": 2220,
        "y": 660,
        "wires": [
            [
                "b797db790e9a41ac"
            ]
        ]
    },
    {
        "id": "b797db790e9a41ac",
        "type": "debug",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "false",
        "x": 2390,
        "y": 660,
        "wires": []
    },
    {
        "id": "a18fd8dcfd6e2fd2",
        "type": "inject",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 110,
        "y": 180,
        "wires": [
            [
                "058e3fb12774f792"
            ]
        ]
    },
    {
        "id": "0880415b2616e7b2",
        "type": "switch",
        "z": "ab3d9378cba2a69c",
        "name": "Skift",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "24",
                "vt": "num"
            },
            {
                "t": "lte",
                "v": "24",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 470,
        "y": 180,
        "wires": [
            [
                "8a0d379a440dc794"
            ],
            [
                "1cb03c72e7d9e7ca"
            ]
        ]
    },
    {
        "id": "1cb03c72e7d9e7ca",
        "type": "change",
        "z": "ab3d9378cba2a69c",
        "name": "ON",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 730,
        "y": 220,
        "wires": [
            [
                "3fb5baad1fbccae1",
                "84832452f6a2f648"
            ]
        ]
    },
    {
        "id": "8a0d379a440dc794",
        "type": "change",
        "z": "ab3d9378cba2a69c",
        "name": "OFF",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 730,
        "y": 180,
        "wires": [
            [
                "3fb5baad1fbccae1",
                "84832452f6a2f648"
            ]
        ]
    },
    {
        "id": "bf56e432530b0a88",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45xxxxxxxx",
        "func": "var num = \"+45xxxxxxxx\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1300,
        "y": 180,
        "wires": [
            [
                "aa88b39a2c0408bb",
                "07e5f1ccb3ac737f"
            ]
        ]
    },
    {
        "id": "b90d60c466ae5f6a",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message - Temp2 low",
        "func": "var sms_msg = \"Temp2 low\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1940,
        "y": 240,
        "wires": [
            [
                "281c130f6d424f13",
                "07e5f1ccb3ac737f"
            ]
        ]
    },
    {
        "id": "aa88b39a2c0408bb",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "6 sec. delay",
        "pauseType": "delay",
        "timeout": "6",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1670,
        "y": 240,
        "wires": [
            [
                "b90d60c466ae5f6a"
            ]
        ]
    },
    {
        "id": "6aa1a4e756d0a0e8",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45yyyyyyyy",
        "func": "var num = \"+45yyyyyyyy\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1940,
        "y": 300,
        "wires": [
            [
                "5e8c57fbe6778fdd",
                "07e5f1ccb3ac737f"
            ]
        ]
    },
    {
        "id": "fa634561f9e48bce",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message Temp2 low",
        "func": "var sms_msg = \"Temp2 Low\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1940,
        "y": 360,
        "wires": [
            [
                "07e5f1ccb3ac737f"
            ]
        ]
    },
    {
        "id": "3fb5baad1fbccae1",
        "type": "trigger",
        "z": "ab3d9378cba2a69c",
        "name": "Trigger on low",
        "op1": "1",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "0",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "0",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1020,
        "y": 180,
        "wires": [
            [
                "bf56e432530b0a88"
            ]
        ]
    },
    {
        "id": "05d0e91c59b6de09",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45xxxxxxxx",
        "func": "var num = \"+45xxxxxxxx\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1340,
        "y": 440,
        "wires": [
            [
                "d100461d08710984",
                "964e64c7e23327fb"
            ]
        ]
    },
    {
        "id": "11fc35ce1893d4dc",
        "type": "serial out",
        "z": "ab3d9378cba2a69c",
        "name": "Serail-Out",
        "serial": "93485f7d.0073f",
        "x": 2240,
        "y": 540,
        "wires": []
    },
    {
        "id": "7b630b778a3e6fe2",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message - Temp2 Normal",
        "func": "var sms_msg = \"Temp2 Normal\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1910,
        "y": 480,
        "wires": [
            [
                "944faccbb2a2d20f",
                "964e64c7e23327fb"
            ]
        ]
    },
    {
        "id": "94d68a51ab63167c",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Send to +45yyyyyyyy",
        "func": "var num = \"+45yyyyyyyy\";\nvar at_cmd = \"AT+CMGS=\\\"\"+num+\"\\\"\"; \n\nmsg.payload=at_cmd+\"\\r\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1900,
        "y": 540,
        "wires": [
            [
                "8acc4828f5888dc4",
                "964e64c7e23327fb"
            ]
        ]
    },
    {
        "id": "d4a52b2bd6b2212b",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Message - Temp2 Normal",
        "func": "var sms_msg = \"Temp2 Normal\";\n\nmsg.payload=sms_msg+\"\\x1A\";\n//msg.payload.msg =msg.payload.message;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1910,
        "y": 600,
        "wires": [
            [
                "964e64c7e23327fb"
            ]
        ]
    },
    {
        "id": "84832452f6a2f648",
        "type": "trigger",
        "z": "ab3d9378cba2a69c",
        "name": "Trigger on normal",
        "op1": "0",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "0",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "1",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1030,
        "y": 240,
        "wires": [
            [
                "05d0e91c59b6de09"
            ]
        ]
    },
    {
        "id": "281c130f6d424f13",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "3 sec. delay",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1670,
        "y": 300,
        "wires": [
            [
                "6aa1a4e756d0a0e8"
            ]
        ]
    },
    {
        "id": "5e8c57fbe6778fdd",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "3 sec. delay",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1670,
        "y": 360,
        "wires": [
            [
                "fa634561f9e48bce"
            ]
        ]
    },
    {
        "id": "d100461d08710984",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "2 sek forsinkelse",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1650,
        "y": 480,
        "wires": [
            [
                "7b630b778a3e6fe2"
            ]
        ]
    },
    {
        "id": "944faccbb2a2d20f",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "2 sek forsinkelse",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1650,
        "y": 540,
        "wires": [
            [
                "94d68a51ab63167c"
            ]
        ]
    },
    {
        "id": "8acc4828f5888dc4",
        "type": "delay",
        "z": "ab3d9378cba2a69c",
        "name": "2 sek forsinkelse",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1650,
        "y": 600,
        "wires": [
            [
                "d4a52b2bd6b2212b"
            ]
        ]
    },
    {
        "id": "9da459aec61619a0",
        "type": "serial out",
        "z": "ab3d9378cba2a69c",
        "name": "Serail-Out",
        "serial": "93485f7d.0073f",
        "x": 2260,
        "y": 280,
        "wires": []
    },
    {
        "id": "07e5f1ccb3ac737f",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Do nothing",
        "func": "\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2270,
        "y": 180,
        "wires": [
            [
                "9da459aec61619a0",
                "3a127e0eaf9415bb"
            ]
        ]
    },
    {
        "id": "964e64c7e23327fb",
        "type": "function",
        "z": "ab3d9378cba2a69c",
        "name": "Do nothing",
        "func": "\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2230,
        "y": 440,
        "wires": [
            [
                "11fc35ce1893d4dc",
                "832a8afac877e7c6"
            ]
        ]
    },
    {
        "id": "3a127e0eaf9415bb",
        "type": "debug",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2510,
        "y": 180,
        "wires": []
    },
    {
        "id": "832a8afac877e7c6",
        "type": "debug",
        "z": "ab3d9378cba2a69c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2510,
        "y": 440,
        "wires": []
    },
    {
        "id": "ba9be29e7ac01f9d",
        "type": "ui_group",
        "name": "Temp2",
        "tab": "dbc3af9fe5f50809",
        "order": 2,
        "disp": false,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "93485f7d.0073f",
        "type": "serial-port",
        "serialport": "/dev/ttyUSB3",
        "serialbaud": "9600",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "waitfor": "",
        "newline": "\\n\\r",
        "bin": "false",
        "out": "char",
        "addchar": "false",
        "responsetimeout": ""
    },
    {
        "id": "dbc3af9fe5f50809",
        "type": "ui_tab",
        "name": "Floes",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

Ok, when first deployed there is a conflict.

Why not add a delay for reading Temp2 so it happens at a different time than Temp1?

I'm not sure how you posted the flow/s but .....

AFAIK, you should be able to post the entire flow in one block - if what your screen shot shows is the whole thing.

But - please - before you post it replace the nodes that get the temperature and replace them with simply a function node that sends a number value with a nominal value.
Otherwise it won't work on my machine. (My: anyone who loads it wanting to help)

If you have a section of flow that must only have one message flowing through it at any one time then one way to solve that is to use node-red-contrib-semaphore. I have used that and it works well.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.