Flow malfunctions when user defined update intervals are set

Hello,
I'm building a weather dashboard with OpenWeatherMap API. Users can select if they want to give input as country/ city or latitude/ longitude.

By default, weather updates at 30-second intervals (requirement of the project) but, the user can set the update interval to anytime he wants (under the "Settings" tab).

Dashboard updates at 30-second intervals. But, I cannot figure out how to connect the user-defined update interval to this flow.

Can someone please help me?

[
    {
        "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": "82922ca9.078af",
        "type": "ui_text_input",
        "z": "58e87bcc.806654",
        "name": "lat",
        "label": "Latitudes",
        "tooltip": "Enter the country name",
        "group": "212c669d.fce9ba",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "",
        "x": 130,
        "y": 140,
        "wires": [
            [
                "d4a591df.5b009"
            ]
        ]
    },
    {
        "id": "d4a591df.5b009",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "flow.set(\"lat\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "8e84afb1.d7ef2",
        "type": "ui_text_input",
        "z": "58e87bcc.806654",
        "name": "lon",
        "label": "Longitudes",
        "tooltip": "Enter the city name",
        "group": "212c669d.fce9ba",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "",
        "x": 130,
        "y": 180,
        "wires": [
            [
                "dd853b0f.6acb68"
            ]
        ]
    },
    {
        "id": "dd853b0f.6acb68",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "flow.set(\"lon\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 340,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "76ea833b.a1b88c",
        "type": "ui_dropdown",
        "z": "58e87bcc.806654",
        "name": "",
        "label": "",
        "tooltip": "",
        "place": "Select option",
        "group": "ecd479fa.1d4d48",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "City/Country",
                "value": 0,
                "type": "num"
            },
            {
                "label": "Coordinates",
                "value": 1,
                "type": "num"
            }
        ],
        "payload": "",
        "topic": "",
        "topicType": "str",
        "className": "",
        "x": 140,
        "y": 240,
        "wires": [
            [
                "6f773aa1.fc53f4"
            ]
        ]
    },
    {
        "id": "6f773aa1.fc53f4",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "flow.set(\"val\", msg.payload);\nif(msg.payload == 0){\n    msg.payload = {\"group\":{\"hide\":[\"Weather_Input_latitude/longitude\"],\"show\":[\"Weather_Input_city/country\"]}};\n}else{\n    msg.payload = {\"group\":{\"hide\":[\"Weather_Input_city/country\"],\"show\":[\"Weather_Input_latitude/longitude\"]}};\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 240,
        "wires": [
            [
                "e7e4025b.cdb6",
                "b4a00bb1.c6ce98"
            ]
        ]
    },
    {
        "id": "b4a00bb1.c6ce98",
        "type": "ui_ui_control",
        "z": "58e87bcc.806654",
        "name": "",
        "events": "all",
        "x": 500,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "e7e4025b.cdb6",
        "type": "ui_text",
        "z": "58e87bcc.806654",
        "group": "ecd479fa.1d4d48",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Select whether you enter coordinates as city/country or coordinates.",
        "format": "",
        "layout": "row-left",
        "className": "",
        "x": 680,
        "y": 240,
        "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": [
            [
                "2aebe2adc587c941"
            ]
        ]
    },
    {
        "id": "2aebe2adc587c941",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "Delay",
        "func": "if (msg.payload) {\n    flow.set(\"delay\", msg.payload)\n    \n    return {\n        delay: msg.payload\n    }\n} ",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 540,
        "wires": [
            [
                "96b335f44ddebf4e"
            ]
        ]
    },
    {
        "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    }\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 300,
        "y": 660,
        "wires": [
            [
                "51c93547576fdd44",
                "3e4f6f3df436778b"
            ]
        ]
    },
    {
        "id": "51c93547576fdd44",
        "type": "trigger",
        "z": "58e87bcc.806654",
        "name": "Trigger",
        "op1": "stop",
        "op2": "",
        "op1type": "str",
        "op2type": "payl",
        "duration": "50",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 80,
        "y": 760,
        "wires": [
            [
                "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": 250,
        "y": 760,
        "wires": [
            [
                "f40fd0836cba2058",
                "fa7a2c62c4f39386"
            ]
        ]
    },
    {
        "id": "880489b6.8264e8",
        "type": "ui_button",
        "z": "58e87bcc.806654",
        "name": "",
        "group": "212c669d.fce9ba",
        "order": 4,
        "width": "6",
        "height": "1",
        "passthru": false,
        "label": "Submit",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "true",
        "payloadType": "bool",
        "topic": "",
        "x": 140,
        "y": 860,
        "wires": [
            [
                "e4190363.4d1d7"
            ]
        ]
    },
    {
        "id": "e4190363.4d1d7",
        "type": "function",
        "z": "58e87bcc.806654",
        "name": "",
        "func": "if(msg.payload){\n    return{\n        location : {\n            lat : flow.get(\"lat\"),\n            lon : flow.get(\"lon\")\n        }\n    }\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 300,
        "y": 860,
        "wires": [
            [
                "3e4f6f3df436778b",
                "51c93547576fdd44"
            ]
        ]
    },
    {
        "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": 410,
        "y": 760,
        "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": 700,
        "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",
                "ce1897ce20bb7c44"
            ]
        ]
    },
    {
        "id": "d67f1526.df33d8",
        "type": "openweathermap",
        "z": "58e87bcc.806654",
        "name": "",
        "wtype": "current",
        "lon": "",
        "lat": "",
        "city": "",
        "country": "",
        "language": "en",
        "x": 650,
        "y": 900,
        "wires": [
            [
                "49e145d4.08f73c",
                "11219d2e62e0dbf6",
                "b40b4212.24744",
                "9446411facaa23a2",
                "2a93c6c.1de5b3a",
                "f1e080e1.05dd7",
                "901e6ec.4740a9",
                "805abd3a.ac498",
                "dd02eca8.d6e4f",
                "185166fe.2e4809",
                "b9e23bd0.ea7e08",
                "8625b310c621b660",
                "2e167ba0884b26be"
            ]
        ]
    },
    {
        "id": "b40b4212.24744",
        "type": "ui_gauge",
        "z": "58e87bcc.806654",
        "name": "Humidity",
        "group": "dc265c9b.5850a",
        "order": 4,
        "width": "6",
        "height": "4",
        "gtype": "gage",
        "title": "",
        "label": "%",
        "format": "{{msg.payload.humidity}}",
        "min": "0",
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 960,
        "y": 580,
        "wires": []
    },
    {
        "id": "4f271a00.762388",
        "type": "ui_group",
        "name": "Input city/country",
        "tab": "152c952d.14cc0b",
        "order": 1,
        "disp": true,
        "width": "5",
        "collapse": false
    },
    {
        "id": "212c669d.fce9ba",
        "type": "ui_group",
        "name": "Input latitude/longitude",
        "tab": "152c952d.14cc0b",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "ecd479fa.1d4d48",
        "type": "ui_group",
        "name": "Input method",
        "tab": "674b6dad.b573d4",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "dc265c9b.5850a",
        "type": "ui_group",
        "name": "Humidity",
        "tab": "152c952d.14cc0b",
        "order": 8,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "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
    }
]

You also need to add something to catch errors and stop requests, a stop start would also be good.
Here is how I might go about it using dashboard forms and passing all info along message, no need to use context.
Hope it helps

[{"id":"a1ce284a.220ec8","type":"ui_switch","z":"9790f611.6dd06","name":"","label":"start stop","tooltip":"","group":"748c0cee.27bb74","order":2,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"start","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"stop","offvalueType":"str","officon":"","offcolor":"","animate":false,"className":"","x":450,"y":300,"wires":[["879c7dc9.808d28","2fd1e1db.de7f26"]]},{"id":"879c7dc9.808d28","type":"join","z":"9790f611.6dd06","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":710,"y":380,"wires":[["518b6c7b.f5608c"]]},{"id":"2fd1e1db.de7f26","type":"switch","z":"9790f611.6dd06","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"stop","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":300,"wires":[["4eff2794.f2c578"]]},{"id":"363d8bb8.3b20c4","type":"ui_form","z":"9790f611.6dd06","name":"","label":"","group":"eb8b804b.3534f","order":1,"width":0,"height":0,"options":[{"label":"Latitude","value":"lat","type":"text","required":true,"rows":null},{"label":"Longitude","value":"lon","type":"text","required":true,"rows":null}],"formValue":{"lat":"","lon":""},"payload":"","submit":"submit","cancel":"","topic":"form","topicType":"str","splitLayout":"","className":"","x":490,"y":480,"wires":[["9bc1d6c.cd78c28","879c7dc9.808d28"]]},{"id":"ccb25832.2ecc18","type":"ui_form","z":"9790f611.6dd06","name":"","label":"","group":"a34d6a2f.4b521","order":1,"width":"0","height":"0","options":[{"label":"Country ","value":"country","type":"text","required":true,"rows":null},{"label":"City","value":"city","type":"text","required":true,"rows":null}],"formValue":{"country":"","city":""},"payload":"","submit":"submit","cancel":"","topic":"form","topicType":"str","splitLayout":"","className":"","x":490,"y":420,"wires":[["c397efbd.846c","879c7dc9.808d28"]]},{"id":"8acd5fd5.142c18","type":"ui_numeric","z":"9790f611.6dd06","name":"","label":"input query interval","tooltip":"","group":"748c0cee.27bb74","order":11,"width":0,"height":0,"wrap":false,"passthru":false,"topic":"interval","topicType":"str","format":"{{value}}","min":"5","max":"50","step":"5","className":"","x":490,"y":360,"wires":[["879c7dc9.808d28"]]},{"id":"518b6c7b.f5608c","type":"function","z":"9790f611.6dd06","name":"","func":"if(msg.payload && msg.payload.start != \"stop\"){\n    msg.delay = msg.payload.interval*1000;\n    delete msg.payload.interval;\n    delete msg.payload.start;\n    msg.location = msg.payload.form;\n    return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":380,"wires":[["5f621af5.703cac","84ba28f1.2c0cf8"]]},{"id":"4eff2794.f2c578","type":"trigger","z":"9790f611.6dd06","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":1160,"y":380,"wires":[["97b1961c.b1be28"]]},{"id":"9bc1d6c.cd78c28","type":"change","z":"9790f611.6dd06","name":"","rules":[],"action":"","property":"","from":"","to":"","reg":false,"x":395,"y":480,"wires":[["363d8bb8.3b20c4"]],"l":false},{"id":"c397efbd.846c","type":"change","z":"9790f611.6dd06","name":"","rules":[],"action":"","property":"","from":"","to":"","reg":false,"x":395,"y":420,"wires":[["ccb25832.2ecc18"]],"l":false},{"id":"5f621af5.703cac","type":"trigger","z":"9790f611.6dd06","name":"Trigger","op1":"stop","op2":"","op1type":"str","op2type":"payl","duration":"250","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1000,"y":380,"wires":[["4eff2794.f2c578"]]},{"id":"84ba28f1.2c0cf8","type":"debug","z":"9790f611.6dd06","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1050,"y":300,"wires":[]},{"id":"97b1961c.b1be28","type":"switch","z":"9790f611.6dd06","name":"","property":"location","propertyType":"msg","rules":[{"t":"hask","v":"city","vt":"str"},{"t":"hask","v":"lat","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1320,"y":380,"wires":[["5a8435b1.68e2bc"],["d713d2a5.a8ac8"]]},{"id":"5a8435b1.68e2bc","type":"openweathermap","z":"9790f611.6dd06","name":"","wtype":"current","lon":"","lat":"","city":"","country":"","language":"en","x":1500,"y":360,"wires":[["5591f239.35b8cc","b1a005b3.8088f8"]]},{"id":"d713d2a5.a8ac8","type":"openweathermap","z":"9790f611.6dd06","name":"","wtype":"current","lon":"","lat":"","city":"","country":"","language":"en","x":1500,"y":400,"wires":[["5591f239.35b8cc","b1a005b3.8088f8"]]},{"id":"436cc2e2.5dcad4","type":"ui_toast","z":"9790f611.6dd06","position":"top right","displayTime":"5","highlight":"","sendall":false,"outputs":0,"ok":"OK","cancel":"","raw":true,"className":"","topic":"","name":"","x":1440,"y":480,"wires":[]},{"id":"5591f239.35b8cc","type":"ui_gauge","z":"9790f611.6dd06","name":"Humidity","group":"9c76ddcf.3f6d","order":1,"width":6,"height":4,"gtype":"gage","title":"Humidity - {{location.city}}: {{msg.location.country}}","label":"","format":"{{msg.payload.humidity}} %","min":"0","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":1710,"y":380,"wires":[]},{"id":"b1a005b3.8088f8","type":"debug","z":"9790f611.6dd06","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1490,"y":300,"wires":[]},{"id":"2a4c7610.37082a","type":"template","z":"9790f611.6dd06","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<p>{{error.message}}</p>\n<p>{{location}}</p>","output":"str","x":1230,"y":480,"wires":[["436cc2e2.5dcad4"]]},{"id":"b5489a04.3d9d28","type":"change","z":"9790f611.6dd06","name":"","rules":[{"t":"set","p":"location","pt":"msg","to":"$string($$.location)","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":480,"wires":[["2a4c7610.37082a","4eff2794.f2c578"]]},{"id":"dac365b7.f78b6","type":"catch","z":"9790f611.6dd06","name":"","scope":["5a8435b1.68e2bc","d713d2a5.a8ac8"],"uncaught":false,"x":840,"y":480,"wires":[["b5489a04.3d9d28"]]},{"id":"248b4488.a7259c","type":"ui_ui_control","z":"9790f611.6dd06","name":"","events":"all","x":870,"y":240,"wires":[[]]},{"id":"6a737491.e11834","type":"function","z":"9790f611.6dd06","name":"","func":"flow.set(\"val\", msg.payload);\nif(msg.payload == 0){\n    msg.payload = {\"group\":{\"hide\":[\"Weather_Input_latitude/longitude\"],\"show\":[\"Weather_Input_city/country\"]}};\n}else{\n    msg.payload = {\"group\":{\"hide\":[\"Weather_Input_city/country\"],\"show\":[\"Weather_Input_latitude/longitude\"]}};\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":240,"wires":[["248b4488.a7259c"]]},{"id":"3334ea5b.d21276","type":"ui_dropdown","z":"9790f611.6dd06","name":"","label":"","tooltip":"","place":"Select Method","group":"748c0cee.27bb74","order":1,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"Input City/Country","value":0,"type":"num"},{"label":"Input Coordinates","value":1,"type":"num"}],"payload":"","topic":"","topicType":"str","className":"","x":430,"y":240,"wires":[["6a737491.e11834"]]},{"id":"a384fd53.69b18","type":"inject","z":"9790f611.6dd06","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"{\"group\":{\"hide\":[\"Weather_Input_latitude/longitude\",\"Weather_Input_city/country\"]}}","payloadType":"json","x":440,"y":180,"wires":[["248b4488.a7259c"]]},{"id":"748c0cee.27bb74","type":"ui_group","name":"humidity","tab":"a45a7683.7a8d28","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"eb8b804b.3534f","type":"ui_group","name":"Input latitude/longitude","tab":"183f7c9e.7b1b5b","order":3,"disp":false,"width":"6","collapse":false,"className":""},{"id":"a34d6a2f.4b521","type":"ui_group","name":"Input city/country","tab":"183f7c9e.7b1b5b","order":2,"disp":false,"width":"6","collapse":false,"className":""},{"id":"9c76ddcf.3f6d","type":"ui_group","name":"Humidity","tab":"183f7c9e.7b1b5b","order":4,"disp":false,"width":"6","collapse":false,"className":""},{"id":"a45a7683.7a8d28","type":"ui_tab","name":"Settings","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"183f7c9e.7b1b5b","type":"ui_tab","name":"Weather","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Hey, I've had the same problem as you and came to the following code, which is doing well:

let i = context.get('rainbow') || undefined
//let intervall = msg.payload.intervall;
context.set('intervall', msg.payload.intervall);

if (i === undefined && msg.payload.start === 'start') {
    node.warn('starting');
    global.working = true;
    i = setInterval(function(){
        node.send(msg);
        node.done();
    }, context.get('intervall'));

    context.set('rainbow', i);
}

if (i && msg.payload.stop === 'stop') {
    node.warn('stopping');
    clearInterval(i);
    context.set('rainbow', undefined);
}

In this example you will need something like a button which is giving the function-node a payload start or stop and of course you have to overwrite the context variable 'intervall'