# Create simple if then flow

**URL:** <https://discourse.nodered.org/t/create-simple-if-then-flow/2002>\
**Category:** General\
**Created:** [2 August 2018 10:33 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002 "2018-08-02T10:33:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![hermann1514](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hermann1514/32/52422_2.png) [@hermann1514](https://discourse.nodered.org/u/hermann1514)\
**Post date:** [2 August 2018 10:33 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/1 "2018-08-02T10:33:21Z")

</div>

Hello,  
I've been trying to build a simple IF THEN logic for a few days now. But do not get it. The idea is that if one value is over 40 and the other value is "ON" something should be done. Somewhere is still the worm in it ☹ Can someone help me?

Here is my Try:

`[{"id":"7419f1f4.3e9738","type":"switch","z":"75b2223b.041e54","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"brightness","vt":"str"},{"t":"cont","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":200,"wires":[["e34034ec.12b678","e8e30a8a.39a7a8"],["3cccf729.f457","e8e30a8a.39a7a8"]]},{"id":"e34034ec.12b678","type":"switch","z":"75b2223b.041e54","name":"","property":"payload.value","propertyType":"msg","rules":[{"t":"gt","v":"40","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":490,"y":160,"wires":[["658b2098.307928","6c632cc2.16d534"]]},{"id":"658b2098.307928","type":"change","z":"75b2223b.041e54","name":"","rules":[{"t":"set","p":"dummy","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":160,"wires":[["9c5545c3.c2fe18","ca216d67.2f438"]]},{"id":"ed54a45b.9f5da8","type":"change","z":"75b2223b.041e54","name":"","rules":[{"t":"set","p":"dummy2","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":240,"wires":[["9c5545c3.c2fe18","ca216d67.2f438"]]},{"id":"3cccf729.f457","type":"switch","z":"75b2223b.041e54","name":"","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":490,"y":240,"wires":[["ed54a45b.9f5da8","6c632cc2.16d534"]]},{"id":"9c5545c3.c2fe18","type":"switch","z":"75b2223b.041e54","name":"","property":"dummy","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":940,"y":198,"wires":[["db2c3abb.5ddc5"],[]]},{"id":"e8e30a8a.39a7a8","type":"debug","z":"75b2223b.041e54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":493,"y":519,"wires":[]},{"id":"6c632cc2.16d534","type":"debug","z":"75b2223b.041e54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":794,"y":529,"wires":[]},{"id":"ca216d67.2f438","type":"debug","z":"75b2223b.041e54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1086,"y":517,"wires":[]},{"id":"db2c3abb.5ddc5","type":"debug","z":"75b2223b.041e54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1327,"y":513,"wires":[]},{"id":"5e6032c.272094c","type":"inject","z":"75b2223b.041e54","name":"","topic":"brightness","payload":"45","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":105,"y":127,"wires":[["7419f1f4.3e9738"]]},{"id":"36389b1e.4ec74c","type":"inject","z":"75b2223b.041e54","name":"","topic":"switch","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":94,"y":285,"wires":[["7419f1f4.3e9738"]]},{"id":"209f6e74.7ea272","type":"inject","z":"75b2223b.041e54","name":"","topic":"switch","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":89,"y":322,"wires":[["7419f1f4.3e9738"]]},{"id":"fb83322f.688ef","type":"inject","z":"75b2223b.041e54","name":"","topic":"brightness","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108,"y":168,"wires":[["7419f1f4.3e9738"]]}]`

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [2 August 2018 10:44 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/2 "2018-08-02T10:44:50Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/0b7db8357ed978015eee155cd50678388e41264f.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6bd6eda3fb1352bc58367b6d1534d2ca5396ae4c.png)

Start here... is the msg.payload not the msg.payload.value and below you should the type of message in this case one is a number and the other is a string,,,, respect the other part of the flow I'm not sure what you are trying to do.

Regards

---

<div class="post-metadata">

**Author:** ![hermann1514](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hermann1514/32/52422_2.png) [@hermann1514](https://discourse.nodered.org/u/hermann1514)\
**Post date:** [2 August 2018 12:14 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/3 "2018-08-02T12:14:31Z")

</div>

I have 2 different values - number and string. If the number is \> 40 and the other value is "ON" then the TRUE way should be taken at the last switch. If not then the output "Otherwise"

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 August 2018 12:47 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/4 "2018-08-02T12:47:11Z")

</div>

But the flow you posted above fails before you get to the last switch.

As David said, In the "Brightness" inject node you set `msg.payload` to be a value. But in your switch node you check for `msg.payload.value > msg.40` it should be `msg.payload > 40` (use the arrow down to select numbers as per Davids images)

You also never set your flow variables back to false

It's easier if you also add a name to your debug nodes it makes it easier to see which debug message comes from which node.

---

<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:** [2 August 2018 13:58 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/5 "2018-08-02T13:58:36Z")

</div>

Also, create a seperate debug for each leg of the switches. That way you know what condition was met. And change them to display the entire msg object.

---

<div class="post-metadata">

**Author:** ![hermann1514](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hermann1514/32/52422_2.png) [@hermann1514](https://discourse.nodered.org/u/hermann1514)\
**Post date:** [3 August 2018 05:34 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/6 "2018-08-03T05:34:12Z")

</div>

Hi, i think the only Problem i have now is the last Switch. Here i must check if both "FLOWS" are true (dummy and dummy2). I have create a IF Statement in this. But now there is an error.  
Can somebody help?

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/21034703968c1487c32fbac567d2f2999ad29f5a.png)

Here is the complete flow:

`[{"id":"be43a18d.a58e","type":"switch","z":"59b2c712.73a23","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"brightness","vt":"str"},{"t":"cont","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":338,"y":218,"wires":[["9d3fba46.bf69c8","72daba28.67861c"],["3ec872b1.c64b5e","72daba28.67861c"]]},{"id":"9d3fba46.bf69c8","type":"switch","z":"59b2c712.73a23","name":"brightness_flow","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"40","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":568,"y":178,"wires":[["a11dff76.0e2cd8","492f04c7.7a8c6c"]]},{"id":"a11dff76.0e2cd8","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":748,"y":178,"wires":[["56b81b68.e920c4","e34874db.75366"]]},{"id":"259ffe79.78c132","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy2","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":748,"y":258,"wires":[["56b81b68.e920c4","e34874db.75366"]]},{"id":"3ec872b1.c64b5e","type":"switch","z":"59b2c712.73a23","name":"switch_flow","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":558,"y":258,"wires":[["259ffe79.78c132","492f04c7.7a8c6c"]]},{"id":"56b81b68.e920c4","type":"switch","z":"59b2c712.73a23","name":"True or not","property":"(if (flow.dummy and flow.dummy2))","propertyType":"jsonata","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1008,"y":216,"wires":[["3da38131.1c71be"],[]]},{"id":"72daba28.67861c","type":"debug","z":"59b2c712.73a23","name":"AFter first Switch","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":561,"y":537,"wires":[]},{"id":"492f04c7.7a8c6c","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":842,"y":547,"wires":[]},{"id":"e34874db.75366","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1134,"y":535,"wires":[]},{"id":"3da38131.1c71be","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1375,"y":531,"wires":[]},{"id":"69ae5816.caa1f8","type":"inject","z":"59b2c712.73a23","name":"","topic":"brightness","payload":"45","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":153,"y":145,"wires":[["be43a18d.a58e"]]},{"id":"c5380475.9dc81","type":"inject","z":"59b2c712.73a23","name":"","topic":"switch","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":142,"y":303,"wires":[["be43a18d.a58e"]]},{"id":"57bae2bc.78fde4","type":"inject","z":"59b2c712.73a23","name":"","topic":"switch","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":137,"y":340,"wires":[["be43a18d.a58e"]]},{"id":"de50ecd4.246918","type":"inject","z":"59b2c712.73a23","name":"","topic":"brightness","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":156,"y":186,"wires":[["be43a18d.a58e","89a2d5ad.0a8048"]]},{"id":"89a2d5ad.0a8048","type":"debug","z":"59b2c712.73a23","name":"Brightness 30","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":293,"y":543,"wires":[]}]`

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [3 August 2018 06:31 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/7 "2018-08-03T06:31:55Z")

</div>

Change your JSONata expression in the switch `True or not` to:

```auto
$flowContext('dummy') and $flowContext('dummy2')

```

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [3 August 2018 06:57 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/8 "2018-08-03T06:57:14Z")

</div>

Is still don't think this will do what you want it to. Where in your flow do you set the contexts back to `false` if the brightness falls below 40?

---

<div class="post-metadata">

**Author:** ![hermann1514](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hermann1514/32/52422_2.png) [@hermann1514](https://discourse.nodered.org/u/hermann1514)\
**Post date:** [3 August 2018 07:44 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/9 "2018-08-03T07:44:03Z")

</div>

Hi.  
Thank you for the info. How do I reset the status to false? I have now installed a second check and this output also connected to the next switch. Is that right or are there better ways?

`[{"id":"be43a18d.a58e","type":"switch","z":"59b2c712.73a23","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"brightness","vt":"str"},{"t":"cont","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":338,"y":218,"wires":[["9d3fba46.bf69c8","72daba28.67861c"],["3ec872b1.c64b5e","72daba28.67861c"]]},{"id":"9d3fba46.bf69c8","type":"switch","z":"59b2c712.73a23","name":"brightness_flow","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"40","vt":"num"},{"t":"lt","v":"40","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":532,"y":108,"wires":[["a11dff76.0e2cd8","492f04c7.7a8c6c"],["78635aa6.3c4ae4"]]},{"id":"a11dff76.0e2cd8","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":814,"y":102,"wires":[["56b81b68.e920c4","e34874db.75366"]]},{"id":"259ffe79.78c132","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy2","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":821,"y":263,"wires":[["56b81b68.e920c4","e34874db.75366"]]},{"id":"3ec872b1.c64b5e","type":"switch","z":"59b2c712.73a23","name":"switch_flow","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":522,"y":257,"wires":[["259ffe79.78c132","492f04c7.7a8c6c"],["f6c198d4.f7037"]]},{"id":"56b81b68.e920c4","type":"switch","z":"59b2c712.73a23","name":"True or not","property":"($flowContext('dummy') and $flowContext('dummy2'))","propertyType":"jsonata","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1139,"y":201,"wires":[["3da38131.1c71be"],[]]},{"id":"72daba28.67861c","type":"debug","z":"59b2c712.73a23","name":"AFter first Switch","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":575,"y":616,"wires":[]},{"id":"492f04c7.7a8c6c","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":865,"y":608,"wires":[]},{"id":"e34874db.75366","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1160,"y":597,"wires":[]},{"id":"3da38131.1c71be","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1376,"y":608,"wires":[]},{"id":"69ae5816.caa1f8","type":"inject","z":"59b2c712.73a23","name":"","topic":"brightness","payload":"45","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":153,"y":145,"wires":[["be43a18d.a58e"]]},{"id":"c5380475.9dc81","type":"inject","z":"59b2c712.73a23","name":"","topic":"switch","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":142,"y":303,"wires":[["be43a18d.a58e"]]},{"id":"57bae2bc.78fde4","type":"inject","z":"59b2c712.73a23","name":"","topic":"switch","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":137,"y":340,"wires":[["be43a18d.a58e"]]},{"id":"de50ecd4.246918","type":"inject","z":"59b2c712.73a23","name":"","topic":"brightness","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":156,"y":186,"wires":[["be43a18d.a58e","89a2d5ad.0a8048"]]},{"id":"89a2d5ad.0a8048","type":"debug","z":"59b2c712.73a23","name":"Brightness 30","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":300,"y":615,"wires":[]},{"id":"78635aa6.3c4ae4","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":814,"y":147,"wires":[["56b81b68.e920c4"]]},{"id":"f6c198d4.f7037","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy2","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":304,"wires":[["56b81b68.e920c4"]]}]`

---

<div class="post-metadata">

**Author:** ![hermann1514](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hermann1514/32/52422_2.png) [@hermann1514](https://discourse.nodered.org/u/hermann1514)\
**Post date:** [3 August 2018 08:19 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/10 "2018-08-03T08:19:01Z")

</div>

Hi,

this Flow is working after change some settings.  
Is there a better way?

`[{"id":"be43a18d.a58e","type":"switch","z":"59b2c712.73a23","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"brightness","vt":"str"},{"t":"cont","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":338,"y":218,"wires":[["9d3fba46.bf69c8","72daba28.67861c"],["3ec872b1.c64b5e","72daba28.67861c"]]},{"id":"9d3fba46.bf69c8","type":"switch","z":"59b2c712.73a23","name":"brightness_flow","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"40","vt":"num"},{"t":"lt","v":"40","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":532,"y":108,"wires":[["a11dff76.0e2cd8","492f04c7.7a8c6c"],["78635aa6.3c4ae4"]]},{"id":"a11dff76.0e2cd8","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":814,"y":102,"wires":[["56b81b68.e920c4","e34874db.75366"]]},{"id":"259ffe79.78c132","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy2","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":821,"y":263,"wires":[["56b81b68.e920c4","e34874db.75366"]]},{"id":"3ec872b1.c64b5e","type":"switch","z":"59b2c712.73a23","name":"switch_flow","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":522,"y":257,"wires":[["259ffe79.78c132","492f04c7.7a8c6c"],["f6c198d4.f7037"]]},{"id":"56b81b68.e920c4","type":"switch","z":"59b2c712.73a23","name":"True or not","property":"($flowContext('dummy') and $flowContext('dummy2'))","propertyType":"jsonata","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1139,"y":201,"wires":[["3da38131.1c71be"],[]]},{"id":"72daba28.67861c","type":"debug","z":"59b2c712.73a23","name":"AFter first Switch","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":575,"y":616,"wires":[]},{"id":"492f04c7.7a8c6c","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":865,"y":608,"wires":[]},{"id":"e34874db.75366","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1160,"y":597,"wires":[]},{"id":"3da38131.1c71be","type":"debug","z":"59b2c712.73a23","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1376,"y":608,"wires":[]},{"id":"69ae5816.caa1f8","type":"inject","z":"59b2c712.73a23","name":"","topic":"brightness","payload":"45","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":153,"y":145,"wires":[["be43a18d.a58e"]]},{"id":"c5380475.9dc81","type":"inject","z":"59b2c712.73a23","name":"","topic":"switch","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":142,"y":303,"wires":[["be43a18d.a58e"]]},{"id":"57bae2bc.78fde4","type":"inject","z":"59b2c712.73a23","name":"","topic":"switch","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":137,"y":340,"wires":[["be43a18d.a58e"]]},{"id":"de50ecd4.246918","type":"inject","z":"59b2c712.73a23","name":"","topic":"brightness","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":156,"y":186,"wires":[["be43a18d.a58e","89a2d5ad.0a8048"]]},{"id":"89a2d5ad.0a8048","type":"debug","z":"59b2c712.73a23","name":"Brightness 30","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":300,"y":615,"wires":[]},{"id":"78635aa6.3c4ae4","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":814,"y":147,"wires":[["56b81b68.e920c4"]]},{"id":"f6c198d4.f7037","type":"change","z":"59b2c712.73a23","name":"","rules":[{"t":"set","p":"dummy2","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":304,"wires":[["56b81b68.e920c4"]]}]`

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [3 August 2018 13:01 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/12 "2018-08-03T13:01:51Z")

</div>

I know you are keen to promote your dsm node at every opportunity, but sometimes it is better to help show how the built-in nodes and concepts can be used, as that will be much more reusable to other tasks.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [3 August 2018 13:41 UTC](https://discourse.nodered.org/t/create-simple-if-then-flow/2002/13 "2018-08-03T13:41:56Z")

</div>

> [@knolleary](#):
>
> I know you are keen to promote your dsm node at every opportunity

Not really, you can find more use cases in the Wiki.

The question was `is there a better way?`  
So I couldn't resist 🙂

But yes, I see!
