How to change the LED color when the temperature goes up and the alarm goes off

Hello

I'm using sensors for NCD products If the temperature value of the sensor is higher than the set temperature value, the alarm will sound.
If the alarm goes off and the default color is green on the LED, if it goes above the set temperature, the alarm goes off together and I want to change the color to red on the LED.

Please help me

So is this a school project or are you and @Tomi (Auto Led alarm setting) working on the same project?

I'm working If this is resolved, the project will be over

Please export your flow and paste it to a reply so we can see what you are doing.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

[
    {
        "id": "9576c84fc05fba48",
        "type": "play audio",
        "z": "c7f311b561d11f73",
        "name": "",
        "voice": "0",
        "x": 1210,
        "y": 1140,
        "wires": []
    },
    {
        "id": "59d6f528028e9030",
        "type": "change",
        "z": "c7f311b561d11f73",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" battery warning\"\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 980,
        "y": 1060,
        "wires": [
            [
                "6ce686c110da4464",
                "9576c84fc05fba48"
            ]
        ]
    },
    {
        "id": "fcc79c5b85608fba",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Set temperature limits",
        "property": "payload_data.battery",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lt",
                "v": "0",
                "vt": "str"
            },
            {
                "t": "gt",
                "v": "2",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 720,
        "y": 980,
        "wires": [
            [
                "59d6f528028e9030"
            ],
            [
                "59d6f528028e9030"
            ]
        ]
    },
    {
        "id": "6ce686c110da4464",
        "type": "debug",
        "z": "c7f311b561d11f73",
        "name": "debug 47",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1220,
        "y": 1080,
        "wires": []
    },
    {
        "id": "c9776bc6f8e1e143",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Limit to Type 80",
        "property": "payload_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "80",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 480,
        "y": 960,
        "wires": [
            [
                "fcc79c5b85608fba"
            ]
        ]
    },
    {
        "id": "62e6cca397d10a0a",
        "type": "ncd-gateway-node",
        "z": "c7f311b561d11f73",
        "name": "",
        "connection": "e69d0ec8c02da9b1",
        "unknown_devices": false,
        "outputs": 1,
        "x": 170,
        "y": 600,
        "wires": [
            [
                "8786d56e7500f219",
                "c9776bc6f8e1e143",
                "b59f324404e127c6",
                "fa92b63bfa0505ed",
                "9ba3716add53a55e",
                "148a32035db48ed2"
            ]
        ]
    },
    {
        "id": "8786d56e7500f219",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Limit to Type 80",
        "property": "payload.sensor_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "80",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 480,
        "y": 720,
        "wires": [
            [
                "3e57dace527138b2",
                "7f9c386269e249e2",
                "a96407ea593cbe8a"
            ]
        ]
    },
    {
        "id": "b59f324404e127c6",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Limit to Type 80",
        "property": "payload.sensor_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "80",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 460,
        "y": 440,
        "wires": [
            [
                "620598867c3564f1"
            ]
        ]
    },
    {
        "id": "fa92b63bfa0505ed",
        "type": "debug",
        "z": "c7f311b561d11f73",
        "name": "debug 48",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 440,
        "y": 320,
        "wires": []
    },
    {
        "id": "9ba3716add53a55e",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Limit to Type 80",
        "property": "payload.sensor_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "80",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 100,
        "y": 160,
        "wires": [
            [
                "f1a8611ec698886c"
            ]
        ]
    },
    {
        "id": "148a32035db48ed2",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Limit to Type 80",
        "property": "payload.sensor_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "80",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 480,
        "y": 1080,
        "wires": [
            [
                "57d8bca623128d14"
            ]
        ]
    },
    {
        "id": "3e57dace527138b2",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Set temperature limits",
        "property": "payload.sensor_data.x_rms_ACC_G",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "-5",
                "vt": "str"
            },
            {
                "t": "gte",
                "v": "30",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 740,
        "y": 720,
        "wires": [
            [
                "732fb2bb4e6eaa80"
            ],
            [
                "732fb2bb4e6eaa80"
            ]
        ]
    },
    {
        "id": "7f9c386269e249e2",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Set temperature limits",
        "property": "payload.sensor_data.y_rms_ACC_G",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "-5",
                "vt": "str"
            },
            {
                "t": "gte",
                "v": "30",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 740,
        "y": 820,
        "wires": [
            [
                "75bcc56541b2f87a"
            ],
            [
                "75bcc56541b2f87a"
            ]
        ]
    },
    {
        "id": "a96407ea593cbe8a",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Set temperature limits",
        "property": "payload.sensor_data.z_rms_ACC_G",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "-5",
                "vt": "str"
            },
            {
                "t": "gte",
                "v": "30",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 740,
        "y": 900,
        "wires": [
            [
                "1e311fe9b4d37638"
            ],
            [
                "1e311fe9b4d37638"
            ]
        ]
    },
    {
        "id": "620598867c3564f1",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Set temperature limits",
        "property": "payload.sensor_data.temperature",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lt",
                "v": "0",
                "vt": "str"
            },
            {
                "t": "gt",
                "v": "30",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 720,
        "y": 380,
        "wires": [
            [
                "4c7f33789ca7c3dd"
            ],
            [
                "4c7f33789ca7c3dd"
            ]
        ]
    },
    {
        "id": "f1a8611ec698886c",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Set temperature limits",
        "property": "payload.sensor_data.temperature",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lt",
                "v": "0",
                "vt": "str"
            },
            {
                "t": "gt",
                "v": "20",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 380,
        "y": 80,
        "wires": [
            [
                "0981ef9f82b4f128"
            ],
            [
                "0981ef9f82b4f128"
            ]
        ]
    },
    {
        "id": "57d8bca623128d14",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "Set temperature limits",
        "property": "payload.sensor_data.y_rms_ACC_G",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "-5",
                "vt": "str"
            },
            {
                "t": "gte",
                "v": "30",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 720,
        "y": 1080,
        "wires": [
            [
                "1fb67de8539a66ee"
            ],
            [
                "1fb67de8539a66ee"
            ]
        ]
    },
    {
        "id": "732fb2bb4e6eaa80",
        "type": "change",
        "z": "c7f311b561d11f73",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" x_rms_ACC_G warning\"\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 720,
        "wires": [
            [
                "c08bfffb2cfdd8b5",
                "ce55fad01b0fdc81"
            ]
        ]
    },
    {
        "id": "75bcc56541b2f87a",
        "type": "change",
        "z": "c7f311b561d11f73",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" y_rms_ACC_G warning\"\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 820,
        "wires": [
            [
                "6f87d81ef73d57dc",
                "1cdf22ca0bfa782c"
            ]
        ]
    },
    {
        "id": "1e311fe9b4d37638",
        "type": "change",
        "z": "c7f311b561d11f73",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" z_rms_ACC_G warning\"\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 900,
        "wires": [
            [
                "ea3ac57bc63bb859",
                "be3d473f26b90abe"
            ]
        ]
    },
    {
        "id": "4c7f33789ca7c3dd",
        "type": "change",
        "z": "c7f311b561d11f73",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" 1D온도센서오류\"",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 940,
        "y": 380,
        "wires": [
            [
                "88a786641233d073",
                "eab249c4c1bd0a77",
                "93cc2b40ca04753f"
            ]
        ]
    },
    {
        "id": "0981ef9f82b4f128",
        "type": "change",
        "z": "c7f311b561d11f73",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" 1D온도센서오류\"",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 40,
        "wires": [
            [
                "4a79585c9bca2479"
            ]
        ]
    },
    {
        "id": "1fb67de8539a66ee",
        "type": "change",
        "z": "c7f311b561d11f73",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" x_rms_ACC_G warning\"\t",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" y_rms_ACC_G warning\"",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "\"Sensor \" & (msg.payload.addr) & \" z_rms_ACC_G warning\"",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 960,
        "y": 1140,
        "wires": [
            []
        ]
    },
    {
        "id": "c08bfffb2cfdd8b5",
        "type": "debug",
        "z": "c7f311b561d11f73",
        "name": "debug 49",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1220,
        "y": 640,
        "wires": []
    },
    {
        "id": "ce55fad01b0fdc81",
        "type": "play audio",
        "z": "c7f311b561d11f73",
        "name": "",
        "voice": "0",
        "x": 1250,
        "y": 700,
        "wires": []
    },
    {
        "id": "6f87d81ef73d57dc",
        "type": "debug",
        "z": "c7f311b561d11f73",
        "name": "debug 50",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1260,
        "y": 780,
        "wires": []
    },
    {
        "id": "1cdf22ca0bfa782c",
        "type": "play audio",
        "z": "c7f311b561d11f73",
        "name": "",
        "voice": "0",
        "x": 1270,
        "y": 840,
        "wires": []
    },
    {
        "id": "ea3ac57bc63bb859",
        "type": "debug",
        "z": "c7f311b561d11f73",
        "name": "debug 51",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1240,
        "y": 940,
        "wires": []
    },
    {
        "id": "be3d473f26b90abe",
        "type": "play audio",
        "z": "c7f311b561d11f73",
        "name": "",
        "voice": "0",
        "x": 1230,
        "y": 1000,
        "wires": []
    },
    {
        "id": "88a786641233d073",
        "type": "play audio",
        "z": "c7f311b561d11f73",
        "name": "",
        "voice": "0",
        "x": 1230,
        "y": 420,
        "wires": []
    },
    {
        "id": "eab249c4c1bd0a77",
        "type": "debug",
        "z": "c7f311b561d11f73",
        "name": "debug 52",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1180,
        "y": 360,
        "wires": []
    },
    {
        "id": "93cc2b40ca04753f",
        "type": "ui_text_input",
        "z": "c7f311b561d11f73",
        "name": "",
        "label": "",
        "tooltip": "",
        "group": "edb876bc2485de7b",
        "order": 11,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "topic",
        "topicType": "msg",
        "x": 1260,
        "y": 480,
        "wires": [
            []
        ]
    },
    {
        "id": "4a79585c9bca2479",
        "type": "trigger",
        "z": "c7f311b561d11f73",
        "name": "blink blue",
        "op1": "colors.led.blue",
        "op2": "colors.led.off",
        "op1type": "global",
        "op2type": "global",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 820,
        "y": 60,
        "wires": [
            [
                "e677e442b4934d9d"
            ]
        ]
    },
    {
        "id": "e677e442b4934d9d",
        "type": "ui_template",
        "z": "c7f311b561d11f73",
        "group": "edb876bc2485de7b",
        "name": "",
        "order": 1,
        "width": "3",
        "height": "3",
        "format": "<style>\n.led {\n    position:absolute;\n    width: 50px;\n    height: 50px;\n    margin: auto;\n    border-radius: 50%;\n}\n</style>\n\n<div><span class=\"led\" style=\"background-color: {{msg.payload}}; box-shadow: #000000BB 0 -1px 1px 0px, inset #000000AA  0 -1px 4px, {{msg.payload}} 0 3px 15px;\"></span></div>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "local",
        "x": 1020,
        "y": 60,
        "wires": [
            [
                "d48d9add6d75dbe0"
            ]
        ]
    },
    {
        "id": "bb5b6ebfeca18b38",
        "type": "trigger",
        "z": "c7f311b561d11f73",
        "name": "blink red",
        "op1": "colors.led.red",
        "op2": "colors.led.off",
        "op1type": "global",
        "op2type": "global",
        "duration": "250",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 820,
        "y": 120,
        "wires": [
            [
                "e677e442b4934d9d"
            ]
        ]
    },
    {
        "id": "d48d9add6d75dbe0",
        "type": "switch",
        "z": "c7f311b561d11f73",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "colors.led.blue",
                "vt": "global"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1170,
        "y": 60,
        "wires": [
            [
                "b2944f95f5c0e52c"
            ]
        ]
    },
    {
        "id": "b2944f95f5c0e52c",
        "type": "delay",
        "z": "c7f311b561d11f73",
        "name": "",
        "pauseType": "random",
        "timeout": "300",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "200",
        "randomLast": "500",
        "randomUnits": "milliseconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 680,
        "y": 120,
        "wires": [
            [
                "bb5b6ebfeca18b38"
            ]
        ]
    },
    {
        "id": "e69d0ec8c02da9b1",
        "type": "ncd-gateway-config",
        "name": "",
        "comm_type": "serial",
        "ip_address": "",
        "tcp_port": "2101",
        "port": "COM3",
        "baudRate": "115200",
        "pan_id": "7fff",
        "rssi": false
    },
    {
        "id": "edb876bc2485de7b",
        "type": "ui_group",
        "name": "A-1",
        "tab": "2b1876438ce56d83",
        "order": 1,
        "disp": true,
        "width": 8,
        "collapse": false
    },
    {
        "id": "2b1876438ce56d83",
        "type": "ui_tab",
        "name": "Main SCREEN",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

I couldn't upload the file, so it took a long time to upload it

what does the data coming in look like?

Why do you have 5 switch nodes checking the same thing?

The five nodes are Vibration speed temperature It's a setup

Please answer all questions that are asked.

you have a debug node so copy the data and paste it to a reply. Data to cause the led to change one way and data to change it the other way

Incoming data is coming from NCD sensors Model name is PR55-61E

And for anyone unfamiliar with the NCD PR55-61E, what does the data coming in look like?

Jains, if you want help, stay on the topic you opened and provide the information that is requested. Since you say you and @Tomi are not working together and this is not a school project then keep your replies to this thread.

I still find is amazing that two people are asking the same question and you are both pasting from the same IP address and the flow you posted is identical with the image that Tomi posted.

But if you want help you need to go back thru this thread and respond to the requests that are made (multiple times).

Of you don't, no one is going to be able to help you or will be willing to help you.

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