Trigger at a message from one node, but output a message object from another node

I'm building a weather dashboard. Once the user gives an input, the weather at that location gets updated every 30 seconds (the user can change this value). The user can set a limit for each parameter (temperature, humidity, wind speed). If the value for each parameter at that location surpasses the limit, the dashboard displays a warning message.

With my current dashboard, the warning message only shows once. I want to display it every time the weather gets updated (at 30-second intervals by default, or at the user-defined interval).

I tried connecting the trigger nodes for user input to the warning message nodes, but then, it overrides the payload message. If I can connect the trigger node for weather data, but make sure it does not override the limits set by the user, this will solve my problem.

The working flow is attached below.

[
    {
        "id": "def84d61.37252",
        "type": "ui_text_input",
        "z": "58e87bcc.806654",
        "name": "city",
        "label": "City",
        "tooltip": "Enter the city name",
        "group": "4f271a00.762388",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "",
        "sendOnBlur": true,
        "className": "",
        "topicType": "str",
        "x": 130,
        "y": 80,
        "wires": [
            [
                "cdc7ca82.5179f8"
            ]
        ]
    },
    {
        "id": "52306173.91c4e",
        "type": "ui_text_input",
        "z": "58e87bcc.806654",
        "name": "country",
        "label": "Country",
        "tooltip": "Enter the country name",
        "group": "4f271a00.762388",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "",
        "sendOnBlur": true,
        "className": "",
        "topicType": "str",
        "x": 140,
        "y": 40,
        "wires": [
            [
                "43d8938.909c86c"
            ]
        ]
    },
    {
        "id": "cdc7ca82.5179f8",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "flow.set(\"city\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "43d8938.909c86c",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "flow.set(\"country\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 40,
        "wires": [
            []
        ]
    },
    {
        "id": "d857e292.d9feb",
        "type": "ui_numeric",
        "z": "58e87bcc.806654",
        "name": "",
        "label": "Update Interval (s)",
        "tooltip": "",
        "group": "ecd479fa.1d4d48",
        "order": 6,
        "width": "6",
        "height": "1",
        "wrap": false,
        "passthru": true,
        "topic": "topic",
        "topicType": "msg",
        "format": "{{payload}}",
        "min": "5",
        "max": "50",
        "step": "2",
        "className": "",
        "x": 170,
        "y": 540,
        "wires": [
            [
                "3ff1f15e5580eed1"
            ]
        ]
    },
    {
        "id": "3ff1f15e5580eed1",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "global.set(\"delay_time\",msg.payload);\n\nreturn{\n    delay : 1000*parseInt(global.get(\"delay_time\"))\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "db426105c4baa574",
        "type": "ui_dropdown",
        "z": "58e87bcc.806654",
        "name": "",
        "label": "Warning : ",
        "tooltip": "",
        "place": "Select option",
        "group": "57b28e4f.9d929",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "Temperature",
                "value": 1,
                "type": "num"
            },
            {
                "label": "Pressure",
                "value": 2,
                "type": "num"
            },
            {
                "label": "Wind Speed",
                "value": 3,
                "type": "num"
            }
        ],
        "payload": "",
        "topic": "topic",
        "topicType": "msg",
        "className": "",
        "x": 140,
        "y": 420,
        "wires": [
            [
                "0dd15419ac1b1fc3"
            ]
        ]
    },
    {
        "id": "0dd15419ac1b1fc3",
        "type": "switch",
        "z": "58e87bcc.806654",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "3",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 270,
        "y": 420,
        "wires": [
            [
                "ce21558a22d636da"
            ],
            [
                "0104e57728608a4c"
            ],
            [
                "2412d5217d0464a8"
            ]
        ]
    },
    {
        "id": "ce21558a22d636da",
        "type": "change",
        "z": "58e87bcc.806654",
        "name": "Temp range",
        "rules": [
            {
                "t": "set",
                "p": "ui_control.min",
                "pt": "msg",
                "to": "15",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "ui_control.max",
                "pt": "msg",
                "to": "50",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "choice",
                "pt": "global",
                "to": "1",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "50",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 430,
        "y": 380,
        "wires": [
            [
                "8368d4c3.ae2028"
            ]
        ]
    },
    {
        "id": "0104e57728608a4c",
        "type": "change",
        "z": "58e87bcc.806654",
        "name": "Pressure range",
        "rules": [
            {
                "t": "set",
                "p": "ui_control.min",
                "pt": "msg",
                "to": "900",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "ui_control.max",
                "pt": "msg",
                "to": "2000",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "choice",
                "pt": "global",
                "to": "2",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "2000",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 440,
        "y": 420,
        "wires": [
            [
                "8368d4c3.ae2028"
            ]
        ]
    },
    {
        "id": "2412d5217d0464a8",
        "type": "change",
        "z": "58e87bcc.806654",
        "name": "Wind range",
        "rules": [
            {
                "t": "set",
                "p": "ui_control.min",
                "pt": "msg",
                "to": "2",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "ui_control.max",
                "pt": "msg",
                "to": "10",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "choice",
                "pt": "global",
                "to": "3",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "10",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 430,
        "y": 460,
        "wires": [
            [
                "8368d4c3.ae2028"
            ]
        ]
    },
    {
        "id": "8368d4c3.ae2028",
        "type": "ui_slider",
        "z": "58e87bcc.806654",
        "name": "Limit",
        "label": "Set Limit",
        "tooltip": "",
        "group": "57b28e4f.9d929",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "end",
        "topic": "choice",
        "topicType": "global",
        "min": "10",
        "max": "40",
        "step": "2",
        "className": "",
        "x": 610,
        "y": 420,
        "wires": [
            [
                "11c6e8ca.c36797"
            ]
        ]
    },
    {
        "id": "11c6e8ca.c36797",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "if (msg.topic == \"1\") {\n    let t = global.get(\"tempc\");\n    if (msg.payload < t) {\n        msg.dif = t - msg.payload;\n        msg.out = \"Temperature is \" + t + \"°C exceeds the limit by \" + msg.dif.toFixed(2) + \"°C\";\n    }\n} else if (msg.topic == \"2\") {\n    let p = global.get(\"pressure\");\n    if (msg.payload < p) {\n        msg.dif = p - msg.payload;\n        msg.out = \"Pressure is \" + p + \"hPa exceeds the limit by \" + msg.dif.toFixed(2) + \"hPa\";\n    }\n} else if (msg.topic == \"3\") {\n    let w = global.get(\"windspeed\");\n    if (msg.payload < w) {\n        msg.dif = w - msg.payload;\n        msg.out = \"Windspeed is \" + w + \"kmh exceeds the limit by \" + msg.dif.toFixed(2) + \"kmh\";\n    }\n}\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 760,
        "y": 420,
        "wires": [
            [
                "7e37c644.6774c8",
                "dbe54bd5b0a3de77",
                "e85d5b7b52a5f7c8"
            ]
        ]
    },
    {
        "id": "7e37c644.6774c8",
        "type": "change",
        "z": "58e87bcc.806654",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "out",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "diff",
                "pt": "msg",
                "to": "dif",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 940,
        "y": 420,
        "wires": [
            [
                "4e03d735.666e08"
            ]
        ]
    },
    {
        "id": "4e03d735.666e08",
        "type": "ui_toast",
        "z": "58e87bcc.806654",
        "position": "dialog",
        "displayTime": "3",
        "highlight": "",
        "sendall": true,
        "outputs": 1,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "Warning!!!",
        "name": "",
        "x": 1110,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "b9a073da.96b51",
        "type": "ui_button",
        "z": "58e87bcc.806654",
        "name": "",
        "group": "4f271a00.762388",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Submit",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "true",
        "payloadType": "bool",
        "topic": "",
        "topicType": "str",
        "x": 140,
        "y": 660,
        "wires": [
            [
                "3bff49e4.cede06"
            ]
        ]
    },
    {
        "id": "3bff49e4.cede06",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "if(msg.payload){\n    return{\n        location : {\n            country : flow.get(\"country\"),\n            city : flow.get(\"city\")\n        },\n        delay: 1000 * parseInt(global.get(\"delay_time\"))\n    }\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 300,
        "y": 660,
        "wires": [
            [
                "3e4f6f3df436778b",
                "f5ac289be727292e"
            ]
        ]
    },
    {
        "id": "f5ac289be727292e",
        "type": "trigger",
        "z": "58e87bcc.806654",
        "name": "Resend 30s",
        "op1": "",
        "op2": "0",
        "op1type": "pay",
        "op2type": "str",
        "duration": "-30",
        "extend": false,
        "overrideDelay": true,
        "units": "s",
        "reset": "stop",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 150,
        "y": 740,
        "wires": [
            [
                "f40fd0836cba2058"
            ]
        ]
    },
    {
        "id": "f40fd0836cba2058",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "Input",
        "func": "let v;\n\nlet k = msg.location\n\nif (k.hasOwnProperty('country')) {\n    v = \"1\"\n} else if (k.hasOwnProperty('lat')) {\n    v = \"2\"\n} else {\n    v = \"3\"\n}\n\nflow.set(\"type\", v)\n\nreturn {\n    v: v,\n    location: k\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 310,
        "y": 740,
        "wires": [
            [
                "6d9ca8be7f39cbad"
            ]
        ]
    },
    {
        "id": "6d9ca8be7f39cbad",
        "type": "switch",
        "z": "58e87bcc.806654",
        "name": "",
        "property": "v",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 450,
        "y": 740,
        "wires": [
            [
                "f185e542.8805d8"
            ],
            [
                "d67f1526.df33d8"
            ]
        ]
    },
    {
        "id": "f185e542.8805d8",
        "type": "openweathermap",
        "z": "58e87bcc.806654",
        "name": "",
        "wtype": "current",
        "lon": "",
        "lat": "",
        "city": "",
        "country": "",
        "language": "en",
        "x": 650,
        "y": 620,
        "wires": [
            [
                "b40b4212.24744",
                "2a93c6c.1de5b3a",
                "f1e080e1.05dd7",
                "49e145d4.08f73c",
                "185166fe.2e4809",
                "b9e23bd0.ea7e08",
                "901e6ec.4740a9",
                "805abd3a.ac498",
                "dd02eca8.d6e4f",
                "11219d2e62e0dbf6",
                "9446411facaa23a2",
                "8625b310c621b660",
                "a3bd218c2fc29433"
            ]
        ]
    },
    {
        "id": "8625b310c621b660",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "Global values",
        "func": "global.set(\"description\", msg.payload.description);\nglobal.set(\"tempc\", msg.payload.tempc);\nglobal.set(\"windspeed\", msg.payload.windspeed);\nglobal.set(\"pressure\", msg.payload.pressure);\nglobal.set(\"location\", msg.payload.location)\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 680,
        "y": 720,
        "wires": [
            []
        ]
    },
    {
        "id": "4f271a00.762388",
        "type": "ui_group",
        "name": "Input city/country",
        "tab": "152c952d.14cc0b",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "ecd479fa.1d4d48",
        "type": "ui_group",
        "name": "Input method",
        "tab": "674b6dad.b573d4",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "57b28e4f.9d929",
        "type": "ui_group",
        "name": "Warning Limits",
        "tab": "152c952d.14cc0b",
        "order": 6,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "152c952d.14cc0b",
        "type": "ui_tab",
        "name": "Weather",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "674b6dad.b573d4",
        "type": "ui_tab",
        "name": "Settings",
        "icon": "dashboard",
        "order": 3,
        "disabled": false,
        "hidden": false
    }
]

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