# Hello everyone pls some help

**URL:** <https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265>\
**Category:** General\
**Created:** [24 March 2022 01:01 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265 "2022-03-24T01:01:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 01:01 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/1 "2022-03-24T01:01:06Z")

</div>

Hello everyone 😌 pls could anyone help me cause I'm really stuck I have an esp8266 paired with dht11 it measured temperature in the room and send to a raspberry pi 3 through the mqtt broker my main problem is I want to creat a fonction in node red to on or off the air conditioner through a topic for example if it \>= 30 it gonna send on in the topic.  
I tried alot but cause I luck experience I didn't made it 🥲

---

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [24 March 2022 02:06 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/2 "2022-03-24T02:06:35Z")

</div>

The items needed to assist you is perhaps the content of the message to your function, then an understanding of what your function should do to provide the proper output(s).

If you do not have programming experience, It is possible that you can use an existing node(s) to do the logic, and therefore you could avoid making a function at all.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 07:06 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/3 "2022-03-24T07:06:47Z")

</div>

Hi Sheen - welcome to the forum.

What you are trying to do, should be fairly straightforward using Node-RED.  
It sounds as if you have some parts working (e.g. capture temperature and sending it to Node-RED via MQTT). Is it possible for you to post your flow and to explain how the AC is controlled?

You might want to read how to share code on the forum.

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 08:50 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/4 "2022-03-24T08:50:46Z")

</div>

```auto
[
    {
        "id": "c190fea3f98b97dc",
        "type": "mqtt in",
        "z": "a0d54b312f5d36d2",
        "name": "Temperature",
        "topic": "Room/temperature",
        "qos": "2",
        "datatype": "auto",
        "broker": "5f6fbb28779bee8b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 210,
        "y": 400,
        "wires": [
            [
                "def95c09b376f824",
                "0e34ae5eadcf7d15",
                "08ce2264729fdabf"
            ]
        ]
    },
    {
        "id": "eec6b8bb687b16e0",
        "type": "mqtt in",
        "z": "a0d54b312f5d36d2",
        "name": "Humidity",
        "topic": "Room/humidity1",
        "qos": "2",
        "datatype": "auto",
        "broker": "5f6fbb28779bee8b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 200,
        "y": 460,
        "wires": [
            [
                "9b3d02c87cdc90d0"
            ]
        ]
    },
    {
        "id": "def95c09b376f824",
        "type": "ui_gauge",
        "z": "a0d54b312f5d36d2",
        "name": "temperature",
        "group": "3c09afbebee86489",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "gauge",
        "label": "°C",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "26",
        "seg2": "36",
        "x": 550,
        "y": 540,
        "wires": []
    },
    {
        "id": "9b3d02c87cdc90d0",
        "type": "ui_gauge",
        "z": "a0d54b312f5d36d2",
        "name": "Humidity",
        "group": "8008752501712c7a",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "gauge",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "60",
        "seg2": "80",
        "x": 540,
        "y": 600,
        "wires": []
    },
    {
        "id": "21e9afc73aa2757e",
        "type": "mqtt out",
        "z": "a0d54b312f5d36d2",
        "name": "lamp",
        "topic": "Room/lamp",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "5f6fbb28779bee8b",
        "x": 1130,
        "y": 280,
        "wires": []
    },
    {
        "id": "08ce2264729fdabf",
        "type": "switch",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "property": "Room/temperature",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "17",
                "vt": "num"
            },
            {
                "t": "neq",
                "v": "17",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 570,
        "y": 420,
        "wires": [
            [
                "a68ef52a3dd22e48"
            ],
            [
                "6daf8ab1263077d2"
            ]
        ]
    },
    {
        "id": "a68ef52a3dd22e48",
        "type": "trigger",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "op1": "on",
        "op2": "",
        "op1type": "str",
        "op2type": "str",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 880,
        "y": 360,
        "wires": [
            [
                "21e9afc73aa2757e"
            ]
        ]
    },
    {
        "id": "6daf8ab1263077d2",
        "type": "trigger",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "op1": "off",
        "op2": "0",
        "op1type": "str",
        "op2type": "str",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 880,
        "y": 400,
        "wires": [
            [
                "21e9afc73aa2757e"
            ]
        ]
    },
    {
        "id": "f0da0c7c4c3dafa7",
        "type": "debug",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1310,
        "y": 460,
        "wires": []
    },
    {
        "id": "0e34ae5eadcf7d15",
        "type": "function",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "func": "if (msg.payload >= 17){\n msg.payload = \"on\";\n}\nelse if (msg.payload <= 10){\n msg.payload = \"off\";\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 240,
        "wires": [
            [
                "21e9afc73aa2757e",
                "f0da0c7c4c3dafa7"
            ]
        ]
    },
    {
        "id": "5f6fbb28779bee8b",
        "type": "mqtt-broker",
        "name": "",
        "broker": "test.mosquitto.org",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "3c09afbebee86489",
        "type": "ui_group",
        "name": "temperature",
        "tab": "eb133ec6a220a53e",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "8008752501712c7a",
        "type": "ui_group",
        "name": "Humidity",
        "tab": "eb133ec6a220a53e",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "eb133ec6a220a53e",
        "type": "ui_tab",
        "name": "demo",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 08:53 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/5 "2022-03-24T08:53:57Z")

</div>

Thanks for ur attention I want from the nodered to take the data from mqtt protocol and with a fonction node ( for example if the temperature above 25 it should to turn on ) I tried alot of solutions but it didn't work for me cause I'm not that good in programming

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 09:02 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/6 "2022-03-24T09:02:30Z")

</div>

I suggest you place a Debug node on the output of the MQTT-In node and post the results so we can see what the message payload looks like.  
 ![Screen Shot 03-24-22 at 09.01 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/2/623a20ebcfec1302cd7fe0eb2a6d21b8128f52dc.png)

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 10:10 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/7 "2022-03-24T10:10:02Z")

</div>

When I inject 60 the msg.payload show us on as I do in the fonction but when it came to work automatic I replace the relay with an led so I can try it without using a relay when I injected with a number it work fine but when it get the data from the sensor it just blinking

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 11:32 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/8 "2022-03-24T11:32:14Z")

</div>

You need to find out what the incoming payload looks like as I suspect it could be something like...  
msg.payload.temperature or msg.payload.humidity (rather than just msg.payload).  
How have you programmed the ESP8266?  
What language have you used?  
Have you got control over how the MQTT message is formatted?

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 11:39 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/9 "2022-03-24T11:39:06Z")

</div>

Looking at your flow, you have two paths that seem to be doing the same thing (that might be the reason the LED is blinking).  
I suggest you disconnect the wire to the Switch node and see if the LED stops blinking.  
Don't forget to Deploy the flow after you make any changes.

 ![Screen Shot 03-24-22 at 11.36 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/96ce07e66be60fead5d162b6370f175dfc550925.png)

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 12:25 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/10 "2022-03-24T12:25:03Z")

</div>

```auto
[
    {
        "id": "638956695a36d835",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "e32f7a47c54dbbc8",
        "type": "mqtt out",
        "z": "638956695a36d835",
        "name": "lamp",
        "topic": "Room/lamp",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "5f6fbb28779bee8b",
        "x": 1170,
        "y": 380,
        "wires": []
    },
    {
        "id": "eeb6600077f84f9c",
        "type": "debug",
        "z": "638956695a36d835",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1110,
        "y": 240,
        "wires": []
    },
    {
        "id": "a2dc4c11eb76e946",
        "type": "trigger",
        "z": "638956695a36d835",
        "name": "",
        "op1": "on",
        "op2": "",
        "op1type": "str",
        "op2type": "nul",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 580,
        "y": 440,
        "wires": [
            [
                "765bf762495a0e80",
                "cae701e15d303d62"
            ]
        ]
    },
    {
        "id": "69dde581d1d21036",
        "type": "switch",
        "z": "638956695a36d835",
        "name": "",
        "property": "Room/lamp",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lt",
                "v": "15",
                "vt": "num"
            },
            {
                "t": "gt",
                "v": "15",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 370,
        "y": 360,
        "wires": [
            [
                "a2dc4c11eb76e946"
            ],
            [
                "c20b07cdae459a50"
            ]
        ]
    },
    {
        "id": "c20b07cdae459a50",
        "type": "trigger",
        "z": "638956695a36d835",
        "name": "",
        "op1": "off",
        "op2": "",
        "op1type": "str",
        "op2type": "nul",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 580,
        "y": 520,
        "wires": [
            [
                "c9e829692ebe1f64",
                "a4e28bf2ddf091f8"
            ]
        ]
    },
    {
        "id": "765bf762495a0e80",
        "type": "debug",
        "z": "638956695a36d835",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 580,
        "wires": []
    },
    {
        "id": "c9e829692ebe1f64",
        "type": "debug",
        "z": "638956695a36d835",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1070,
        "y": 700,
        "wires": []
    },
    {
        "id": "cae701e15d303d62",
        "type": "function",
        "z": "638956695a36d835",
        "name": "",
        "func": "if (msg.topic===\"Room/lamp\"){\n msg.payload = \"on\";\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 800,
        "y": 440,
        "wires": [
            [
                "e32f7a47c54dbbc8",
                "765bf762495a0e80"
            ]
        ]
    },
    {
        "id": "a4e28bf2ddf091f8",
        "type": "function",
        "z": "638956695a36d835",
        "name": "",
        "func": "if (msg.topic===\"Room/lamp\"){\n msg.payload = \"off\";\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 760,
        "y": 500,
        "wires": [
            [
                "e32f7a47c54dbbc8"
            ]
        ]
    },
    {
        "id": "6805627abf000c28",
        "type": "mqtt in",
        "z": "638956695a36d835",
        "name": "",
        "topic": "Room/temperature",
        "qos": "2",
        "datatype": "auto",
        "broker": "5f6fbb28779bee8b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 110,
        "y": 360,
        "wires": [
            [
                "69dde581d1d21036",
                "eeb6600077f84f9c"
            ]
        ]
    },
    {
        "id": "5f6fbb28779bee8b",
        "type": "mqtt-broker",
        "name": "",
        "broker": "test.mosquitto.org",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }

```

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 12:27 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/11 "2022-03-24T12:27:48Z")

</div>

I made this and it works fine when I manual inject it with a number less or equal 15 like I set in the switch node and the topic receive the on cause if it \<= 15 it gonna turn on  
But when I plugged the shema with the mqtt temperature it doesn't do it work no on or off

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 13:26 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/12 "2022-03-24T13:26:14Z")

</div>

The manual injection of a number should work as the logic in your flow looks fine.

You need to show us what the Debug node is showing (as I think that is where your problem is located).  
 ![Screen Shot 03-24-22 at 01.20 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40686a722392422e1d40ee23da5323578001adf5.png)  
 ![Screen Shot 03-24-22 at 01.20 PM 001](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e75f257f7593b868fbd6bcd976589f605aa5ce13.png)  
Once we know what the message payload looks like we can modify your Switch node.

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 13:44 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/13 "2022-03-24T13:44:08Z")

</div>

![Screenshot_20220324-144324](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/3/536bc89b9121e44dcb1a28b149b8ed2b99df9b11.jpeg)

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 13:44 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/14 "2022-03-24T13:44:21Z")

</div>

OK - I can see your msg.payload is a string.  
 ![Screen Shot 03-24-22 at 01.46 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/2/92c184fbf987e2a19eb382821db1c7f9d56fa14f.png)  
e.g. " 20.64"  
You need to convert that to an integer with parseInt() in a function node (so your Switch node will then work correctly).

 ![Screen Shot 03-24-22 at 01.43 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/606a466be51ad3a28ed4ba91ad428f7899f91961.png)  
 ![Screen Shot 03-24-22 at 01.43 PM 001](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae5b094e4b4aaecb19096ebcb719b22e7ce1f546.png)

You also need to adjust the Property in your Switch node to `msg.payload` (as below).  
 ![Screen Shot 03-24-22 at 01.51 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/da94d566afd419a030eb6bdbc3cfb539f253b71c.png)

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 13:52 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/15 "2022-03-24T13:52:11Z")

</div>

```auto
[
    {
        "id": "c190fea3f98b97dc",
        "type": "mqtt in",
        "z": "a0d54b312f5d36d2",
        "name": "Temperature",
        "topic": "Room/temperature",
        "qos": "2",
        "datatype": "auto",
        "broker": "5f6fbb28779bee8b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 170,
        "y": 460,
        "wires": [
            [
                "def95c09b376f824"
            ]
        ]
    },
    {
        "id": "eec6b8bb687b16e0",
        "type": "mqtt in",
        "z": "a0d54b312f5d36d2",
        "name": "Humidity",
        "topic": "Room/humidity1",
        "qos": "2",
        "datatype": "auto",
        "broker": "5f6fbb28779bee8b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 160,
        "y": 540,
        "wires": [
            [
                "9b3d02c87cdc90d0"
            ]
        ]
    },
    {
        "id": "def95c09b376f824",
        "type": "ui_gauge",
        "z": "a0d54b312f5d36d2",
        "name": "temperature",
        "group": "3c09afbebee86489",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "gauge",
        "label": "°C",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "26",
        "seg2": "36",
        "x": 530,
        "y": 500,
        "wires": []
    },
    {
        "id": "9b3d02c87cdc90d0",
        "type": "ui_gauge",
        "z": "a0d54b312f5d36d2",
        "name": "Humidity",
        "group": "8008752501712c7a",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "gauge",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "60",
        "seg2": "80",
        "x": 520,
        "y": 560,
        "wires": []
    },
    {
        "id": "28126aa0241dcab6",
        "type": "mqtt out",
        "z": "a0d54b312f5d36d2",
        "name": "lamp",
        "topic": "Room/lamp",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "5f6fbb28779bee8b",
        "x": 1250,
        "y": 380,
        "wires": []
    },
    {
        "id": "9442f29319be7b7b",
        "type": "debug",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 480,
        "wires": []
    },
    {
        "id": "07fc59ed4fb76861",
        "type": "switch",
        "z": "a0d54b312f5d36d2",
        "name": ">=30",
        "property": "Room/lamp",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "30",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 590,
        "y": 360,
        "wires": [
            [
                "2f50a23caf374951"
            ]
        ]
    },
    {
        "id": "ab725b388ba81200",
        "type": "debug",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 280,
        "wires": []
    },
    {
        "id": "236baa36ce447bc9",
        "type": "mqtt in",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "topic": "Room/temperature",
        "qos": "2",
        "datatype": "auto",
        "broker": "5f6fbb28779bee8b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 190,
        "y": 380,
        "wires": [
            [
                "71a1fa9121f614ec",
                "a4c6e888c48e38d9",
                "84b9231282920bd7"
            ]
        ]
    },
    {
        "id": "2f50a23caf374951",
        "type": "trigger",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "op1": "on",
        "op2": "",
        "op1type": "str",
        "op2type": "nul",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 820,
        "y": 360,
        "wires": [
            [
                "28126aa0241dcab6",
                "ab725b388ba81200"
            ]
        ]
    },
    {
        "id": "3f1a1f81b2190d66",
        "type": "trigger",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "op1": "off",
        "op2": "",
        "op1type": "str",
        "op2type": "nul",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 820,
        "y": 400,
        "wires": [
            [
                "28126aa0241dcab6",
                "9442f29319be7b7b"
            ]
        ]
    },
    {
        "id": "78272e988e235602",
        "type": "switch",
        "z": "a0d54b312f5d36d2",
        "name": "<=25",
        "property": "Room/lamp",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "25",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 590,
        "y": 400,
        "wires": [
            [
                "3f1a1f81b2190d66"
            ]
        ]
    },
    {
        "id": "bc1c9d1284158e95",
        "type": "inject",
        "z": "a0d54b312f5d36d2",
        "name": "50",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "Room/lamp",
                "v": "50",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 150,
        "y": 200,
        "wires": [
            [
                "07fc59ed4fb76861"
            ]
        ]
    },
    {
        "id": "04fb816623e4b669",
        "type": "inject",
        "z": "a0d54b312f5d36d2",
        "name": "30",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "Room/lamp",
                "v": "20",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 150,
        "y": 260,
        "wires": [
            [
                "78272e988e235602"
            ]
        ]
    },
    {
        "id": "71a1fa9121f614ec",
        "type": "debug",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 470,
        "y": 180,
        "wires": []
    },
    {
        "id": "a4c6e888c48e38d9",
        "type": "function",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "func": "msg.payload = preseInt(msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 420,
        "y": 360,
        "wires": [
            [
                "07fc59ed4fb76861",
                "61ca1aba53b133be"
            ]
        ]
    },
    {
        "id": "84b9231282920bd7",
        "type": "function",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "func": "msg.payload = preseInt(msg.payload);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 420,
        "y": 400,
        "wires": [
            [
                "78272e988e235602"
            ]
        ]
    },
    {
        "id": "61ca1aba53b133be",
        "type": "debug",
        "z": "a0d54b312f5d36d2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 160,
        "wires": []
    },
    {
        "id": "5f6fbb28779bee8b",
        "type": "mqtt-broker",
        "name": "",
        "broker": "test.mosquitto.org",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "3c09afbebee86489",
        "type": "ui_group",
        "name": "temperature",
        "tab": "eb133ec6a220a53e",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "8008752501712c7a",
        "type": "ui_group",
        "name": "Humidity",
        "tab": "eb133ec6a220a53e",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "eb133ec6a220a53e",
        "type": "ui_tab",
        "name": "demo",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 13:53 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/16 "2022-03-24T13:53:19Z")

</div>

So basically when add the fonction mode gonna change it to number but nothing change

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 13:54 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/17 "2022-03-24T13:54:29Z")

</div>

You need to alter the Property in the Switch node so it checks msg.payload.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 13:56 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/18 "2022-03-24T13:56:09Z")

</div>

Your flow seems to be working on my computer.  
 ![Screen Shot 03-24-22 at 01.55 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9ec788cd91b6265074e70b9255e645c0068b07f9.png)

---

<div class="post-metadata">

**Author:** ![Sheeen](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Sheeen](https://discourse.nodered.org/u/Sheeen)\
**Post date:** [24 March 2022 13:56 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/19 "2022-03-24T13:56:22Z")

</div>

The switch property should I put the topic of the lamp or the mqtt temperature and I'm so sorry for destructing you

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 March 2022 14:00 UTC](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265/20 "2022-03-24T14:00:40Z")

</div>

`msg.payload` as that's where the temperature is being held.

![Screen Shot 03-24-22 at 01.51 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/da94d566afd419a030eb6bdbc3cfb539f253b71c.png)

[Next page](https://discourse.nodered.org/t/hello-everyone-pls-some-help/60265.md?page=2)
