# Node-red http request and led connection

**URL:** <https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [10 November 2022 13:19 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401 "2022-11-10T13:19:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![cano](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cano](https://discourse.nodered.org/u/cano)\
**Post date:** [10 November 2022 13:19 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/1 "2022-11-10T13:19:13Z")

</div>

Hello I have a stream and when I send an http request in my stream, if the result is successful, the green light will light up if it fails, the red light will light up how can I do

---

<div class="post-metadata">

**Author:** ![cano](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cano](https://discourse.nodered.org/u/cano)\
**Post date:** [10 November 2022 13:19 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/2 "2022-11-10T13:19:35Z")

</div>

```auto
[
    {
        "id": "0c977f0b2a123938",
        "type": "function",
        "z": "2aa19786181ce4dd",
        "name": "function 6",
        "func": "msg.condition = msg.payload\nmsg.ip = global.get(\"config.fm_settings.fm_ip\");\nmsg.headers = {\n \"x-api-key\": global.get(\"config.fm_settings.fm_api_key\")\n};\n\nmsg.payload = {}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 280,
        "y": 260,
        "wires": [
            [
                "b4280dcafd42a600"
            ]
        ]
    },
    {
        "id": "26005ee8a5306186",
        "type": "http request",
        "z": "2aa19786181ce4dd",
        "name": "",
        "method": "POST",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://{{{ip}}}/{{{api}}}/v5/{{{title}}}",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "credentials": {},
        "x": 670,
        "y": 260,
        "wires": [
            [
                "8de9175d5a40aa55",
                "3b6b8591834cd069"
            ]
        ]
    },
    {
        "id": "8de9175d5a40aa55",
        "type": "debug",
        "z": "2aa19786181ce4dd",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 820,
        "y": 260,
        "wires": []
    },
    {
        "id": "b4280dcafd42a600",
        "type": "file in",
        "z": "2aa19786181ce4dd",
        "name": "read",
        "filename": "C:\\Users\\canoz\\.node-red\\config.yaml",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 410,
        "y": 260,
        "wires": [
            [
                "ccbdb9cab3cd245c"
            ]
        ]
    },
    {
        "id": "ccbdb9cab3cd245c",
        "type": "yaml",
        "z": "2aa19786181ce4dd",
        "property": "payload",
        "name": "",
        "x": 530,
        "y": 260,
        "wires": [
            [
                "26005ee8a5306186"
            ]
        ]
    },
    {
        "id": "a829ebc20ea5c78f",
        "type": "inject",
        "z": "2aa19786181ce4dd",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 110,
        "y": 260,
        "wires": [
            [
                "0c977f0b2a123938"
            ]
        ]
    },
    {
        "id": "3b6b8591834cd069",
        "type": "ui_led",
        "z": "2aa19786181ce4dd",
        "order": 0,
        "group": "41394b97354e5aba",
        "width": 0,
        "height": 0,
        "label": "",
        "labelPlacement": "left",
        "labelAlignment": "left",
        "colorForValue": [
            {
                "color": "#ff0000",
                "value": "false",
                "valueType": "bool"
            },
            {
                "color": "#008000",
                "value": "true",
                "valueType": "bool"
            }
        ],
        "allowColorForValueInMessage": false,
        "shape": "circle",
        "showGlow": true,
        "name": "",
        "x": 830,
        "y": 320,
        "wires": []
    },
    {
        "id": "41394b97354e5aba",
        "type": "ui_group",
        "name": "callboxvirtual",
        "tab": "5fba2751aacc5a8a",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": "index"
    },
    {
        "id": "5fba2751aacc5a8a",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [10 November 2022 13:41 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/3 "2022-11-10T13:41:14Z")

</div>

Hello @cano.

> [@cano](#):
>
> Hello I have a stream

What does this mean?

> [@cano](#):
>
> I send an http request in my stream, if the result is successful, ...

How do you define successful/unsuccessful? Maybe you can use a Status node to track the status of your HTTP node.

> [@cano](#):
>
> the green light will light up if it fails, the red light will light up

What are these red and green lights?  
How are they connected to your Node-Red PC?  
Do you have transistors/relays to control them?

---

<div class="post-metadata">

**Author:** ![cano](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cano](https://discourse.nodered.org/u/cano)\
**Post date:** [10 November 2022 13:44 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/4 "2022-11-10T13:44:55Z")

</div>

I created a virtual led on node-red and I'm testing on that led. I don't have a physical led for now.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 November 2022 13:45 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/5 "2022-11-10T13:45:33Z")

</div>

FYI: It looks like this user is continuing from this thread:

> [@Node-red merging multiple tasks](https://discourse.nodered.org/t/node-red-merging-multiple-tasks/70308):
>
> Hello, I will have 3 buttons on node-red and in a yaml file I will create from visual studio, which button I press will trigger the task in that button, how can I do it?

---

<div class="post-metadata">

**Author:** ![cano](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cano](https://discourse.nodered.org/u/cano)\
**Post date:** [10 November 2022 13:47 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/6 "2022-11-10T13:47:22Z")

</div>

No, I'm done with the button side, now all I have to do is turn on the red warning led if the http request is successful if it is successful.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [10 November 2022 13:51 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/7 "2022-11-10T13:51:25Z")

</div>

> [@jbudd](#):
>
> > [@cano](#):
> >
> > I send an http request in my stream, if the result is successful, ...
> 
> How do you define successful/unsuccessful? Maybe you can use a Status node to track the status of your HTTP node.

Do you know how to turn the LED red or green with an inject node?

---

<div class="post-metadata">

**Author:** ![cano](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cano](https://discourse.nodered.org/u/cano)\
**Post date:** [10 November 2022 14:01 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/8 "2022-11-10T14:01:39Z")

</div>

No, unfortunately I don't know, I would appreciate if you could make a sample node structure.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 November 2022 19:32 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/9 "2022-11-10T19:32:44Z")

</div>

I assume you want to change the color of a `ui-led`.  
So what have you tried?

You should read this about the node:

> **[node-red-contrib-ui-led](https://flows.nodered.org/node/node-red-contrib-ui-led)**
>
> A simple LED status indicator for the Node-RED Dashboard

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 January 2023 19:33 UTC](https://discourse.nodered.org/t/node-red-http-request-and-led-connection/70401/10 "2023-01-09T19:33:25Z")

</div>

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