# Help with why this isn't working

**URL:** <https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504>\
**Category:** General\
**Created:** [9 September 2022 07:01 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504 "2022-09-09T07:01:26Z")\
**Posts on this page:** 20\
**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:** [9 September 2022 07:01 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/1 "2022-09-09T07:01:26Z")

</div>

Sorry folks, _the brain has yet again failed me_.

This is the code (just to get it posted)

```auto
[{"id":"736e32dd.75a544","type":"function","z":"10fde8b5.a8a82f","name":"/ 1000","func":"let now = parseInt(msg.now/1000);\nmsg.now = now;\n//node.warn(\"Now \" + now);\n\nnode.warn(\"Detail: \" + msg.payload.detail);\n\nlet wind = msg.payload.windspeed;\nnode.status({text:wind});\n\n//let low = flow.get(\"$parent.base.wind.light\");\n//let strong = flow.get(\"base.wind.strong\");\nlet low = msg.base.wind.light;\nlet strong = msg.base.wind.strong;\n\n\nif (wind < low)\n{\n flow.set(\"windstrength\",\"NO\");\n node.status({text:\"NO\"});\n}\nif (wind > strong)\n{\n flow.set(\"windstrength\",\"LIGHT\");\n node.status({text:\"STRONG\"});\n}\nif (wind > strong)\n{\n flow.set(\"windstrength\",\"STRONG\");\n node.status({text:\"STRONG\"});\n}\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":240,"wires":[["ea01de11.03a3e","d8ea8dba.4395f","44dad39d.b957cc","e8436f1c.bdc92","36c6cc84.b80cac","7372e63f.cc2e48","9e41f2e4.e015e","79b1ce9.789c23","83473f32.c036d8"]]},{"id":"ea01de11.03a3e","type":"switch","z":"10fde8b5.a8a82f","name":"Thunderstorm","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"thunderstorm","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1310,"y":240,"wires":[["3f65d757.5766","efea611bd2cb6d6c"]]},{"id":"3f65d757.5766","type":"function","z":"10fde8b5.a8a82f","name":"","func":"node.warn(\"here\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1735,"y":240,"wires":[["a206a1b0.6c1ae","1ef5916f.d41457"]],"l":false}]

```

I have written a subflow to _decode_ weather and give an icon output controlled by the incoming message payload.

(Screen shot)

 ![Screenshot from 2022-09-09 16-55-06](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/91e148524bd1378304533a3ff6f95737dc943bc8.png)

So you can see a `node.warn()` output showing the `msg.payload.detail` contents.

To the right of that there is the `switch` node which looks if `msg.payload.detail` `contains` "thunderstorm".

If it does, it sends the message on.

Then, further to the right, is a `function` node that warns `here` and that is never done.

Where is the _elephant_ I'm missing?

---

<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:** [9 September 2022 07:12 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/2 "2022-09-09T07:12:13Z")

</div>

Put a `debug` node on the output of the '/ 1000' `function` node and show the results. Does it have a value that will pass it thru the switch?

---

<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:** [9 September 2022 07:15 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/3 "2022-09-09T07:15:37Z")

</div>

That's a bit hard as it is a subflow. ☹  
But the `node.warn()` is showing the correct / expected value. "some thunderstorm detected".

That is the first (upper) red line/message you see in the picture.

---

<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:** [9 September 2022 07:24 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/4 "2022-09-09T07:24:17Z")

</div>

Well then, put a `debug` node (set to display the complete msg object) on the output of the node calling the subflow.

Using that tiny snippet of your flow and creating some test data shows it works fine so it has to be someting else going on. But not having the full flow makes it difficult to help you out.

---

<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:** [9 September 2022 07:24 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/5 "2022-09-09T07:24:39Z")

</div>

Sorry, to further confuse me I copied that node OUTSIDE the subflow and put a `trigger` node after it (to indicate the message passing) and it _triggers_.

SO it works outside the subflow but _seems_ to be failing inside the subflow.

(I'll read your reply now)

---

<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:** [9 September 2022 07:29 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/6 "2022-09-09T07:29:00Z")

</div>

This is the external code:

```auto
[{"id":"af1cae3714cc805f","type":"inject","z":"ae12fd.00ef75","name":"thunderstorm","props":[{"p":"payload.detail","v":"some thunderstorm detected","vt":"str"},{"p":"payload.sunrise","v":"1662667440","vt":"num"},{"p":"now","v":"1662707311383","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":770,"y":370,"wires":[["fbbc64a4.0fc378","1981fbea140f9e8b","b97778424dba56a6"]]},{"id":"1981fbea140f9e8b","type":"debug","z":"ae12fd.00ef75","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.detail","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":370,"wires":[]},{"id":"b97778424dba56a6","type":"switch","z":"ae12fd.00ef75","name":"Thunderstorm","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"thunderstorm","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":980,"y":330,"wires":[["e0d994dfa09d54ed"]]},{"id":"e0d994dfa09d54ed","type":"trigger","z":"ae12fd.00ef75","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"4","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1180,"y":330,"wires":[[]]}]

```

The `switch` node is a copy of what is in subflow.  
The `debug` shows what I am expecting - is it correct?  
The `trigger` node is triggered indicating that the `switch` node is passing the message.

The original code I posted is basically the first nodes in the subflow.

Does that help?

This is a screen show of what I originally did but from the flow's level.

 ![Screenshot from 2022-09-09 17-29-49](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/d/ddde5ce280b54ebd2ec3eb35d274c2d85bd4a7c1.png)

---

<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:** [9 September 2022 07:35 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/7 "2022-09-09T07:35:42Z")

</div>

Argh,

There is the subflow.

EXTERNAL NODES NEEDED for weather.

```auto
[{"id":"10fde8b5.a8a82f","type":"subflow","name":"Weather","info":"1 11 2020\nA lot better.\nIcons working as expected.\nThough more testing is needed.\n\nPut in option to set `msg.colour` but not\nimplimented yet.\n\n\n\nSecret stuff\nd8f8c3e28e887076433ae31e5b78a45b","category":"","in":[{"x":540,"y":240,"wires":[{"id":"82fafc1a.b3e21"},{"id":"e779ead8.7386e8"},{"id":"3beba12.b00ef5e"}]}],"out":[{"x":2350,"y":260,"wires":[{"id":"3cb516b6.5757a2","port":0},{"id":"7fb1a81d.4da6a","port":0}]},{"x":2350,"y":370,"wires":[{"id":"e7a1c497.51056","port":0},{"id":"c35495e6.e376e","port":0}]},{"x":2350,"y":530,"wires":[{"id":"4af57184.36b928","port":0},{"id":"e013d5fa.259aa8","port":0}]},{"x":2350,"y":760,"wires":[{"id":"56758975.26f77","port":0},{"id":"16427981.3398f6","port":0},{"id":"c67bbc79.6116a8","port":0},{"id":"8bbff73b.e2e4a","port":0},{"id":"b12861e9.c712c","port":0},{"id":"bd087fda.40cab8","port":0},{"id":"2d19f161.e486b6","port":0}]},{"x":2350,"y":1080,"wires":[{"id":"c125972d.f52058","port":0},{"id":"8eb3fc7c.41e288","port":0},{"id":"4fba7468.c48934","port":0},{"id":"b4b37e81.224e8","port":0}]},{"x":2350,"y":1240,"wires":[{"id":"96598146.3bee48","port":0},{"id":"ad18fd86.0823d8","port":0},{"id":"e1d34ac8.0443f8","port":0}]},{"x":2350,"y":1510,"wires":[{"id":"ba81b366.5f6f1","port":0},{"id":"222bebf1.8372cc","port":0}]},{"x":2350,"y":1700,"wires":[{"id":"c790fb1.e0ea508","port":0},{"id":"b1591fa0.61913","port":0}]},{"x":2350,"y":2400,"wires":[{"id":"3347e292.2479fe","port":0}]},{"x":2350,"y":2450,"wires":[]},{"x":2350,"y":2500,"wires":[{"id":"131947f4.de572","port":0}]},{"x":2350,"y":2550,"wires":[{"id":"6c63bf11.09bb5","port":0}]},{"x":2350,"y":2600,"wires":[{"id":"24151a93.78a12e","port":0}]}],"env":[],"meta":{},"color":"#87A980","outputLabels":["Thunderstorms","Hail","Fog","Rain","Cloudy","Partly cloudy","Fair","Snow","TEMP FOR WIND","Intensity of rain","If you want to use the msg.icon","Cloud % coverage","Icon not found"],"icon":"font-awesome/fa-snowflake-o"},{"id":"3cb516b6.5757a2","type":"change","z":"10fde8b5.a8a82f","name":"Day thunderstorm","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-thunderstorm","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2060,"y":260,"wires":[["f66104d5.41ab7"]]},{"id":"e7a1c497.51056","type":"change","z":"10fde8b5.a8a82f","name":"Day hail","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-hail","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":370,"wires":[["7ee3a01.855406"]]},{"id":"4af57184.36b928","type":"change","z":"10fde8b5.a8a82f","name":"Day fog","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-fog","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":530,"wires":[["ab299ec2.2bd1c"]]},{"id":"8eb3fc7c.41e288","type":"change","z":"10fde8b5.a8a82f","name":"Day cloudy","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-cloudy","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1060,"wires":[["7e2dd661.f9e88"]]},{"id":"96598146.3bee48","type":"change","z":"10fde8b5.a8a82f","name":"Partly cloudy","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-darksky-partly-cloudy-day","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1260,"wires":[["c9ce0127.1b2fc8"]]},{"id":"8b807984.d95c08","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":1240,"wires":[["ad18fd86.0823d8"],["ad18fd86.0823d8"],["96598146.3bee48"]]},{"id":"a54320a9.77d538","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":1280,"wires":[[]]},{"id":"5cdd808a.0d6db8","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":1040,"wires":[["c125972d.f52058"],["c125972d.f52058"],["8eb3fc7c.41e288"]]},{"id":"8a604f63.d8f88","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":1080,"wires":[[]]},{"id":"c125972d.f52058","type":"change","z":"10fde8b5.a8a82f","name":"Night cloudy","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-cloudy","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1020,"wires":[["7e2dd661.f9e88"]]},{"id":"ad18fd86.0823d8","type":"change","z":"10fde8b5.a8a82f","name":"Partly cloudy (night)","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-cloudy","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2070,"y":1220,"wires":[["c9ce0127.1b2fc8"]]},{"id":"2c42bafb.9ca7ce","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":1510,"wires":[["222bebf1.8372cc"],["222bebf1.8372cc"],["ba81b366.5f6f1"]]},{"id":"a03caa10.ce83c","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":1550,"wires":[[]]},{"id":"ba81b366.5f6f1","type":"change","z":"10fde8b5.a8a82f","name":"Clear","rules":[{"t":"set","p":"payload","pt":"msg","to":" wi wi-darksky-clear-day","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2020,"y":1530,"wires":[["14ffc572.d3c78b"]]},{"id":"222bebf1.8372cc","type":"change","z":"10fde8b5.a8a82f","name":"Clear (night)","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-darksky-clear-night","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1490,"wires":[["14ffc572.d3c78b"]]},{"id":"6abc41b9.d7ed4","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":770,"wires":[["16427981.3398f6"],["16427981.3398f6"],["56758975.26f77"]]},{"id":"98a4215b.6a1ef","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":810,"wires":[[]]},{"id":"ac0a4b73.7bbd28","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":510,"wires":[["e013d5fa.259aa8"],["e013d5fa.259aa8"],["4af57184.36b928"]]},{"id":"68a9f25b.562674","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":550,"wires":[[]]},{"id":"19bf43c4.a1f91c","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":350,"wires":[["c35495e6.e376e"],["c35495e6.e376e"],["e7a1c497.51056"]]},{"id":"7dcb52ec.d340d4","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":390,"wires":[[]]},{"id":"8950e243.826b18","type":"comment","z":"10fde8b5.a8a82f","name":"Cloudy","info":"","x":1450,"y":1050,"wires":[]},{"id":"9a371d8e.bd503","type":"comment","z":"10fde8b5.a8a82f","name":"Partly cloudy","info":"","x":1460,"y":1240,"wires":[]},{"id":"c0dbdccf.92a498","type":"comment","z":"10fde8b5.a8a82f","name":"Clear","info":"","x":1580,"y":1510,"wires":[]},{"id":"1ef67c01.68b0d4","type":"comment","z":"10fde8b5.a8a82f","name":"Unknown icon","info":"","x":2470,"y":2600,"wires":[]},{"id":"9995f9a.5649308","type":"comment","z":"10fde8b5.a8a82f","name":"Fog","info":"","x":1580,"y":510,"wires":[]},{"id":"1f48c831.b9d5d","type":"comment","z":"10fde8b5.a8a82f","name":"Hail","info":"","x":1580,"y":350,"wires":[]},{"id":"7a592206.adfa7c","type":"comment","z":"10fde8b5.a8a82f","name":"T Storms","info":"","x":1590,"y":240,"wires":[]},{"id":"a206a1b0.6c1ae","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":240,"wires":[["7fb1a81d.4da6a"],["7fb1a81d.4da6a"],["3cb516b6.5757a2"]]},{"id":"1ef5916f.d41457","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":280,"wires":[[]]},{"id":"f4d9cd97.9a244","type":"comment","z":"10fde8b5.a8a82f","name":"Rain","info":"","x":1600,"y":680,"wires":[]},{"id":"56758975.26f77","type":"change","z":"10fde8b5.a8a82f","name":"Day rain","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-rain","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":790,"wires":[["1e77d751.41fac9"]]},{"id":"16427981.3398f6","type":"change","z":"10fde8b5.a8a82f","name":"Night rain","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-rain","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":750,"wires":[["1e77d751.41fac9"]]},{"id":"736e32dd.75a544","type":"function","z":"10fde8b5.a8a82f","name":"/ 1000","func":"let now = parseInt(msg.now/1000);\nmsg.now = now;\n//node.warn(\"Now \" + now);\n\nnode.warn(\"Detail: \" + msg.payload.detail);\n\nlet wind = msg.payload.windspeed;\nnode.status({text:wind});\n\n//let low = flow.get(\"$parent.base.wind.light\");\n//let strong = flow.get(\"base.wind.strong\");\nlet low = msg.base.wind.light;\nlet strong = msg.base.wind.strong;\n\n\nif (wind < low)\n{\n flow.set(\"windstrength\",\"NO\");\n node.status({text:\"NO\"});\n}\nif (wind > strong)\n{\n flow.set(\"windstrength\",\"LIGHT\");\n node.status({text:\"STRONG\"});\n}\nif (wind > strong)\n{\n flow.set(\"windstrength\",\"STRONG\");\n node.status({text:\"STRONG\"});\n}\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":240,"wires":[["ea01de11.03a3e","d8ea8dba.4395f","44dad39d.b957cc","e8436f1c.bdc92","36c6cc84.b80cac","7372e63f.cc2e48","9e41f2e4.e015e","79b1ce9.789c23","83473f32.c036d8","03cbcdc7380cb7d7"]]},{"id":"b6c0418c.e3f6a8","type":"change","z":"10fde8b5.a8a82f","name":"now and clouds","rules":[{"t":"set","p":"now","pt":"msg","to":"","tot":"date"},{"t":"set","p":"CloudCoverage","pt":"flow","to":"msg.data.clouds.all","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":240,"wires":[["736e32dd.75a544","29732b22.a849bc"]]},{"id":"3f65d757.5766","type":"function","z":"10fde8b5.a8a82f","name":"","func":"node.warn(\"here\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1735,"y":240,"wires":[["a206a1b0.6c1ae","1ef5916f.d41457"]],"l":false},{"id":"b7b5b9b9.375af8","type":"function","z":"10fde8b5.a8a82f","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1735,"y":350,"wires":[["19bf43c4.a1f91c","7dcb52ec.d340d4"]],"l":false},{"id":"6173fca5.92bfec","type":"function","z":"10fde8b5.a8a82f","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1735,"y":510,"wires":[["ac0a4b73.7bbd28","68a9f25b.562674"]],"l":false},{"id":"d475af60.586248","type":"function","z":"10fde8b5.a8a82f","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1595,"y":1240,"wires":[["a54320a9.77d538","441775b8.3d05c4"]],"l":false},{"id":"6c63bf11.09bb5","type":"change","z":"10fde8b5.a8a82f","name":"Clouds","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.clouds","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1850,"y":2550,"wires":[[]]},{"id":"7fb1a81d.4da6a","type":"change","z":"10fde8b5.a8a82f","name":"Night thunderstorm","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-thunderstorm","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2060,"y":220,"wires":[["f66104d5.41ab7"]]},{"id":"c35495e6.e376e","type":"change","z":"10fde8b5.a8a82f","name":"Night hail","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-hail","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":330,"wires":[["7ee3a01.855406"]]},{"id":"e013d5fa.259aa8","type":"change","z":"10fde8b5.a8a82f","name":"Night fog","rules":[{"t":"set","p":"payload","pt":"msg","to":" wi wi-night-fog","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":490,"wires":[["ab299ec2.2bd1c"]]},{"id":"e3725a0e.43adb8","type":"ui_template","z":"10fde8b5.a8a82f","group":"d141f99f.9e6318","name":"Icons","order":7,"width":0,"height":0,"format":"<link href=\"https://fonts.googleapis.com/icon?family=Material+Icons\" rel=\"stylesheet\">\n<i class=\"wi wi-wu-nt_flurries\"></i>\n<link href=\"https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.10/css/weather-icons.min.css\" rel=\"stylesheet\">\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","x":960,"y":170,"wires":[[]]},{"id":"131947f4.de572","type":"template","z":"10fde8b5.a8a82f","name":"Icon","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<i class=\"wi wi-owm-{{payload.icon}}\"></i>","output":"str","x":1840,"y":2500,"wires":[[]]},{"id":"ea01de11.03a3e","type":"switch","z":"10fde8b5.a8a82f","name":"Thunderstorm","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"thunderstorm","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1310,"y":240,"wires":[["3f65d757.5766","efea611bd2cb6d6c"]]},{"id":"d8ea8dba.4395f","type":"switch","z":"10fde8b5.a8a82f","name":"Hail","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"hail","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":350,"wires":[["b7b5b9b9.375af8"]]},{"id":"44dad39d.b957cc","type":"switch","z":"10fde8b5.a8a82f","name":"Fog","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"fog","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":510,"wires":[["6173fca5.92bfec"]]},{"id":"e8436f1c.bdc92","type":"switch","z":"10fde8b5.a8a82f","name":"Rain","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"rain","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":690,"wires":[["0dacc3409d1d9eb9"]]},{"id":"36c6cc84.b80cac","type":"switch","z":"10fde8b5.a8a82f","name":"Clouds","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"cloud","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1290,"y":1080,"wires":[["1574d141.436ff7","8f8a1efb.3d823"]]},{"id":"9e41f2e4.e015e","type":"switch","z":"10fde8b5.a8a82f","name":"Clear","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"clear","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":1510,"wires":[["2c42bafb.9ca7ce","a03caa10.ce83c"]]},{"id":"7372e63f.cc2e48","type":"switch","z":"10fde8b5.a8a82f","name":"Windy?","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"clear","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1290,"y":1240,"wires":[[]]},{"id":"ec9203a5.91ceb8","type":"comment","z":"10fde8b5.a8a82f","name":"If you want to use the `icon` field","info":"","x":2520,"y":2500,"wires":[]},{"id":"a311f142.a12ba","type":"comment","z":"10fde8b5.a8a82f","name":"Needs work *","info":"This is now for ALL cloudy stuff.\n\nSo partly, broken and scattered are also in here","x":1300,"y":1050,"wires":[]},{"id":"1574d141.436ff7","type":"switch","z":"10fde8b5.a8a82f","name":"Type","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"broken","vt":"str"},{"t":"cont","v":"scattered","vt":"str"},{"t":"cont","v":"partly","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":1450,"y":1110,"wires":[["d475af60.586248"],["d475af60.586248"],["d475af60.586248"],["b3316a43.ffa098"]]},{"id":"22880cb5.690604","type":"comment","z":"10fde8b5.a8a82f","name":"Cloud coverage","info":"","x":2470,"y":2550,"wires":[]},{"id":"24151a93.78a12e","type":"delay","z":"10fde8b5.a8a82f","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1850,"y":2600,"wires":[[]]},{"id":"2784a6e1.9d52ba","type":"change","z":"10fde8b5.a8a82f","name":"found","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":2550,"wires":[["24151a93.78a12e"]]},{"id":"4710bf87.44d3d8","type":"link in","z":"10fde8b5.a8a82f","name":"Icon found","links":["14ffc572.d3c78b","1e77d751.41fac9","7e2dd661.f9e88","7ee3a01.855406","ab299ec2.2bd1c","c9ce0127.1b2fc8","f66104d5.41ab7","6473a6e.5b8a4d8"],"x":1245,"y":2550,"wires":[["2784a6e1.9d52ba","a8e99d56.7640b8"]]},{"id":"14ffc572.d3c78b","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2275,"y":1540,"wires":[]},{"id":"c9ce0127.1b2fc8","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2265,"y":1330,"wires":[]},{"id":"7e2dd661.f9e88","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2265,"y":1130,"wires":[]},{"id":"1e77d751.41fac9","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2265,"y":840,"wires":[]},{"id":"ab299ec2.2bd1c","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2265,"y":560,"wires":[]},{"id":"7ee3a01.855406","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2265,"y":400,"wires":[]},{"id":"f66104d5.41ab7","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2265,"y":310,"wires":[]},{"id":"441775b8.3d05c4","type":"switch","z":"10fde8b5.a8a82f","name":"Wind","property":"$parent.windstrength","propertyType":"flow","rules":[{"t":"eq","v":"NO","vt":"str"},{"t":"eq","v":"LIGHT","vt":"str"},{"t":"eq","v":"STRONG","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1700,"y":1300,"wires":[["8b807984.d95c08"],["e1d34ac8.0443f8"],["e1d34ac8.0443f8"]]},{"id":"e1d34ac8.0443f8","type":"change","z":"10fde8b5.a8a82f","name":"Partly cloudy","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-cloudy-windy","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1310,"wires":[["c9ce0127.1b2fc8"]]},{"id":"82fafc1a.b3e21","type":"delay","z":"10fde8b5.a8a82f","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":625,"y":240,"wires":[["b6c0418c.e3f6a8"]],"l":false},{"id":"33f1f1d7.891bde","type":"comment","z":"10fde8b5.a8a82f","name":"Rain intensity","info":"","x":2460,"y":2450,"wires":[]},{"id":"b3316a43.ffa098","type":"switch","z":"10fde8b5.a8a82f","name":"Wind","property":"$parent.windstrength","propertyType":"flow","rules":[{"t":"eq","v":"NO","vt":"str"},{"t":"eq","v":"LIGHT","vt":"str"},{"t":"eq","v":"STRONG","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1620,"y":1130,"wires":[["5cdd808a.0d6db8","8a604f63.d8f88"],["c9f5582e.c6d928"],["c9f5582e.c6d928"]]},{"id":"4fba7468.c48934","type":"change","z":"10fde8b5.a8a82f","name":"Partly cloudy","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-cloudy-windy","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1170,"wires":[["7e2dd661.f9e88"]]},{"id":"29732b22.a849bc","type":"fan","z":"10fde8b5.a8a82f","name":"Blah","x":1245,"y":2350,"wires":[["6c63bf11.09bb5","131947f4.de572","7ec7cb01.58578c"]],"l":false},{"id":"7ec7cb01.58578c","type":"change","z":"10fde8b5.a8a82f","name":"Wind speed","rules":[{"t":"set","p":"payload","pt":"msg","to":"$parent.wind","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1860,"y":2400,"wires":[["3347e292.2479fe"]]},{"id":"6762e30b.82bc7c","type":"switch","z":"10fde8b5.a8a82f","name":"type of rain","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"light","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1440,"y":690,"wires":[["977d1a4f.6190e"],["3489e3d8.8c2474"]]},{"id":"977d1a4f.6190e","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":680,"wires":[["bd087fda.40cab8"],["bd087fda.40cab8"],["c67bbc79.6116a8"]]},{"id":"c67bbc79.6116a8","type":"change","z":"10fde8b5.a8a82f","name":"Day rain","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-sprinkle","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":700,"wires":[["1e77d751.41fac9"]]},{"id":"59c4e660.70a7a8","type":"comment","z":"10fde8b5.a8a82f","name":"Light","info":"","x":1850,"y":610,"wires":[]},{"id":"bd087fda.40cab8","type":"change","z":"10fde8b5.a8a82f","name":"Night rain","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-showers","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2030,"y":660,"wires":[["1e77d751.41fac9"]]},{"id":"3489e3d8.8c2474","type":"switch","z":"10fde8b5.a8a82f","name":"Wind strength","property":"$parent.windstrength","propertyType":"flow","rules":[{"t":"eq","v":"NO","vt":"str"},{"t":"eq","v":"LIGHT","vt":"str"},{"t":"eq","v":"STRONG","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1550,"y":780,"wires":[["6abc41b9.d7ed4","98a4215b.6a1ef"],["8bbff73b.e2e4a"],[]]},{"id":"8bbff73b.e2e4a","type":"change","z":"10fde8b5.a8a82f","name":"Day rain wind","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-day-rain-wind","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2050,"y":860,"wires":[["1e77d751.41fac9"]]},{"id":"e779ead8.7386e8","type":"link out","z":"10fde8b5.a8a82f","name":"","links":["d259347a.92e9c8","1838a6c5.1ddd69"],"x":625,"y":290,"wires":[]},{"id":"1838a6c5.1ddd69","type":"link in","z":"10fde8b5.a8a82f","name":"","links":["e779ead8.7386e8"],"x":1245,"y":2510,"wires":[["631ca14d.1d41c","24151a93.78a12e"]]},{"id":"79b1ce9.789c23","type":"switch","z":"10fde8b5.a8a82f","name":"Drizzle","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"drizzle","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":930,"wires":[["4f81c64b.4d467"]]},{"id":"7b505321.2343ac","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":930,"wires":[["b12861e9.c712c"],["b12861e9.c712c"],["2d19f161.e486b6"]]},{"id":"4f81c64b.4d467","type":"function","z":"10fde8b5.a8a82f","name":"type of...","func":"//var clouds = flow.get(\"clouds\")\nvar clouds = msg.data.clouds;\nif (clouds == undefined)\n{clouds = 0;}\n\nif (clouds < 50)\n{\n msg.payload = \"wi wi-day-sprinkle\";\n} else\n{\n msg.payload = \"wi wi-sprinkle\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1680,"y":930,"wires":[["7b505321.2343ac"]]},{"id":"b12861e9.c712c","type":"change","z":"10fde8b5.a8a82f","name":"night sprinkle","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-sprinkle","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":920,"wires":[["1e77d751.41fac9"]]},{"id":"de695626.0b0eb","type":"comment","z":"10fde8b5.a8a82f","name":"Wind Speed","info":"","x":2460,"y":2400,"wires":[]},{"id":"8f529e80.3778b8","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":1700,"wires":[["c790fb1.e0ea508"],["c790fb1.e0ea508"],["b1591fa0.61913"]]},{"id":"82338e47.aeedb","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"3","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1860,"y":1740,"wires":[[]]},{"id":"b1591fa0.61913","type":"change","z":"10fde8b5.a8a82f","name":"Snow","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-darksky-snow","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2020,"y":1720,"wires":[["6473a6e.5b8a4d8"]]},{"id":"c790fb1.e0ea508","type":"change","z":"10fde8b5.a8a82f","name":"Snow (night)","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-snow","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1680,"wires":[["6473a6e.5b8a4d8"]]},{"id":"2d3c69ea.f6728e","type":"comment","z":"10fde8b5.a8a82f","name":"Snow","info":"","x":1580,"y":1700,"wires":[]},{"id":"83473f32.c036d8","type":"switch","z":"10fde8b5.a8a82f","name":"Snow","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"snow","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":1700,"wires":[["8f529e80.3778b8","82338e47.aeedb"]]},{"id":"6473a6e.5b8a4d8","type":"link out","z":"10fde8b5.a8a82f","name":"Icon found","links":["4710bf87.44d3d8"],"x":2275,"y":1730,"wires":[]},{"id":"8f8a1efb.3d823","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"6","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1460,"y":1160,"wires":[[]]},{"id":"631ca14d.1d41c","type":"trigger","z":"10fde8b5.a8a82f","name":"Message","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1350,"y":2470,"wires":[[]]},{"id":"a8e99d56.7640b8","type":"trigger","z":"10fde8b5.a8a82f","name":"Found","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1340,"y":2610,"wires":[[]]},{"id":"3beba12.b00ef5e","type":"trigger","z":"10fde8b5.a8a82f","name":"Message received","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":700,"y":340,"wires":[[]]},{"id":"3347e292.2479fe","type":"function","z":"10fde8b5.a8a82f","name":"","func":"if (msg.payload == undefined)\n{\n msg.payload = \"None\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2080,"y":2400,"wires":[[]]},{"id":"accee246.bf592","type":"comment","z":"10fde8b5.a8a82f","name":"Read me *","info":"Work is needed on\n`msg.data.clouds.all`\nto control icon displayed.","x":730,"y":180,"wires":[]},{"id":"c9f5582e.c6d928","type":"switch","z":"10fde8b5.a8a82f","name":"Night / Day","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1870,"y":1150,"wires":[["b4b37e81.224e8"],["b4b37e81.224e8"],["4fba7468.c48934"]]},{"id":"b4b37e81.224e8","type":"change","z":"10fde8b5.a8a82f","name":"Partly cloudy","rules":[{"t":"set","p":"payload","pt":"msg","to":"wi wi-night-alt-cloudy-windy","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":1130,"wires":[["7e2dd661.f9e88"]]},{"id":"2d19f161.e486b6","type":"function","z":"10fde8b5.a8a82f","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2095,"y":960,"wires":[["1e77d751.41fac9"]],"l":false},{"id":"efea611bd2cb6d6c","type":"trigger","z":"10fde8b5.a8a82f","name":"","op1":"close","op2":"open","op1type":"str","op2type":"str","duration":"2","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1245,"y":610,"wires":[["cac280363f08f4ca"]],"l":false},{"id":"cac280363f08f4ca","type":"change","z":"10fde8b5.a8a82f","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1305,"y":610,"wires":[["0dacc3409d1d9eb9"]],"l":false},{"id":"0dacc3409d1d9eb9","type":"gate","z":"10fde8b5.a8a82f","name":"A","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"","persist":false,"x":1400,"y":610,"wires":[["6762e30b.82bc7c"]]},{"id":"03cbcdc7380cb7d7","type":"switch","z":"10fde8b5.a8a82f","name":"some","property":"payload.detail","propertyType":"msg","rules":[{"t":"cont","v":"some","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":200,"wires":[["3f65d757.5766"]]},{"id":"d141f99f.9e6318","type":"ui_group","name":"Default","tab":"a770f02a.b6e3c8","order":1,"disp":true,"width":"9","collapse":false},{"id":"a770f02a.b6e3c8","type":"ui_tab","name":"TEST","icon":"dashboard","order":4,"disabled":false,"hidden":false},{"id":"fbbc64a4.0fc378","type":"subflow:10fde8b5.a8a82f","z":"ae12fd.00ef75","g":"15150d0b.44e5eb","name":"","env":[],"x":1000,"y":700,"wires":[["c8f260f5.3c267"],["c8f260f5.3c267"],["c8f260f5.3c267","b846295d.f0c478"],["c8f260f5.3c267"],["c8f260f5.3c267"],["c8f260f5.3c267"],["c8f260f5.3c267"],["c8f260f5.3c267"],["a3fabe2d.254e4"],[],["b846295d.f0c478"],["aaf09676.dea5a8"],["3ed59a5f.ab1de6","a35ddd74.b80e18"]]}]

```

And!

It's a bit of a _dog's breakfast_ in it's ~~working~~ layout.

I put a bit of stuff in it to maybe stop/block any _rain_ message getting through if `thunderstorm` is mentioned, as `rain` may also be in the message and so I don't get the _correct_ (desired?) icon.

---

<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:** [9 September 2022 07:40 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/8 "2022-09-09T07:40:50Z")

</div>

Why do you think it is a problem to add a `debug` node in a subflow? Just double click on the subflow and it will open in a new tab, then you can add the `debug`, deploy and test.

---

<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:** [9 September 2022 07:42 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/9 "2022-09-09T07:42:20Z")

</div>

But aren't `debug` nodes disabled in subflows?

That's what I thought.... But you know what thought did. 😉

 ![Screenshot from 2022-09-09 17-44-15](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/3335b1cbd6d5fe6c855bd9d11c59592b2229727c.png)

No output from that debug node.

`LOOK FOR ME`

---

<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:** [9 September 2022 07:48 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/10 "2022-09-09T07:48:41Z")

</div>

Try changing the deploy option from 'Modified Nodes` to 'Modified Flows'  
also, you can add a debug node to a subflow, you just can't change it once it is there.

---

<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:** [9 September 2022 07:54 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/11 "2022-09-09T07:54:10Z")

</div>

Tried it, but still not seeing any output from the `debug` node.

But you can see the details from the `function` node's `node.warn()` line.

You can see `thunderstorm` clearly shown. (for the next `switch` 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:** [9 September 2022 08:04 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/12 "2022-09-09T08:04:29Z")

</div>

1. What version of node-red and node.js? (You can get it from the startup log)
2. what device is NR running on?
3. what is is it using?

---

<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:** [9 September 2022 08:06 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/13 "2022-09-09T08:06:00Z")

</div>

NR 2.1.3  
node-js:

```auto
pi@BedPi:~ $ node -v
v12.22.1
pi@BedPi:~ $ 

```

(Sorry original post was from wrong machine)

RasPi 3B Buster

Oh, and the weather is from `openweathermap` node. But I now realise that is OUTSIDE the subflow.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 September 2022 08:19 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/14 "2022-09-09T08:19:17Z")

</div>

The best way to manage debug from a subflow is to add a new output (or outputs) to the subflow and feed the message you want to see to that output. Then put the debug node outside the subflow on the particular instance you are debugging.

---

<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:** [9 September 2022 08:36 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/15 "2022-09-09T08:36:52Z")

</div>

Hmmmm.....

Weird things happening.

If I inject the _test_ message, it seems to fail.

But if I run it to get the real weather it works.

I shall have to wait until `thunderstorm` returns to the forecast and capture the message and use it for testing.

---

<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:** [9 September 2022 08:37 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/16 "2022-09-09T08:37:24Z")

</div>

Andrew, I just loaded your subflow to a similar Pi using NR 2.1.4 and I can add a `debug` node in the subflow and set if to display the complete msg object and deploy and it works fine.

The only thing is you can not turn off/on the `debug` node in the subflow by clicking the tab on the node.

Please put a `debug` node (set to display the complete msg object) on the output of the node `calling the subflow`. Then copy the entire value of the opject and paste it to a reply.  
 ![Screen Shot 2022-09-09 at 4.36.16 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/7/b79d5c4496bbc02c3a469ccf88357fbf09b40481.png)

> [@Trying\_to\_learn](#):
>
> If I inject the _test_ message, it seems to fail.

what is contained in the test message?

---

<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:** [9 September 2022 08:42 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/17 "2022-09-09T08:42:11Z")

</div>

The _test_ message has `msg.payload.detail` set to _contain_ `thunderstorm`. So it is set to `some thunderstorm detected`.

That is shown in the screen shots.

It also has a `sunrise` and `now` timestamp. Though that is actually a fixed number to stop sunset kicking in.

Hang on and I'll try it again.

(Maybe the `debug` _defaulted_ to being `OFF` rather than `ON`.)

---

<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:** [9 September 2022 08:49 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/18 "2022-09-09T08:49:51Z")

</div>

> [@Trying\_to\_learn](#):
>
> I shall have to wait until `thunderstorm` returns to the forecast and capture the message and use it for testing.

Why wait? Capture the output of the openweathermap node and put it in an inject node and edit it to contain 'thunderstorm' in it. Then you have an inject node that you can run over and over without hitting the openweatermap site. This is always a good idea when testing data from an external site.

---

<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:** [9 September 2022 08:56 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/19 "2022-09-09T08:56:17Z")

</div>

Ok, slow progress.

This message works.

```auto
{"_msgid":"6fd677201452872e","payload":{"id":803,"weather":"Clouds","detail":"broken clouds","icon":"04n","tempk":289.91,"tempc":16.7,"temp_maxc":18.3,"temp_minc":14.3,"humidity":77,"pressure":1010,"maxtemp":291.48,"mintemp":287.45,"windspeed":6.17,"winddirection":20,"location":"Ashfield","sunrise":1662667440,"sunset":1662709345,"clouds":56,"description":"The weather in Ashfield at coordinates: -33.8886, 151.1314 is Clouds (broken clouds)."},"topic":"","icon":"<i class=\"fa fa-refresh fa-spin\"></i>","background":"#333333","font":"red","location":{"lon":151.1314,"lat":-33.8886,"city":"Ashfield","country":"AU"},"data":{"coord":{"lon":151.1314,"lat":-33.8886},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"base":"stations","main":{"temp":289.91,"feels_like":289.65,"temp_min":287.45,"temp_max":291.48,"pressure":1010,"humidity":77},"visibility":10000,"wind":{"speed":6.17,"deg":20},"clouds":{"all":56},"dt":1662713323,"sys":{"type":2,"id":2046014,"country":"AU","sunrise":1662667440,"sunset":1662709345},"timezone":36000,"id":7839683,"name":"Ashfield","cod":200},"time":"2022-09-09T08:48:43.000Z","title":"Current Weather Information","description":"Current weather information at coordinates: -33.8886, 151.1314"}

```

This if from the first `debug` node in the subflow (again: see later)

```auto
{"_msgid":"6fd677201452872e","payload":{"id":803,"weather":"Clouds","detail":"broken clouds","icon":"04n","tempk":289.91,"tempc":16.7,"temp_maxc":18.3,"temp_minc":14.3,"humidity":77,"pressure":1010,"maxtemp":291.48,"mintemp":287.45,"windspeed":6.17,"winddirection":20,"location":"Ashfield","sunrise":1662667440,"sunset":1662709345,"clouds":56,"description":"The weather in Ashfield at coordinates: -33.8886, 151.1314 is Clouds (broken clouds)."},"topic":"","icon":"<i class=\"fa fa-refresh fa-spin\"></i>","background":"#333333","font":"red","location":{"lon":151.1314,"lat":-33.8886,"city":"Ashfield","country":"AU"},"data":{"coord":{"lon":151.1314,"lat":-33.8886},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"base":"stations","main":{"temp":289.91,"feels_like":289.65,"temp_min":287.45,"temp_max":291.48,"pressure":1010,"humidity":77},"visibility":10000,"wind":{"speed":6.17,"deg":20},"clouds":{"all":56},"dt":1662713323,"sys":{"type":2,"id":2046014,"country":"AU","sunrise":1662667440,"sunset":1662709345},"timezone":36000,"id":7839683,"name":"Ashfield","cod":200},"time":"2022-09-09T08:48:43.000Z","title":"Current Weather Information","description":"Current weather information at coordinates: -33.8886, 151.1314","base":{"wind":{"light":10,"strong":40}},"CloudThreshold":80,"now":1662713324358}

```

I get to see a message coming out of the `function` node in the subflow. (I'll get back to it shortly)

This one doesn't get through. Note: Does **NOT**.

```auto
{"_msgid":"2004c3d9a5b4ec38","payload":{"detail":"some thunderstorm detected","sunrise":1662667440,"sunset":1662709345},"now":1662713493347}

```

Ok, the `debug` nodes and their location/s.

 ![Screenshot from 2022-09-09 18-52-25](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e8251d8654182f4607c55f12a56565e113abf9f9.png)

`1` is the .... _input_ and `2` is the output - where things seem to be failing.

**BOTH** messages (the real one and the _test_ one) get to `1`.

Only the REAL one gets to `2`.

This is the code in the `function` node:

```auto
let now = parseInt(msg.now/1000);
msg.now = now;
//node.warn("Now " + now);

node.warn("Detail: " + msg.payload.detail);

let wind = msg.payload.windspeed;
node.status({text:wind});

//let low = flow.get("$parent.base.wind.light");
//let strong = flow.get("base.wind.strong");
let low = msg.base.wind.light;
let strong = msg.base.wind.strong;

if (wind < low)
{
    flow.set("windstrength","NO");
    node.status({text:"NO"});
}
if (wind > strong)
{
    flow.set("windstrength","LIGHT");
    node.status({text:"STRONG"});
}
if (wind > strong)
{
    flow.set("windstrength","STRONG");
    node.status({text:"STRONG"});
}

return msg;

```

Forgive the comments, but that is how it is.

What happens if parts of the message (eg: `let low = msg.base.wind.light;`) doesn't exist?

---

<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:** [9 September 2022 08:58 UTC](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504/20 "2022-09-09T08:58:17Z")

</div>

> [@zenofmud](#):
>
> Why wait? Capture the output of the openweathermap node and put it in an inject node and edit it to contain 'thunderstorm' in it. Then you have an inject node that you can run over and over without hitting the openweatermap site. This is always a good idea when testing data from an external site.

I think you don't understand.

For a while `thunderstorm` was in the forecast.  
Now it isn't.

So I can't capture the output and put it in an inject node..... If the message has since changed and doesn't contain the wanted word: `thunderstorm`.

I am _faking_ a message with the word in the correct part/path.

But it seems there are other things _missing_ and the fake message is not getting through/past the `function` node in the subflow.

[Next page](https://discourse.nodered.org/t/help-with-why-this-isnt-working/67504.md?page=2)
