What's wrong in my flow

Im verry new in node red . I can't figure out where I'm wrong in this simple flow.
sorry for my bad english.

[
{
"id": "db1e7864.8ec9b8",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "af60a6e2.a4a4f8",
"type": "inject",
"z": "db1e7864.8ec9b8",
"name": "temperature",
"topic": "temperature",
"payload": "10",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 170,
"y": 100,
"wires": [
[
"5bc15e67.e87bb"
]
]
},
{
"id": "5bc15e67.e87bb",
"type": "join",
"z": "db1e7864.8ec9b8",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "3",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 370,
"y": 140,
"wires": [
[
"396d059c.5fa1aa",
"2b79041b.1cdbdc"
]
]
},
{
"id": "396d059c.5fa1aa",
"type": "debug",
"z": "db1e7864.8ec9b8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 530,
"y": 140,
"wires":
},
{
"id": "166cbaea.6b33d5",
"type": "inject",
"z": "db1e7864.8ec9b8",
"name": "humidity",
"topic": "humidity",
"payload": "50",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 160,
"y": 140,
"wires": [
[
"5bc15e67.e87bb"
]
]
},
{
"id": "9a08556a.79f2d8",
"type": "inject",
"z": "db1e7864.8ec9b8",
"name": "pressure",
"topic": "pressure",
"payload": "999",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 160,
"y": 180,
"wires": [
[
"5bc15e67.e87bb"
]
]
},
{
"id": "2b79041b.1cdbdc",
"type": "function",
"z": "db1e7864.8ec9b8",
"name": "",
"func": " if (msg.payload.temperature == 10) && (msg.payload.humidity == 50) {\nmsg.payload = 1;\nreturn msg;\n} \nelse {\nmsg.payload = 0;\nreturn msg;\n}\n\n ",
"outputs": 1,
"noerr": 14,
"x": 550,
"y": 60,
"wires": [
[
"fe139b61.8e5248"
]
]
},
{
"id": "fe139b61.8e5248",
"type": "debug",
"z": "db1e7864.8ec9b8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 740,
"y": 80,
"wires":
}
]

Hi. Firstly, you should always wrap code in three backticks...

```
code here
```
However I did notice this...

Should be....

if (msg.payload.temperature == 10 && msg.payload.humidity == 50)

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