# How would I do this without a flow variable?

**URL:** <https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654>\
**Category:** General\
**Created:** [14 January 2022 14:26 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654 "2022-01-14T14:26:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [14 January 2022 14:26 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654/1 "2022-01-14T14:26:03Z")

</div>

I don't want to have to pass the payload to the remote site. I just want to get a value from the header to decide what to do with my payload.

```auto
[{"id":"7acf375.df4f8c8","type":"http request","z":"298b76dd.fb448a","name":"Is TV On?","method":"GET","ret":"txt","paytoqs":false,"url":"http://remotehost:remoteport/tvon","tls":"","persist":false,"proxy":"","authType":"","x":320,"y":80,"wires":[["47b4537.75c07ac"]]}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 January 2022 14:47 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654/2 "2022-01-14T14:47:18Z")

</div>

> [@hepcat72](#):
>
> I just want to get a value from the header to decide what to do with my payload.

Hi, you only posted a HTTP Request node (was there supposed to be more flow?)

Any how, if you are only interested in a particular value & want to decide whether to pass the msg or not, then you can use a switch node and copy the path from the message using the "copy path" button on the item of interest.

It might help us to help you, if you show us an example message and tell us what value should allow the msg to be passed and what value should cause the msg to be blocked.

* * *

CANNED TEXT...

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [14 January 2022 15:08 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654/3 "2022-01-14T15:08:29Z")

</div>

I knowingly left out the return of the HTTP request. It's a concrete example, but my question is generic. This is a subflow, and I simply want to be able to pass the input to the subflow to one of the 2 outputs, depending on the http response. In this case, the response is either "true\n" or "false\n". I _could_ pass the payload to the remote host and have it sent back in a header, but there's no reason that the remote host needs it, so I'd rather not send that back and forth.

I guess what I don't know is, if I set `msg.random_variable` and pass that into the http request node, does that variable come back out (and not send it to the remote host) along with the response? I could have tried that, but it didn't occur to me as a possibility until just now.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 January 2022 15:10 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654/4 "2022-01-14T15:10:22Z")

</div>

> [@hepcat72](#):
>
> I guess what I don't know is, if I set `msg.random_variable` and pass that into the http request node, does that variable come back out (and not send it to the remote host

I believe it does pass through (without going to host).

And as you say, easy enough to test.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [14 January 2022 15:14 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654/5 "2022-01-14T15:14:35Z")

</div>

OK, yep. Looks like it is passed along. I haven't tested whether it is in the msg on the remote host, but I assume it's not. Thanks.

---

<div class="post-metadata">

**Author:** ![hepcat72](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hepcat72/32/8078_2.png) [@hepcat72](https://discourse.nodered.org/u/hepcat72)\
**Post date:** [14 January 2022 15:24 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654/6 "2022-01-14T15:24:33Z")

</div>

Incidentally, I wrote this because I have found `cec-client` and `tvservice` to be unreliable. `cec` just sometimes hangs forever and no other `cec-client` or `tvservice` commands can get through when that happens. Happens only once in awhile, but enough to be annoying. The remote host in this case is a node-red instance running on my mac connected to another HDMI port of the same TV, and I learned today that I can infer whether the TV is on or off based on the output of:

```auto
tell application "System Events" to return (display name of first desktop is "LCD TV")

```

So I created a flow that creates a webhook that returns the `osascript isTVOn.scpt` output in a header in the response.

---

<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:** [28 January 2022 15:24 UTC](https://discourse.nodered.org/t/how-would-i-do-this-without-a-flow-variable/56654/7 "2022-01-28T15:24:58Z")

</div>

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