# A lesson about using the \`traffic\` node for anyone using it

**URL:** <https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784>\
**Category:** General\
**Created:** [10 February 2019 00:03 UTC](https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784 "2019-02-10T00:03:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 February 2019 00:03 UTC](https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784/1 "2019-02-10T00:03:57Z")

</div>

(This is posted with all honesty to be as helpful to people learning about writing flows. I have shot myself in the foot so many times with **stupid** mistakes **REPEATEDLY**! After a lot of wasted time because I didn't realise something, I am posting this based on what I was doing, what I wanted to happen and what I saw happening, and the conclusions based on that.)

* * *

I know it is not a standard node, but I have found a lot of use for the `traffic` node.

Basically it allows control of data flow. Like a traffic light. Basically STOP or GO.

Although it may be an _unwritten rule_, I just spent a lot of time (wasted may be a better term, but I'm not going to split hairs.) with this node and the settings I was using..

The node supports different _modes_ to control the data flow.  
You can specify letters, numbers, or the "basic" `true` and `false` logic states.

_Unless you are actually wanting to control the data flow of `true` and `false`:_  
I **strongly** advise you to use the `true` and `false` to control the state of the node.

I was sending _text_ through the node and had `A` and `B` to start and stop the flow.  
Oh the fun I had trying to work out why it wasn't doing what I expected.

Because the _text_ that I was sending through as **real data** had `A` and `B` in it, all sorts of fun ensued.  
Or so it seems. Because when I switched to using `true` and `false`, the problem went away.

Unless the data flow is actual `true` and `false` signals, please save yourself a lot of grief and use those two as the on/off signals.

Likewise: If you are sending `true` and `false` as the data flow, use either letters/numbers.

But suffice to say:  
When switching text/numbers/alphanumeric stuff....... Use `true` and `false` to switch the node.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [10 February 2019 05:19 UTC](https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784/2 "2019-02-10T05:19:15Z")

</div>

Hi @Trying_to_learn,

`<self-promotion>` you might take a look at `node-red-contrib-simple-gate`. It avoids some of the difficulties you are having. `</self-promotion>`. 🙂

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 February 2019 08:42 UTC](https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784/3 "2019-02-14T08:42:10Z")

</div>

I actually have that installed too.

No problems with the self promo. 😉

I was just putting it out there the problem/s I had and explained how it happened as a _warning_ for anyone new to the game.

---

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [21 January 2021 16:51 UTC](https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784/5 "2021-01-21T16:51:49Z")

</div>

Very good node. Well written.

---

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [21 January 2021 16:52 UTC](https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784/6 "2021-01-21T16:52:50Z")

</div>

I feel your pain. Good tips on the traffic node.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 January 2021 18:09 UTC](https://discourse.nodered.org/t/a-lesson-about-using-the-traffic-node-for-anyone-using-it/7784/7 "2021-01-21T18:09:10Z")

</div>


