Help with function - yes an another noob -

I am trying to set a function to compare the value of a DHT11 sensor (temperature) with a set point and if the ui-switch is off do nothing. If the temperature is bellow the setpoint and the ui switch is on then send msg 1 (so I can activate a raspberry pi pin for a relay)... I am missing something in the compare function (named Control in my flow) and can't find a way to make it work... Any leads?

[
    {
        "id": "3614990b.4930c6",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": ""
    },
    {
        "id": "25fafac5.d0a986",
        "type": "ui_switch",
        "z": "3614990b.4930c6",
        "name": "",
        "label": "Heater Control",
        "tooltip": "",
        "group": "259009fe.9666b6",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "decouple": "false",
        "topic": "button",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "x": 100,
        "y": 580,
        "wires": [
            [
                "fabd31c3.f7abc"
            ]
        ]
    },
    {
        "id": "4efab544.94c5fc",
        "type": "rpi-dht22",
        "z": "3614990b.4930c6",
        "name": "DHT11",
        "topic": "DHT11",
        "dht": "11",
        "pintype": "0",
        "pin": 4,
        "x": 100,
        "y": 360,
        "wires": [
            [
                "cd903855.3ef318",
                "b185c1b2.99c36",
                "bf727051.9ac9c",
                "891978a3.b7ab88"
            ]
        ]
    },
    {
        "id": "265ae43d.c848dc",
        "type": "inject",
        "z": "3614990b.4930c6",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "x": 110,
        "y": 260,
        "wires": [
            [
                "4efab544.94c5fc"
            ]
        ]
    },
    {
        "id": "b185c1b2.99c36",
        "type": "function",
        "z": "3614990b.4930c6",
        "name": "Temperature",
        "func": "msg.payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 370,
        "y": 360,
        "wires": [
            [
                "f07772dc.1210e",
                "11c7c637.48ac1a",
                "cee1ffdc.538a1"
            ]
        ]
    },
    {
        "id": "bf727051.9ac9c",
        "type": "function",
        "z": "3614990b.4930c6",
        "name": "Humidity",
        "func": "msg.humidity\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 360,
        "y": 420,
        "wires": [
            [
                "1a949713.aa3b29",
                "d5a5c.e626e5a4",
                "17c662cb.10668d"
            ]
        ]
    },
    {
        "id": "cd903855.3ef318",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 390,
        "y": 300,
        "wires": []
    },
    {
        "id": "cee1ffdc.538a1",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "Temperature Value",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 650,
        "y": 300,
        "wires": []
    },
    {
        "id": "1a949713.aa3b29",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "humidity",
        "targetType": "msg",
        "x": 620,
        "y": 420,
        "wires": []
    },
    {
        "id": "f07772dc.1210e",
        "type": "ui_gauge",
        "z": "3614990b.4930c6",
        "name": "Temperature",
        "group": "259009fe.9666b6",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Temperature",
        "label": "C",
        "format": "{{value}}",
        "min": "-10",
        "max": "50",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 630,
        "y": 340,
        "wires": []
    },
    {
        "id": "d5a5c.e626e5a4",
        "type": "ui_gauge",
        "z": "3614990b.4930c6",
        "name": "Humidity",
        "group": "259009fe.9666b6",
        "order": 3,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Humidity",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 600,
        "y": 460,
        "wires": []
    },
    {
        "id": "11c7c637.48ac1a",
        "type": "ui_chart",
        "z": "3614990b.4930c6",
        "name": "Temperature",
        "group": "bed357cb.350a38",
        "order": 6,
        "width": 0,
        "height": 0,
        "label": "Temperature chart",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "-20",
        "ymax": "50",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 630,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "17c662cb.10668d",
        "type": "ui_chart",
        "z": "3614990b.4930c6",
        "name": "Humidity",
        "group": "bed357cb.350a38",
        "order": 7,
        "width": 0,
        "height": 0,
        "label": "Humiditychart",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "0",
        "ymax": "100",
        "removeOlder": "5",
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 600,
        "y": 500,
        "wires": [
            []
        ]
    },
    {
        "id": "3307cc3d.4b2854",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "Heater ON",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 650,
        "y": 580,
        "wires": []
    },
    {
        "id": "4d60f6c8.498338",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "radio",
        "targetType": "msg",
        "x": 320,
        "y": 640,
        "wires": []
    },
    {
        "id": "606640bd.62404",
        "type": "function",
        "z": "3614990b.4930c6",
        "name": "Control",
        "func": "if(msg.temperature <= 20) {\n    if(msg.radio === true) {\n        msg.payload = 1;\n        return msg;\n    }\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 500,
        "y": 580,
        "wires": [
            [
                "3307cc3d.4b2854"
            ]
        ]
    },
    {
        "id": "891978a3.b7ab88",
        "type": "change",
        "z": "3614990b.4930c6",
        "name": "payload_to_temperature",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "temperature",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 170,
        "y": 500,
        "wires": [
            [
                "606640bd.62404"
            ]
        ]
    },
    {
        "id": "fabd31c3.f7abc",
        "type": "change",
        "z": "3614990b.4930c6",
        "name": "payload_to_radio",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "radio",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 310,
        "y": 580,
        "wires": [
            [
                "606640bd.62404",
                "4d60f6c8.498338"
            ]
        ]
    },
    {
        "id": "259009fe.9666b6",
        "type": "ui_group",
        "z": "",
        "name": "Home",
        "tab": "de03cc52.a371c",
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "bed357cb.350a38",
        "type": "ui_group",
        "z": "",
        "name": "Home",
        "tab": "3e12347.8eb56cc",
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "de03cc52.a371c",
        "type": "ui_tab",
        "z": "",
        "name": "Home",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "3e12347.8eb56cc",
        "type": "ui_tab",
        "z": "",
        "name": "History",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]```

I found a solution to my problem using AND gate and rbe with a trigger to transmit the signal and then reset after a preset time. I think this is not the most elegant solution but it works... Any suggestions on this?

here is the alternative to the above code

[
    {
        "id": "3614990b.4930c6",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": ""
    },
    {
        "id": "25fafac5.d0a986",
        "type": "ui_switch",
        "z": "3614990b.4930c6",
        "name": "",
        "label": "Heater Control",
        "tooltip": "",
        "group": "259009fe.9666b6",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "button",
        "style": "",
        "onvalue": "1",
        "onvalueType": "num",
        "onicon": "",
        "oncolor": "",
        "offvalue": "0",
        "offvalueType": "num",
        "officon": "",
        "offcolor": "",
        "x": 100,
        "y": 580,
        "wires": [
            [
                "fabd31c3.f7abc"
            ]
        ]
    },
    {
        "id": "4efab544.94c5fc",
        "type": "rpi-dht22",
        "z": "3614990b.4930c6",
        "name": "DHT11",
        "topic": "DHT11",
        "dht": "11",
        "pintype": "0",
        "pin": 4,
        "x": 100,
        "y": 360,
        "wires": [
            [
                "cd903855.3ef318",
                "b185c1b2.99c36",
                "bf727051.9ac9c",
                "891978a3.b7ab88"
            ]
        ]
    },
    {
        "id": "265ae43d.c848dc",
        "type": "inject",
        "z": "3614990b.4930c6",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "x": 110,
        "y": 260,
        "wires": [
            [
                "4efab544.94c5fc"
            ]
        ]
    },
    {
        "id": "b185c1b2.99c36",
        "type": "function",
        "z": "3614990b.4930c6",
        "name": "Temperature",
        "func": "msg.payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 370,
        "y": 360,
        "wires": [
            [
                "f07772dc.1210e",
                "11c7c637.48ac1a",
                "cee1ffdc.538a1"
            ]
        ]
    },
    {
        "id": "bf727051.9ac9c",
        "type": "function",
        "z": "3614990b.4930c6",
        "name": "Humidity",
        "func": "msg.humidity\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 360,
        "y": 420,
        "wires": [
            [
                "1a949713.aa3b29",
                "d5a5c.e626e5a4",
                "17c662cb.10668d"
            ]
        ]
    },
    {
        "id": "cd903855.3ef318",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 390,
        "y": 300,
        "wires": []
    },
    {
        "id": "cee1ffdc.538a1",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "Temperature Value",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 650,
        "y": 300,
        "wires": []
    },
    {
        "id": "1a949713.aa3b29",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "humidity",
        "targetType": "msg",
        "x": 620,
        "y": 420,
        "wires": []
    },
    {
        "id": "f07772dc.1210e",
        "type": "ui_gauge",
        "z": "3614990b.4930c6",
        "name": "Temperature",
        "group": "259009fe.9666b6",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Temperature",
        "label": "C",
        "format": "{{value}}",
        "min": "-10",
        "max": "50",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 630,
        "y": 340,
        "wires": []
    },
    {
        "id": "d5a5c.e626e5a4",
        "type": "ui_gauge",
        "z": "3614990b.4930c6",
        "name": "Humidity",
        "group": "259009fe.9666b6",
        "order": 3,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Humidity",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 600,
        "y": 460,
        "wires": []
    },
    {
        "id": "11c7c637.48ac1a",
        "type": "ui_chart",
        "z": "3614990b.4930c6",
        "name": "Temperature",
        "group": "bed357cb.350a38",
        "order": 6,
        "width": 0,
        "height": 0,
        "label": "Temperature chart",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "-20",
        "ymax": "50",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 630,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "17c662cb.10668d",
        "type": "ui_chart",
        "z": "3614990b.4930c6",
        "name": "Humidity",
        "group": "bed357cb.350a38",
        "order": 7,
        "width": 0,
        "height": 0,
        "label": "Humiditychart",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "0",
        "ymax": "100",
        "removeOlder": "5",
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 600,
        "y": 500,
        "wires": [
            []
        ]
    },
    {
        "id": "3307cc3d.4b2854",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "Heater ON",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 810,
        "y": 680,
        "wires": []
    },
    {
        "id": "4d60f6c8.498338",
        "type": "debug",
        "z": "3614990b.4930c6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "radio",
        "targetType": "msg",
        "x": 480,
        "y": 640,
        "wires": []
    },
    {
        "id": "891978a3.b7ab88",
        "type": "change",
        "z": "3614990b.4930c6",
        "name": "payload_to_temperature",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "temperature",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 170,
        "y": 500,
        "wires": [
            [
                "458d8b25.fc9494"
            ]
        ]
    },
    {
        "id": "e767268.a8a08d8",
        "type": "inject",
        "z": "3614990b.4930c6",
        "name": "STOP",
        "topic": "button",
        "payload": "0",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "x": 70,
        "y": 680,
        "wires": [
            [
                "25fafac5.d0a986"
            ]
        ]
    },
    {
        "id": "e01197c3.5f8468",
        "type": "inject",
        "z": "3614990b.4930c6",
        "name": "START",
        "topic": "button",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 110,
        "y": 740,
        "wires": [
            [
                "25fafac5.d0a986"
            ]
        ]
    },
    {
        "id": "a48eb601.fc18e8",
        "type": "rbe",
        "z": "3614990b.4930c6",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "property": "payload",
        "x": 690,
        "y": 580,
        "wires": [
            [
                "3307cc3d.4b2854",
                "a97d908e.e86ef"
            ]
        ]
    },
    {
        "id": "fabd31c3.f7abc",
        "type": "change",
        "z": "3614990b.4930c6",
        "name": "payload_to_radio",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "radio",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 330,
        "y": 580,
        "wires": [
            [
                "4d60f6c8.498338",
                "458d8b25.fc9494"
            ]
        ]
    },
    {
        "id": "458d8b25.fc9494",
        "type": "and-gate",
        "z": "3614990b.4930c6",
        "name": "",
        "rules": [
            {
                "t": "lte",
                "v": "20",
                "vt": "num",
                "propertyType": "msg",
                "property": "temperature",
                "topic": "DHT11"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num",
                "propertyType": "msg",
                "property": "radio",
                "topic": "button"
            }
        ],
        "outputTopic": "",
        "gateType": "and",
        "emitOnlyIfTrue": false,
        "x": 540,
        "y": 580,
        "wires": [
            [
                "a48eb601.fc18e8"
            ]
        ]
    },
    {
        "id": "a97d908e.e86ef",
        "type": "trigger",
        "z": "3614990b.4930c6",
        "op1": "",
        "op2": "0",
        "op1type": "nul",
        "op2type": "num",
        "duration": "10",
        "extend": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "name": "",
        "x": 850,
        "y": 580,
        "wires": [
            [
                "25fafac5.d0a986"
            ]
        ]
    },
    {
        "id": "259009fe.9666b6",
        "type": "ui_group",
        "z": "",
        "name": "Home",
        "tab": "de03cc52.a371c",
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "bed357cb.350a38",
        "type": "ui_group",
        "z": "",
        "name": "Home",
        "tab": "3e12347.8eb56cc",
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "de03cc52.a371c",
        "type": "ui_tab",
        "z": "",
        "name": "Home",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "3e12347.8eb56cc",
        "type": "ui_tab",
        "z": "",
        "name": "History",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

People might be more likely to try and help if you posted just enough flow to understand the problem. Preferably for something like this just the function node and any necessary support nodes, with Inject node(s) as required to show the expected inputs, along with a description of what output is required.

I added a screen shot of my flow, is this any helpful?
Thank you for bothering to guide me through!