1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge branch 'pr_2585' into examples

This commit is contained in:
Nick O'Leary 2020-06-24 13:50:50 +01:00
commit 5042137006
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
45 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1 @@
[{"id":"87bd706a.aec93","type":"comment","z":"3ae4b3d9.1f77bc","name":"Set message property to a fixed value","info":"Change node can set value to message payload.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/set-message-property-fixed).","x":210,"y":60,"wires":[]},{"id":"ac4c748f.fd1bc8","type":"inject","z":"3ae4b3d9.1f77bc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":180,"y":120,"wires":[["67974c84.7ca2c4"]]},{"id":"67974c84.7ca2c4","type":"change","z":"3ae4b3d9.1f77bc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Hello World!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":120,"wires":[["6b23a342.86d9cc"]]},{"id":"6b23a342.86d9cc","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"console":"false","complete":"false","x":590,"y":120,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"26e7643f.13ebcc","type":"comment","z":"f4cb1920.4d58c8","name":"Set any property value","info":"Change node can set value to any message property.","x":160,"y":60,"wires":[]},{"id":"4da2494d.9aff68","type":"inject","z":"f4cb1920.4d58c8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["5111e689.62e838"]]},{"id":"58ea5868.0596e8","type":"debug","z":"f4cb1920.4d58c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":120,"wires":[]},{"id":"5111e689.62e838","type":"change","z":"f4cb1920.4d58c8","name":"set payload & topic","rules":[{"t":"set","p":"payload","pt":"msg","to":"Hello, World!","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Title","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":120,"wires":[["58ea5868.0596e8"]]}]

View File

@ -0,0 +1 @@
[{"id":"a9039cda.3649e","type":"comment","z":"a808932c.4ca77","name":"Set value using JSONata","info":"Change node can set value to using JSONata expression.","x":170,"y":60,"wires":[]},{"id":"bdcdd579.cfe668","type":"inject","z":"a808932c.4ca77","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["28d110a7.ce3e2"]]},{"id":"c6677fa5.8c111","type":"debug","z":"a808932c.4ca77","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":120,"wires":[]},{"id":"28d110a7.ce3e2","type":"change","z":"a808932c.4ca77","name":"use JSONata","rules":[{"t":"set","p":"payload","pt":"msg","to":"Hello","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload & \", World!\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":120,"wires":[["c6677fa5.8c111"]]}]

View File

@ -0,0 +1 @@
[{"id":"e9143349.a64f7","type":"comment","z":"a32e6d69.1b13b","name":"Set value from environment variable","info":"Change node can set value from environment variable.","x":200,"y":60,"wires":[]},{"id":"a7c2725.a631f9","type":"inject","z":"a32e6d69.1b13b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["e455c302.2f795"]]},{"id":"6f203119.21895","type":"debug","z":"a32e6d69.1b13b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":120,"wires":[]},{"id":"e455c302.2f795","type":"change","z":"a32e6d69.1b13b","name":"set env var","rules":[{"t":"set","p":"payload","pt":"msg","to":"HOME","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":120,"wires":[["6f203119.21895"]]}]

View File

@ -0,0 +1 @@
[{"id":"6ecac54d.c43ffc","type":"comment","z":"87ace6c0.f01da8","name":"Set flow context","info":"Change node can set flow context.","x":140,"y":60,"wires":[]},{"id":"80e966d3.9d7a78","type":"inject","z":"87ace6c0.f01da8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":234,"wires":[["abaee298.2d77e"]]},{"id":"60ab671d.b0bbf8","type":"debug","z":"87ace6c0.f01da8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":234,"wires":[]},{"id":"abaee298.2d77e","type":"change","z":"87ace6c0.f01da8","name":"increment count","rules":[{"t":"set","p":"count","pt":"flow","to":"$flowContext(\"count\")+1\t","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"count","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":234,"wires":[["60ab671d.b0bbf8"]]},{"id":"2de2bb38.f20ff4","type":"inject","z":"87ace6c0.f01da8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":140,"wires":[["7b96521e.a3cb0c"]]},{"id":"597b63cd.b3218c","type":"debug","z":"87ace6c0.f01da8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":140,"wires":[]},{"id":"7b96521e.a3cb0c","type":"change","z":"87ace6c0.f01da8","name":"set count to 0","rules":[{"t":"set","p":"count","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"payload","pt":"msg","to":"count","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":140,"wires":[["597b63cd.b3218c"]]},{"id":"3d8cdc6d.2620e4","type":"comment","z":"87ace6c0.f01da8","name":"↓ Initialize","info":"","x":200,"y":100,"wires":[]},{"id":"d8069121.80de7","type":"comment","z":"87ace6c0.f01da8","name":"↓ Count up","info":"","x":200,"y":194,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"670fff8d.c60e2","type":"comment","z":"f000890e.5078a8","name":"Delete message property","info":"Change node can delete a message property.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/delete-message-property).","x":170,"y":60,"wires":[]},{"id":"6708b393.04895c","type":"inject","z":"f000890e.5078a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":180,"y":120,"wires":[["d8757f71.765a9"]]},{"id":"d8757f71.765a9","type":"change","z":"f000890e.5078a8","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":120,"wires":[["20c077b.e11c188"]]},{"id":"20c077b.e11c188","type":"debug","z":"f000890e.5078a8","name":"","active":true,"console":"false","complete":"false","x":590,"y":120,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"6e779a3b.4fdc24","type":"comment","z":"e4c6d5fb.1fd618","name":"Move message property","info":"Change node can move a message property to a different property.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/move-message-property).","x":170,"y":60,"wires":[]},{"id":"bae6cb28.2ac588","type":"inject","z":"e4c6d5fb.1fd618","name":"","topic":"Hello","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":200,"y":120,"wires":[["436d3311.248cdc"]]},{"id":"436d3311.248cdc","type":"change","z":"e4c6d5fb.1fd618","name":"","rules":[{"t":"move","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":120,"wires":[["7865b104.64061"]]},{"id":"7865b104.64061","type":"debug","z":"e4c6d5fb.1fd618","name":"","active":true,"console":"false","complete":"false","x":590,"y":120,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"87bd706a.aec93","type":"comment","z":"3ae4b3d9.1f77bc","name":"Delay message","info":"Delay node can delay sending input message to output port by a specified amount of time.","x":160,"y":60,"wires":[]},{"id":"1d17715c.34170f","type":"inject","z":"3ae4b3d9.1f77bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello, World!","payloadType":"str","x":210,"y":120,"wires":[["26b43de5.4df8f2","9930fecd.ee0c8"]]},{"id":"9930fecd.ee0c8","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":410,"y":120,"wires":[]},{"id":"26b43de5.4df8f2","type":"delay","z":"3ae4b3d9.1f77bc","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":180,"wires":[["c8c2796c.dcb9f8"]]},{"id":"c8c2796c.dcb9f8","type":"change","z":"3ae4b3d9.1f77bc","name":"Goodbye, World!","rules":[{"t":"set","p":"payload","pt":"msg","to":"Goodbye, World!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":180,"wires":[["c58a290e.2fa438"]]},{"id":"c58a290e.2fa438","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":180,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"c15b8c3e.955ed","type":"comment","z":"6f1773ed.b7c2fc","name":"Delay message by message property","info":"Delay node can delay sending input message to output port by a specified amount of time by `msg.delay` property.","x":210,"y":60,"wires":[]},{"id":"a5ed5817.9df448","type":"inject","z":"6f1773ed.b7c2fc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"delay","v":"1000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"delay 1s","payloadType":"str","x":180,"y":120,"wires":[["5cf53f4.25b7ec","59b7b67a.a8e888"]]},{"id":"59b7b67a.a8e888","type":"debug","z":"6f1773ed.b7c2fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":390,"y":120,"wires":[]},{"id":"5cf53f4.25b7ec","type":"delay","z":"6f1773ed.b7c2fc","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":380,"y":180,"wires":[["fc989f41.c4114"]]},{"id":"fc989f41.c4114","type":"change","z":"6f1773ed.b7c2fc","name":"Goodbye, World!","rules":[{"t":"set","p":"payload","pt":"msg","to":"Goodbye, World!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":180,"wires":[["74ba3d1c.666034"]]},{"id":"74ba3d1c.666034","type":"debug","z":"6f1773ed.b7c2fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":180,"wires":[]},{"id":"6cdf7297.bf5a8c","type":"inject","z":"6f1773ed.b7c2fc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"delay 10s","payloadType":"str","x":180,"y":180,"wires":[["59b7b67a.a8e888","5cf53f4.25b7ec"]]}]

View File

@ -0,0 +1 @@
[{"id":"b0200f61.5efa5","type":"comment","z":"86a4fcf3.9f442","name":"Reset or flush pending message","info":"Delay node can reset or flush delayed message by sending it a message with `reset` or `flush` property.","x":170,"y":60,"wires":[]},{"id":"d5cd8991.e6d2e8","type":"inject","z":"86a4fcf3.9f442","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello, World!","payloadType":"str","x":170,"y":120,"wires":[["607f556b.3ec5fc","fd14cb.2044db38"]]},{"id":"fd14cb.2044db38","type":"debug","z":"86a4fcf3.9f442","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":370,"y":120,"wires":[]},{"id":"607f556b.3ec5fc","type":"delay","z":"86a4fcf3.9f442","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":360,"y":180,"wires":[["d1fc6763.2a30c8"]]},{"id":"d1fc6763.2a30c8","type":"change","z":"86a4fcf3.9f442","name":"Goodbye, World!","rules":[{"t":"set","p":"payload","pt":"msg","to":"Goodbye, World!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":180,"wires":[["15486d4a.80c6f3"]]},{"id":"15486d4a.80c6f3","type":"debug","z":"86a4fcf3.9f442","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":180,"wires":[]},{"id":"2b8b28c7.4c8978","type":"inject","z":"86a4fcf3.9f442","name":"reset","props":[{"p":"topic","vt":"str"},{"p":"reset","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":180,"wires":[["607f556b.3ec5fc"]]},{"id":"3a7e1bec.8bc3d4","type":"inject","z":"86a4fcf3.9f442","name":"flush","props":[{"p":"topic","vt":"str"},{"p":"flush","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":240,"wires":[["607f556b.3ec5fc"]]}]

View File

@ -0,0 +1 @@
[{"id":"2d14f1a7.e776ce","type":"comment","z":"39759fee.3ffb6","name":"Slow down messages passing through a flow","info":"Delay node can be used to slow down messages passing through a flow.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/rate-limit-messages).","x":230,"y":80,"wires":[]},{"id":"af78b43e.9817d8","type":"inject","z":"39759fee.3ffb6","name":"Inject Array","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[0,1,2,3,4,5,6,7,8,9]","payloadType":"json","x":190,"y":140,"wires":[["a35943e3.eaf0a"]]},{"id":"a35943e3.eaf0a","type":"split","z":"39759fee.3ffb6","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":330,"y":140,"wires":[["23eacc60.7290a4"]]},{"id":"23eacc60.7290a4","type":"delay","z":"39759fee.3ffb6","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":140,"wires":[["b5b7746a.53bf88"]]},{"id":"b5b7746a.53bf88","type":"debug","z":"39759fee.3ffb6","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":140,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"3dc5015b.96c97e","type":"comment","z":"73c00795.a13908","name":"Limit rate of message transfer for each topic","info":"Delay node can limit of message transmission from input to output port by a specified number of message per a specified time.\nIf `For each topic` is selected, messages are grouped by `msg.topic` value. When grouping messages by topic, intermediate messages are dropped and the last messages received sent.","x":210,"y":60,"wires":[]},{"id":"bdafe4c6.4d5658","type":"inject","z":"73c00795.a13908","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"topic\":\"apple\",\"payload\":1},{\"topic\":\"apple\",\"payload\":2},{\"topic\":\"apple\",\"payload\":3},{\"topic\":\"orange\",\"payload\":1},{\"topic\":\"orange\",\"payload\":2},{\"topic\":\"orange\",\"payload\":3},{\"topic\":\"banana\",\"payload\":1},{\"topic\":\"banana\",\"payload\":2},{\"topic\":\"banana\",\"payload\":3}]","payloadType":"json","x":150,"y":120,"wires":[["f86dc462.195818"]]},{"id":"e0bdfcc1.cdf48","type":"delay","z":"73c00795.a13908","name":"","pauseType":"timed","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":690,"y":120,"wires":[["29d8beea.6b37f2"]]},{"id":"29d8beea.6b37f2","type":"debug","z":"73c00795.a13908","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":120,"wires":[]},{"id":"f86dc462.195818","type":"split","z":"73c00795.a13908","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":290,"y":120,"wires":[["9feb3aac.616c38"]]},{"id":"9feb3aac.616c38","type":"change","z":"73c00795.a13908","name":"set topic&payload","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.topic","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["e0bdfcc1.cdf48"]]},{"id":"949199e8.89bc88","type":"comment","z":"73c00795.a13908","name":"↑ pass last message of each topic","info":"","x":740,"y":160,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"6a5f26a9.0cc2d8","type":"inject","z":"835cc8cc.b8cca8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello World!","payloadType":"str","x":190,"y":160,"wires":[["fc2b343c.bbe2f8"]]},{"id":"fc2b343c.bbe2f8","type":"exec","z":"835cc8cc.b8cca8","command":"echo","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":330,"y":160,"wires":[["2f3bcd73.6fedf2"],[],["3280586e.4e3d28"]]},{"id":"2f3bcd73.6fedf2","type":"debug","z":"835cc8cc.b8cca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":160,"wires":[]},{"id":"2b7bc9f1.ab36a6","type":"comment","z":"835cc8cc.b8cca8","name":"Execute external command appending additional args","info":"Exec node can execute external command and can receive its standard output as a payload of first message. Standard error output can be received from second message. The exit code of the command can be obtained from `code` property of third message payload.\n\nIf `Append msg.payload` checkbox is selected, payload value of the input message is appended to command string.\n","x":260,"y":60,"wires":[]},{"id":"3280586e.4e3d28","type":"debug","z":"835cc8cc.b8cca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":220,"wires":[]},{"id":"feba83da.8f227","type":"comment","z":"835cc8cc.b8cca8","name":"↓ execute echo command","info":"","x":390,"y":115,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"f507b27c.fff1","type":"inject","z":"462f83a6.d3c3cc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":180,"wires":[["28b4f75a.eae548"]]},{"id":"28b4f75a.eae548","type":"exec","z":"462f83a6.d3c3cc","command":"/non/existing/command","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":350,"y":180,"wires":[[],["27992c1f.a1c964"],["6e7ff001.2412d"]]},{"id":"6e7ff001.2412d","type":"debug","z":"462f83a6.d3c3cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":240,"wires":[]},{"id":"27992c1f.a1c964","type":"debug","z":"462f83a6.d3c3cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":180,"wires":[]},{"id":"77e85c7c.a560d4","type":"comment","z":"462f83a6.d3c3cc","name":"Execute external command and get error output","info":"Exec node can execute external command and can receive its standard output as a payload of first message. Standard error output can be received from second message. The exit code of the command can be obtained from `code` property of third message payload.\n","x":220,"y":80,"wires":[]},{"id":"c188c28c.f7d34","type":"comment","z":"462f83a6.d3c3cc","name":"↓ try to execute non-existing command","info":"","x":390,"y":134,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"2e7be550.92ddfa","type":"inject","z":"a7f52169.f6c4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":160,"wires":[["53a714a8.1214dc"]]},{"id":"53a714a8.1214dc","type":"exec","z":"a7f52169.f6c4","command":"/bin/sh -c \"while true; do echo Hello; sleep 2; done\"","addpay":false,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"Repeat message output","x":410,"y":160,"wires":[["d1815f06.463f3"],["322d9b72.fc9194"],["2dbf8e03.2d6a52"]]},{"id":"7f351806.547908","type":"comment","z":"a7f52169.f6c4","name":"Execute external command in spawn mode","info":"Exec node can execute external command and can receive its standard output as a payload of first message. Standard error output can be received from second message. The exit code of the command can be obtained from `code` property of third message payload.\n\nIf `spawn mode` is selected, exec node returns the output as the command runs. \n\nSending `msg.kill` will kill a active process.\n\n*This example only works on UNIX flavored system.*","x":230,"y":60,"wires":[]},{"id":"2dbf8e03.2d6a52","type":"debug","z":"a7f52169.f6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":200,"wires":[]},{"id":"d1815f06.463f3","type":"debug","z":"a7f52169.f6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":120,"wires":[]},{"id":"28467ba9.c96284","type":"comment","z":"a7f52169.f6c4","name":"↓ spawn mode: repeat message output","info":"","x":450,"y":114,"wires":[]},{"id":"322d9b72.fc9194","type":"debug","z":"a7f52169.f6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":160,"wires":[]},{"id":"d5a990ce.c660b","type":"inject","z":"a7f52169.f6c4","name":"Kill process","props":[{"p":"kill","v":"","vt":"date"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":220,"wires":[["53a714a8.1214dc"]]}]

View File

@ -0,0 +1 @@
[{"id":"ec5a531b.68b65","type":"inject","z":"90acd374.2feda","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"World","payloadType":"str","x":150,"y":100,"wires":[["961abba6.04a028"]]},{"id":"1b0f8c3e.1fd7e4","type":"debug","z":"90acd374.2feda","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":100,"wires":[]},{"id":"4e5bf6b2.b4dd58","type":"comment","z":"90acd374.2feda","name":"send a message to output port","info":"Function node can be used to write JavaScript code to handle messages.\nThe input message can be referrenced by `msg` variable. \nA message returned from body of the function is sent to output port.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":170,"y":40,"wires":[]},{"id":"961abba6.04a028","type":"function","z":"90acd374.2feda","name":"return a message","func":"// returning message send it to output port\nmsg.payload = \"Hello, \"+msg.payload +\"!\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330,"y":100,"wires":[["1b0f8c3e.1fd7e4"]]}]

View File

@ -0,0 +1 @@
[{"id":"c2b3b0f1.62189","type":"inject","z":"b4c03214.fa42e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":100,"wires":[["7241db1e.8946c4"]]},{"id":"c6191361.0f3c","type":"debug","z":"b4c03214.fa42e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":80,"wires":[]},{"id":"3aa5727c.e5019e","type":"comment","z":"b4c03214.fa42e","name":"send multiple message","info":"Function node can send multiple messages to output ports by returning an array of messages. \n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":140,"y":40,"wires":[]},{"id":"7241db1e.8946c4","type":"function","z":"b4c03214.fa42e","name":"return array of messages","func":"// returning array of message send elements to output ports\nvar msg1 = { payload:\"first out of output 1\" };\nvar msg2 = { payload:\"second out of output 1\" };\nvar msg3 = { payload:\"third out of output 1\" };\nvar msg4 = { payload:\"only message from output 2\" };\nreturn [ [ msg1, msg2, msg3 ], msg4 ];","outputs":2,"noerr":0,"initialize":"","finalize":"","x":370,"y":100,"wires":[["c6191361.0f3c"],["23a53d00.c89b74"]]},{"id":"23a53d00.c89b74","type":"debug","z":"b4c03214.fa42e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":120,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"cc74476e.cbdf68","type":"inject","z":"e099b273.21259","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello, World!","payloadType":"str","x":190,"y":100,"wires":[["7d90286.706e9d8"]]},{"id":"909906c3.ea9f58","type":"debug","z":"e099b273.21259","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":100,"wires":[]},{"id":"d5fc0512.4cd9c8","type":"comment","z":"e099b273.21259","name":"sending messages asynchronously","info":"Function node can asynchronously send a messages to output ports by calling `node.send` function.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":200,"y":40,"wires":[]},{"id":"7d90286.706e9d8","type":"function","z":"e099b273.21259","name":"wait 2s then send message","func":"// setTimeout calls calls specified callback function asynchronously after a specified time\nsetTimeout(function () {\n node.send(msg);\n}, 2*1000);\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":100,"wires":[["909906c3.ea9f58"]]}]

View File

@ -0,0 +1 @@
[{"id":"64470964.a291a8","type":"inject","z":"d9fbb64b.577e08","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["ee4f5964.5cdae8"]]},{"id":"ed028c2f.924b","type":"debug","z":"d9fbb64b.577e08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":120,"wires":[]},{"id":"b1686e70.a9f6d","type":"comment","z":"d9fbb64b.577e08","name":"logging events","info":"In body of function node code, following logging functions can be used to log events:\n- `node.log`\n- `node.warn`\n- `node.error`\n- `node.trace`\n- `node.debug`\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":140,"y":60,"wires":[]},{"id":"ee4f5964.5cdae8","type":"function","z":"d9fbb64b.577e08","name":"log events","func":"// In function node, node.log, node.warn, and node.error functions can be used for logging\n// See debug sidebar and console output\nnode.log(\"Something happened\");\nnode.warn(\"Something happened you should know about\");\nnode.error(\"Oh no, something bad happened\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":120,"wires":[["ed028c2f.924b"]]}]

View File

@ -0,0 +1 @@
[{"id":"89c17d21.15da2","type":"inject","z":"dca895d.18be468","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["1bcca7af.619428"]]},{"id":"3b9cd70e.8e66e8","type":"debug","z":"dca895d.18be468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":120,"wires":[]},{"id":"f76ea68a.6f3c58","type":"comment","z":"dca895d.18be468","name":"handling errors","info":"Calling `node.error` function with the original message as a second argument, function node can trigger a catch node in the same tab.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":140,"y":60,"wires":[]},{"id":"1bcca7af.619428","type":"function","z":"dca895d.18be468","name":"report error","func":"// In function node, calling node.error functions with the original input message as its second argument triggers catch node\n// See debug sidebar and console output\nnode.error(\"Oh no, something bad happened\", msg);\n// execution should stops here","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":120,"wires":[["3b9cd70e.8e66e8"]]},{"id":"74854950.d99558","type":"catch","z":"dca895d.18be468","name":"","scope":["1bcca7af.619428"],"uncaught":false,"x":330,"y":180,"wires":[["32743f74.e718a"]]},{"id":"32743f74.e718a","type":"debug","z":"dca895d.18be468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":180,"wires":[]},{"id":"fb884166.e42f3","type":"comment","z":"dca895d.18be468","name":"↑ error information can be found in msg.error","info":"","x":630,"y":220,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"a3a635eb.191188","type":"inject","z":"97cd77e0.37c268","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":100,"wires":[["77f57d92.06fa14"]]},{"id":"1a218bea.61ae04","type":"debug","z":"97cd77e0.37c268","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":100,"wires":[]},{"id":"a56bde3a.330e1","type":"comment","z":"97cd77e0.37c268","name":"storing data in context","info":"The function node code can store data in the context store.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions) and [context store](https://nodered.org/docs/user-guide/context).","x":160,"y":40,"wires":[]},{"id":"77f57d92.06fa14","type":"function","z":"97cd77e0.37c268","name":"counter","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||0;\ncount += 1;\n// store the value back\ncontext.set('count',count);\n// make it part of the outgoing msg object\nmsg.payload = count;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":100,"wires":[["1a218bea.61ae04"]]}]

View File

@ -0,0 +1 @@
[{"id":"ce0b7cca.34817","type":"inject","z":"b8ceafb9.9c135","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"red","payloadType":"str","x":150,"y":100,"wires":[["a4a6c205.8afd4"]]},{"id":"c98c52d0.ab51f","type":"comment","z":"b8ceafb9.9c135","name":"showing status information","info":"The function node code can provide status decoration by calling `node.status` function.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":150,"y":40,"wires":[]},{"id":"a4a6c205.8afd4","type":"function","z":"b8ceafb9.9c135","name":"show status","func":"// calling node.status show status information below the function node\nswitch (msg.payload) {\n case \"red\":\n node.status({fill:\"red\",shape:\"ring\",text:\"disconnected\"});\n break;\n case \"green\":\n node.status({fill:\"green\",shape:\"dot\",text:\"connected\"});\n break;\n case \"text\":\n node.status({text:\"Just text status\"});\n break;\n case \"clear\":\n node.status({}); // to clear the status \n break;\n}\n\n","outputs":0,"noerr":0,"initialize":"","finalize":"","x":330,"y":100,"wires":[]},{"id":"9f29ae74.8dd11","type":"inject","z":"b8ceafb9.9c135","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"green","payloadType":"str","x":150,"y":140,"wires":[["a4a6c205.8afd4"]]},{"id":"83fc1404.ec0b98","type":"inject","z":"b8ceafb9.9c135","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"text","payloadType":"str","x":150,"y":180,"wires":[["a4a6c205.8afd4"]]},{"id":"517a869c.0ceab8","type":"inject","z":"b8ceafb9.9c135","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"clear","payloadType":"str","x":150,"y":220,"wires":[["a4a6c205.8afd4"]]}]

View File

@ -0,0 +1 @@
[{"id":"3ece1efd.306c22","type":"inject","z":"1b8d1c9a.2dae03","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["c9100743.673598"]]},{"id":"ed3da95d.62ee98","type":"debug","z":"1b8d1c9a.2dae03","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":120,"wires":[]},{"id":"85b5b8ad.0717d8","type":"comment","z":"1b8d1c9a.2dae03","name":"using external modules\\n(needs change in settings.js - see details on node description of this node) ","info":"The function node can use external node modules using global context value.\n\nAdditional node modules must be loaded in `settings.js` file and added to the `functionGlobalContext` property. \n\nFor example, following definition in `settings.js` load `os` module on start up of Node-RED. \n\n```\nfunctionGlobalContext: {\n os: require(\"os\")\n}\n```\n\nThe `os` module can be accessed in a function blocks as:\n```\nglobal.get(\"os\")\n```\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions) and [context store](https://nodered.org/docs/user-guide/context).","x":320,"y":60,"wires":[]},{"id":"c9100743.673598","type":"function","z":"1b8d1c9a.2dae03","name":"use os module","func":"// use external os module to access OS information\nvar os = global.get(\"os\");\nmsg.payload = { \n hostname: os.hostname(),\n arch: os.arch(),\n platform: os.platform(),\n release: os.release(),\n free: os.freemem()\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":120,"wires":[["ed3da95d.62ee98"]]}]

View File

@ -0,0 +1 @@
[{"id":"e397736b.a96af","type":"inject","z":"4829bfa2.a23c5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["900ad01c.561f"]]},{"id":"1e2a78d6.33f617","type":"debug","z":"4829bfa2.a23c5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":120,"wires":[]},{"id":"83d3f2fd.593b4","type":"comment","z":"4829bfa2.a23c5","name":"setup and close","info":"The function node code provide setup and closecode. \nThe `Setup` tab contains code that will be run whenever the node is started. The `Close` tab contains code that will be run when the node is stopped.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":140,"y":60,"wires":[]},{"id":"900ad01c.561f","type":"function","z":"4829bfa2.a23c5","name":"counter","func":"// get value of global counter\nvar count = global.get('count');\ncount += 1;\n// store the value back\nglobal.set('count',count);\n// make it part of the outgoing msg object\nmsg.payload = count;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"// initialize global counter\nglobal.set('count', 0);","finalize":"// report current counter to console\nvar count = global.get('count');\nconsole.log(\"count:\", count);","x":340,"y":120,"wires":[["1e2a78d6.33f617"]]}]

View File

@ -0,0 +1 @@
[{"id":"89904b80.4fcd08","type":"inject","z":"d44bc7c8.48eca8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":100,"wires":[["22c235a0.acb41a"]]},{"id":"20fa70dc.7107f","type":"debug","z":"d44bc7c8.48eca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":100,"wires":[]},{"id":"cddf88c9.9df018","type":"comment","z":"d44bc7c8.48eca8","name":"asynchronous setup","info":"The `Setup` code that performs asynchronous work can return a promise object of the work. The completion of the promise is waited before starting function body.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":150,"y":40,"wires":[]},{"id":"22c235a0.acb41a","type":"function","z":"d44bc7c8.48eca8","name":"async. setup","func":"// retrieve message value\nmsg.payload = global.get('message');\nreturn msg;","outputs":1,"noerr":0,"initialize":"// set initial value of message\nglobal.set(\"message\", \"Initializing, World!\");\n// create promise for async work\nvar promise = new Promise((resolve, reject) => {\n // async work: wait 1s, then set message\n setTimeout(() => {\n global.set(\"message\", \"Hello, World!\");\n // report this work successfuly ended\n resolve();\n }, 1000);\n});\n// return the promise that should be executed before function code\nreturn promise;","finalize":"","x":370,"y":100,"wires":[["20fa70dc.7107f"]]}]

View File

@ -0,0 +1 @@
[{"id":"827a48c0.912d88","type":"comment","z":"ff17dfa9.8fa6d","name":"Map property between different numeric ranges","info":"Range node can scale a number from one numeric range to another.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/map-between-different-number-ranges).","x":240,"y":60,"wires":[]},{"id":"bb23bd77.ce725","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"0","payloadType":"num","x":170,"y":120,"wires":[["42ed281c.790b38"]]},{"id":"42ed281c.790b38","type":"range","z":"ff17dfa9.8fa6d","minin":"0","maxin":"1023","minout":"0","maxout":"5","action":"clamp","round":false,"name":"","x":390,"y":160,"wires":[["56e6dd0f.436c24"]]},{"id":"54659d5c.0283e4","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"512","payloadType":"num","x":170,"y":160,"wires":[["42ed281c.790b38"]]},{"id":"85ce0127.07b06","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"1023","payloadType":"num","x":170,"y":200,"wires":[["42ed281c.790b38"]]},{"id":"56e6dd0f.436c24","type":"debug","z":"ff17dfa9.8fa6d","name":"","active":true,"console":"false","complete":"false","x":590,"y":160,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"990f33d3.3ffe2","type":"comment","z":"db89ae0c.f52b5","name":"Scale input value & round result to integer","info":"Range node can map input value to output value according to mapping specification.\nThe result value is rounded to nearest integer if `Round result to the nearest integer?` checkbox is checked.","x":240,"y":60,"wires":[]},{"id":"b2639501.5ad638","type":"inject","z":"db89ae0c.f52b5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":190,"y":120,"wires":[["dc4509ee.773038"]]},{"id":"dc4509ee.773038","type":"range","z":"db89ae0c.f52b5","minin":"0","maxin":"9","minout":"0","maxout":"128","action":"scale","round":true,"property":"payload","name":"","x":360,"y":120,"wires":[["50991e7e.2ed24"]]},{"id":"50991e7e.2ed24","type":"debug","z":"db89ae0c.f52b5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":520,"y":120,"wires":[]},{"id":"335e877f.d24e98","type":"inject","z":"db89ae0c.f52b5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":190,"y":160,"wires":[["dc4509ee.773038"]]},{"id":"5d88207d.4189","type":"inject","z":"db89ae0c.f52b5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"99","payloadType":"num","x":190,"y":200,"wires":[["dc4509ee.773038"]]}]

View File

@ -0,0 +1 @@
[{"id":"f0bc6a80.d52578","type":"comment","z":"bdb79f11.23e1d","name":"Limit input value","info":"Range node can map input value to output value according to mapping specification.\nThe result value is limited to specified range if `Scale and limit to the target range` is selected.","x":140,"y":60,"wires":[]},{"id":"69652849.749198","type":"inject","z":"bdb79f11.23e1d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":120,"wires":[["104f6f14.1c72e1"]]},{"id":"104f6f14.1c72e1","type":"range","z":"bdb79f11.23e1d","minin":"0","maxin":"100","minout":"0","maxout":"90","action":"clamp","round":false,"property":"payload","name":"","x":330,"y":120,"wires":[["10fcbed4.9c8d71"]]},{"id":"10fcbed4.9c8d71","type":"debug","z":"bdb79f11.23e1d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":500,"y":120,"wires":[]},{"id":"93bb4526.7d6e28","type":"inject","z":"bdb79f11.23e1d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":170,"y":160,"wires":[["104f6f14.1c72e1"]]},{"id":"6892dfd8.42386","type":"inject","z":"bdb79f11.23e1d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":170,"y":200,"wires":[["104f6f14.1c72e1"]]}]

View File

@ -0,0 +1 @@
[{"id":"808e354d.8de148","type":"comment","z":"b1446352.d689e","name":"Scale and wrap input value","info":"Range node can map input value to output value according to mapping specification.\nThe result value is wrapped if `Scale and wrap within the target range` is selected.","x":170,"y":60,"wires":[]},{"id":"2f033c72.51dcc4","type":"inject","z":"b1446352.d689e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":120,"wires":[["cdaa82c4.820de"]]},{"id":"cdaa82c4.820de","type":"range","z":"b1446352.d689e","minin":"0","maxin":"9","minout":"0","maxout":"90","action":"roll","round":false,"property":"payload","name":"","x":330,"y":120,"wires":[["77f8872b.2a9968"]]},{"id":"77f8872b.2a9968","type":"debug","z":"b1446352.d689e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":500,"y":120,"wires":[]},{"id":"84ac6a7e.77b8d8","type":"inject","z":"b1446352.d689e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":170,"y":160,"wires":[["cdaa82c4.820de"]]},{"id":"92f554c3.b08ad8","type":"inject","z":"b1446352.d689e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":170,"y":200,"wires":[["cdaa82c4.820de"]]}]

View File

@ -0,0 +1 @@
[{"id":"87bd706a.aec93","type":"comment","z":"3ae4b3d9.1f77bc","name":"Select output port based on input message value","info":"Switch node can route input message according to predefined rules.\n","x":260,"y":60,"wires":[]},{"id":"ec0f4187.0bf9e","type":"switch","z":"3ae4b3d9.1f77bc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"0","vt":"num"},{"t":"eq","v":"0","vt":"num"},{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":330,"y":140,"wires":[["e3d35f5a.ff33"],["91114621.cdd9b8"],["bcbd960b.2f4f48"]]},{"id":"903f0813.e99318","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":100,"wires":[]},{"id":"bcbd960b.2f4f48","type":"change","z":"3ae4b3d9.1f77bc","name":"Positive","rules":[{"t":"set","p":"payload","pt":"msg","to":"positive","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":180,"wires":[["efb63613.b0aa08"]]},{"id":"91114621.cdd9b8","type":"change","z":"3ae4b3d9.1f77bc","name":"Zero","rules":[{"t":"set","p":"payload","pt":"msg","to":"zero","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":140,"wires":[["6d4214c1.524a9c"]]},{"id":"e3d35f5a.ff33","type":"change","z":"3ae4b3d9.1f77bc","name":"Negative","rules":[{"t":"set","p":"payload","pt":"msg","to":"negative","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":100,"wires":[["903f0813.e99318"]]},{"id":"6d4214c1.524a9c","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":140,"wires":[]},{"id":"efb63613.b0aa08","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":180,"wires":[]},{"id":"398299e.aab0b66","type":"inject","z":"3ae4b3d9.1f77bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-10","payloadType":"num","x":190,"y":100,"wires":[["ec0f4187.0bf9e"]]},{"id":"dba0f204.13c4b","type":"inject","z":"3ae4b3d9.1f77bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":190,"y":140,"wires":[["ec0f4187.0bf9e"]]},{"id":"bcc219f0.48d8e8","type":"inject","z":"3ae4b3d9.1f77bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":190,"y":180,"wires":[["ec0f4187.0bf9e"]]}]

View File

@ -0,0 +1 @@
[{"id":"6ec19fc7.a32ae","type":"comment","z":"e482b0ab.b1b43","name":"Check all rules","info":"Switch node apply all rules if `checking all rules` is selected in settings panel.","x":120,"y":60,"wires":[]},{"id":"1644e138.f8d1ef","type":"switch","z":"e482b0ab.b1b43","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"10","vt":"num"},{"t":"gt","v":"-10","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":140,"wires":[["624b4e9f.37fee"],["a89d6432.b68318"]]},{"id":"a7f64dbf.3e27b","type":"debug","z":"e482b0ab.b1b43","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":100,"wires":[]},{"id":"a89d6432.b68318","type":"change","z":"e482b0ab.b1b43","name":">-10","rules":[{"t":"set","p":"payload","pt":"msg","to":">-10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":180,"wires":[["f1136da2.23516"]]},{"id":"624b4e9f.37fee","type":"change","z":"e482b0ab.b1b43","name":"<10","rules":[{"t":"set","p":"payload","pt":"msg","to":"<10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":100,"wires":[["a7f64dbf.3e27b"]]},{"id":"f1136da2.23516","type":"debug","z":"e482b0ab.b1b43","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":180,"wires":[]},{"id":"c7e952e9.88e5e","type":"inject","z":"e482b0ab.b1b43","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-10","payloadType":"num","x":150,"y":100,"wires":[["1644e138.f8d1ef"]]},{"id":"8cf8babd.b43db8","type":"inject","z":"e482b0ab.b1b43","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":150,"y":180,"wires":[["1644e138.f8d1ef"]]},{"id":"6a43ae86.b92ed","type":"inject","z":"e482b0ab.b1b43","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":140,"wires":[["1644e138.f8d1ef"]]}]

View File

@ -0,0 +1 @@
[{"id":"a12a5708.195688","type":"comment","z":"74b5d6de.372b18","name":"Stop after first match","info":"Switch node stops application of rules if `stopping after first match` is selected in settings panel and a rule evaluates to `true`.","x":160,"y":60,"wires":[]},{"id":"8aebdebf.5d7f2","type":"switch","z":"74b5d6de.372b18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"10","vt":"num"},{"t":"gt","v":"-10","vt":"num"}],"checkall":"false","repair":false,"outputs":2,"x":310,"y":140,"wires":[["5d1851c.a9c5db"],["e8228605.f32018"]]},{"id":"60248c98.69fd44","type":"debug","z":"74b5d6de.372b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":100,"wires":[]},{"id":"e8228605.f32018","type":"change","z":"74b5d6de.372b18","name":">-10","rules":[{"t":"set","p":"payload","pt":"msg","to":">-10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":180,"wires":[["e9a51608.c322b8"]]},{"id":"5d1851c.a9c5db","type":"change","z":"74b5d6de.372b18","name":"<10","rules":[{"t":"set","p":"payload","pt":"msg","to":"<10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":100,"wires":[["60248c98.69fd44"]]},{"id":"e9a51608.c322b8","type":"debug","z":"74b5d6de.372b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":180,"wires":[]},{"id":"49222b4b.647a84","type":"inject","z":"74b5d6de.372b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-10","payloadType":"num","x":170,"y":100,"wires":[["8aebdebf.5d7f2"]]},{"id":"39e8c133.a56f7e","type":"inject","z":"74b5d6de.372b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":170,"y":180,"wires":[["8aebdebf.5d7f2"]]},{"id":"3a22ec96.965a14","type":"inject","z":"74b5d6de.372b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":140,"wires":[["8aebdebf.5d7f2"]]}]

View File

@ -0,0 +1 @@
[{"id":"6dfd4381.eae2ec","type":"comment","z":"7d002985.82f928","name":"Select output based on type of payload value","info":"Switch node can route input message based on type of payload value.","x":210,"y":40,"wires":[]},{"id":"b139dacf.a0d818","type":"switch","z":"7d002985.82f928","name":"","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"string","vt":"string"},{"t":"istype","v":"number","vt":"number"}],"checkall":"false","repair":false,"outputs":2,"x":330,"y":120,"wires":[["7c5cd60c.e66b28"],["86cf5262.20f18"]]},{"id":"ca403f12.477a8","type":"debug","z":"7d002985.82f928","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":160,"wires":[]},{"id":"7c5cd60c.e66b28","type":"change","z":"7d002985.82f928","name":"String","rules":[{"t":"set","p":"payload","pt":"msg","to":"string","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":80,"wires":[["d9669648.1177e8"]]},{"id":"86cf5262.20f18","type":"change","z":"7d002985.82f928","name":"Number","rules":[{"t":"set","p":"payload","pt":"msg","to":"number","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":160,"wires":[["ca403f12.477a8"]]},{"id":"d9669648.1177e8","type":"debug","z":"7d002985.82f928","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":80,"wires":[]},{"id":"d3f1c718.dc67e8","type":"inject","z":"7d002985.82f928","name":"Number:128","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"128","payloadType":"num","x":170,"y":80,"wires":[["b139dacf.a0d818"]]},{"id":"a59e275e.6d48c8","type":"inject","z":"7d002985.82f928","name":"String:128","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"128","payloadType":"str","x":160,"y":160,"wires":[["b139dacf.a0d818"]]}]

View File

@ -0,0 +1 @@
[{"id":"175ceb0d.8dbe45","type":"comment","z":"17f634f4.e4bc9b","name":"Use JSONata expression for rules","info":"Switch node can use JSONata expression for calculating complex conditions.","x":200,"y":60,"wires":[]},{"id":"d89491c3.793a3","type":"switch","z":"17f634f4.e4bc9b","name":"","property":"payload","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"(payload % 2) = 0","vt":"jsonata"},{"t":"jsonata_exp","v":"(payload % 2) = 1","vt":"jsonata"}],"checkall":"false","repair":false,"outputs":2,"x":310,"y":140,"wires":[["d6cb78a6.872908"],["1f0c62bb.c3d52d"]]},{"id":"9ae9a2aa.a895c","type":"debug","z":"17f634f4.e4bc9b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":100,"wires":[]},{"id":"1f0c62bb.c3d52d","type":"change","z":"17f634f4.e4bc9b","name":"Odd","rules":[{"t":"set","p":"payload","pt":"msg","to":"odd","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":180,"wires":[["34b0a9fb.bafdb6"]]},{"id":"d6cb78a6.872908","type":"change","z":"17f634f4.e4bc9b","name":"Even","rules":[{"t":"set","p":"payload","pt":"msg","to":"even","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":100,"wires":[["9ae9a2aa.a895c"]]},{"id":"34b0a9fb.bafdb6","type":"debug","z":"17f634f4.e4bc9b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":180,"wires":[]},{"id":"7beb0333.a55bac","type":"inject","z":"17f634f4.e4bc9b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":170,"y":100,"wires":[["d89491c3.793a3"]]},{"id":"a8db47cf.58ba18","type":"inject","z":"17f634f4.e4bc9b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":170,"y":180,"wires":[["d89491c3.793a3"]]}]

View File

@ -0,0 +1 @@
[{"id":"1c09dc33.934504","type":"comment","z":"166069bc.648516","name":"Use JSONata expression for switch value","info":"Switch node can use JSONata expression for calculating complex switch value.","x":200,"y":60,"wires":[]},{"id":"c7ca4974.d638f8","type":"switch","z":"166069bc.648516","name":"","property":"(payload % 2) = 0","propertyType":"jsonata","rules":[{"t":"true"},{"t":"false"}],"checkall":"false","repair":false,"outputs":2,"x":290,"y":140,"wires":[["ac921b1d.c0dbe8"],["89adcfcc.53d6d"]]},{"id":"ab8972e0.e98b7","type":"debug","z":"166069bc.648516","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":100,"wires":[]},{"id":"89adcfcc.53d6d","type":"change","z":"166069bc.648516","name":"Odd","rules":[{"t":"set","p":"payload","pt":"msg","to":"odd","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":180,"wires":[["426c68cf.64f0e8"]]},{"id":"ac921b1d.c0dbe8","type":"change","z":"166069bc.648516","name":"Even","rules":[{"t":"set","p":"payload","pt":"msg","to":"even","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":100,"wires":[["ab8972e0.e98b7"]]},{"id":"426c68cf.64f0e8","type":"debug","z":"166069bc.648516","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":180,"wires":[]},{"id":"63377f1c.2fbfc","type":"inject","z":"166069bc.648516","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":150,"y":100,"wires":[["c7ca4974.d638f8"]]},{"id":"ea2fa596.ff1638","type":"inject","z":"166069bc.648516","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":150,"y":180,"wires":[["c7ca4974.d638f8"]]}]

View File

@ -0,0 +1 @@
[{"id":"61ee9b5c.b9e474","type":"comment","z":"c7e3a049.f68d8","name":"Recreate message sequence","info":"Switch node can recreate message sequence from input message sequence for each output port.","x":160,"y":60,"wires":[]},{"id":"e3a71ee7.ec465","type":"switch","z":"c7e3a049.f68d8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"str"},{"t":"else"}],"checkall":"true","repair":true,"outputs":2,"x":490,"y":140,"wires":[["f5f59cc2.a358f"],["ea61fc1e.afc62"]]},{"id":"5fd951bb.c150e","type":"debug","z":"c7e3a049.f68d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":100,"wires":[]},{"id":"cc02b428.9abb38","type":"debug","z":"c7e3a049.f68d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":180,"wires":[]},{"id":"5ad82808.648ef8","type":"inject","z":"c7e3a049.f68d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[3, -2, -1, 1, -3, 2]","payloadType":"json","x":180,"y":140,"wires":[["5f435601.bb9ef8"]]},{"id":"5f435601.bb9ef8","type":"split","z":"c7e3a049.f68d8","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":350,"y":140,"wires":[["e3a71ee7.ec465"]]},{"id":"f5f59cc2.a358f","type":"join","z":"c7e3a049.f68d8","name":"Positive","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":640,"y":100,"wires":[["5fd951bb.c150e"]]},{"id":"ea61fc1e.afc62","type":"join","z":"c7e3a049.f68d8","name":"Negative","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":640,"y":180,"wires":[["cc02b428.9abb38"]]}]

View File

@ -0,0 +1 @@
[{"id":"7ca55649.268c78","type":"comment","z":"7e4b3910.6cefb8","name":"Route a message based on one of its properties","info":"Switch node can route a message to different flows according to the value of any property (e.g. `msg.topic`).\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/route-on-property).","x":240,"y":60,"wires":[]},{"id":"f2cbd8ce.34c4c8","type":"switch","z":"7e4b3910.6cefb8","name":"Route ","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"temperature","vt":"str"},{"t":"eq","v":"humidity","vt":"str"},{"t":"eq","v":"pressure","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":370,"y":160,"wires":[["50651c06.281524"],["2786389.31cc5c8"],["e4db256d.a80ca8"]]},{"id":"c4de36a5.f14bc8","type":"inject","z":"7e4b3910.6cefb8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"temperature","payload":"27","payloadType":"num","x":180,"y":120,"wires":[["f2cbd8ce.34c4c8"]]},{"id":"96073ecd.9207f","type":"inject","z":"7e4b3910.6cefb8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"humidity","payload":"45","payloadType":"num","x":170,"y":160,"wires":[["f2cbd8ce.34c4c8"]]},{"id":"50651c06.281524","type":"debug","z":"7e4b3910.6cefb8","name":"Temperature","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":550,"y":120,"wires":[]},{"id":"2786389.31cc5c8","type":"debug","z":"7e4b3910.6cefb8","name":"Humidity","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":540,"y":160,"wires":[]},{"id":"e4db256d.a80ca8","type":"debug","z":"7e4b3910.6cefb8","name":"Pressure","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":540,"y":200,"wires":[]},{"id":"11b023ef.147c9c","type":"inject","z":"7e4b3910.6cefb8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"pressure","payload":"1001","payloadType":"num","x":170,"y":200,"wires":[["f2cbd8ce.34c4c8"]]}]

View File

@ -0,0 +1 @@
[{"id":"c619693c.5d47e8","type":"comment","z":"1851d301.c01c2d","name":"Route a message based on a context value","info":"Switch node can route a message to different flows according to the current value of a flow context property.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/route-on-context).","x":220,"y":60,"wires":[]},{"id":"fd7378.4448ec88","type":"inject","z":"1851d301.c01c2d","name":"Inject","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":180,"wires":[["85c9adae.e7d27"]]},{"id":"85c9adae.e7d27","type":"switch","z":"1851d301.c01c2d","name":"Context based routing","property":"state","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":400,"y":180,"wires":[["beb75c77.48c8c"],["ec521bae.6d9da8"],["46b7be29.5ee9b"]]},{"id":"beb75c77.48c8c","type":"debug","z":"1851d301.c01c2d","name":"Output 1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":640,"y":120,"wires":[]},{"id":"ec521bae.6d9da8","type":"debug","z":"1851d301.c01c2d","name":"Output 2","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":640,"y":180,"wires":[]},{"id":"46b7be29.5ee9b","type":"debug","z":"1851d301.c01c2d","name":"Output 3","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":640,"y":240,"wires":[]},{"id":"20591916.597ac6","type":"inject","z":"1851d301.c01c2d","name":"Set state 0","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":200,"y":260,"wires":[["d2c4662.6f8e098"]]},{"id":"22bf9e89.7f55f2","type":"inject","z":"1851d301.c01c2d","name":"Set state 1","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":200,"y":300,"wires":[["d2c4662.6f8e098"]]},{"id":"c2e46f80.42ee5","type":"inject","z":"1851d301.c01c2d","name":"Set state 2","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":200,"y":340,"wires":[["d2c4662.6f8e098"]]},{"id":"ff766a3e.5c5fe8","type":"inject","z":"1851d301.c01c2d","name":"Set state 3","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":200,"y":380,"wires":[["d2c4662.6f8e098"]]},{"id":"d2c4662.6f8e098","type":"change","z":"1851d301.c01c2d","name":"Set flow.state","rules":[{"t":"set","p":"state","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":300,"wires":[[]]}]

View File

@ -0,0 +1 @@
[{"id":"eaf91a6b.a55da8","type":"comment","z":"73a69428.bf4fec","name":"Advanced mustache example","info":"Template node can create a string value using [Mustache](http://mustache.github.io/mustache.5.html) syntax.","x":200,"y":80,"wires":[]},{"id":"61fbfe34.14a02","type":"inject","z":"73a69428.bf4fec","name":"Price of fruits","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Fruits","payload":"[{\"name\":\"apple\",\"price\":100},{\"name\":\"orange\",\"price\":80},{\"name\":\"banana\",\"price\":210}]","payloadType":"json","x":210,"y":140,"wires":[["bf0cb02.d8e4b5"]]},{"id":"bf0cb02.d8e4b5","type":"template","z":"73a69428.bf4fec","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"# Price List of {{topic}}\n\n{{! outputs list of prices }}\n{{#payload}}\n- {{name}}: {{price}}\n{{/payload}}\n","output":"str","x":380,"y":140,"wires":[["153eb0ff.5622df"]]},{"id":"153eb0ff.5622df","type":"debug","z":"73a69428.bf4fec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":140,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"fe821493.2e0e28","type":"comment","z":"1e6bd604.afc8fa","name":"Parse result as JSON","info":"Template node can create a string value using [Mustache](http://mustache.github.io/mustache.5.html) syntax.\nIf `Partsed JSON` output is selected, the created string is parsed as JSON format and JavaScript object is send as an output payload value.","x":160,"y":60,"wires":[]},{"id":"931f94e8.592cd8","type":"inject","z":"1e6bd604.afc8fa","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"message","payload":"Hello, World!","payloadType":"str","x":220,"y":120,"wires":[["bb2b0dad.b24b5"]]},{"id":"bb2b0dad.b24b5","type":"template","z":"1e6bd604.afc8fa","name":"JSON template","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"key\" : \"{{topic}}\",\n \"value\": \"{{payload}}\"\n}\n","output":"json","x":440,"y":120,"wires":[["baf2e48.2b97418"]]},{"id":"baf2e48.2b97418","type":"debug","z":"1e6bd604.afc8fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":120,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"6ad06659.a1e4e8","type":"comment","z":"369312e8.ba755e","name":"Parse result as YAML","info":"Template node can create a string value using [Mustache](http://mustache.github.io/mustache.5.html) syntax.\nIf `Partsed YAML` output is selected, the created string is parsed as YAML format and JavaScript object is send as an output payload value.","x":180,"y":60,"wires":[]},{"id":"8d6be9a2.c3fa58","type":"inject","z":"369312e8.ba755e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"message","payload":"Hello, World!","payloadType":"str","x":240,"y":120,"wires":[["69369c3.4a98164"]]},{"id":"69369c3.4a98164","type":"template","z":"369312e8.ba755e","name":"YAML template","field":"payload","fieldType":"msg","format":"yaml","syntax":"mustache","template":"key: {{topic}}\nvalue: {{payload}}","output":"yaml","x":460,"y":120,"wires":[["11fb2934.f5de27"]]},{"id":"11fb2934.f5de27","type":"debug","z":"369312e8.ba755e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":120,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"ec5a531b.68b65","type":"inject","z":"90acd374.2feda","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":100,"wires":[["cb5e0c78.4bf3d"]]},{"id":"1b0f8c3e.1fd7e4","type":"debug","z":"90acd374.2feda","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":100,"wires":[]},{"id":"cb5e0c78.4bf3d","type":"trigger","z":"90acd374.2feda","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":320,"y":100,"wires":[["1b0f8c3e.1fd7e4"]]},{"id":"4e5bf6b2.b4dd58","type":"comment","z":"90acd374.2feda","name":"Oputputs two values with interval","info":"Outputs 1. Then output 0 after a certain period of time.\n\n*This could be used, for example, to blink an LED attached to a Raspberry Pi GPIO pin.*","x":170,"y":40,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"87bd706a.aec93","type":"comment","z":"3ae4b3d9.1f77bc","name":"Trigger a flow if a message isn't received after a defined time","info":"Trigger node can be used to wait a specified amount of time to send a message.\n\nSee Node-RED [cookbook](https://cookbook.nodered.org/basic/trigger-timeout).","x":300,"y":60,"wires":[]},{"id":"b1b5829a.b43ff","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":550,"y":120,"wires":[]},{"id":"e4820019.7741b","type":"inject","z":"3ae4b3d9.1f77bc","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":120,"wires":[["cf16fb34.738f28","b1b5829a.b43ff"]]},{"id":"cf16fb34.738f28","type":"trigger","z":"3ae4b3d9.1f77bc","name":"Watchdog","op1":"","op2":"timeout","op1type":"nul","op2type":"str","duration":"5","extend":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":370,"y":160,"wires":[["124f656.5f0c09b"]]},{"id":"124f656.5f0c09b","type":"debug","z":"3ae4b3d9.1f77bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":550,"y":160,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"d55745be.e4ecd8","type":"inject","z":"bab6594e.d2a3d8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":140,"wires":[["ecac46bf.9751c8","cf35bbed.ce1298"]]},{"id":"ecac46bf.9751c8","type":"debug","z":"bab6594e.d2a3d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":140,"wires":[]},{"id":"cf35bbed.ce1298","type":"trigger","z":"bab6594e.d2a3d8","name":"","op1":"reset","op2":"true","op1type":"str","op2type":"bool","duration":"2","extend":true,"units":"s","reset":"","bytopic":"all","outputs":1,"x":320,"y":180,"wires":[["febbebba.455238"]]},{"id":"febbebba.455238","type":"trigger","z":"bab6594e.d2a3d8","name":"","op1":"0","op2":"0","op1type":"num","op2type":"str","duration":"-2","extend":false,"units":"s","reset":"reset","bytopic":"all","outputs":1,"x":480,"y":180,"wires":[["ecac46bf.9751c8"]]},{"id":"4bad6a7.9a1d194","type":"comment","z":"bab6594e.d2a3d8","name":"Send placeholder messages when a stream stops sending","info":"Trigger node can be used to detect when a message has not arrived after a defined interval and a second Trigger node to send the placeholder messages at a regular interval..\n\nSee Node-RED [cookbook](https://cookbook.nodered.org/basic/trigger-placeholder).","x":250,"y":80,"wires":[]}]

View File

@ -0,0 +1 @@
[{"id":"d24083e7.fedc7","type":"comment","z":"58cb85a8.82904c","name":"Timeout processing using trigger node","info":"It is possible to configure timeout processing by combining two Trigger nodes. \n\nIn the first Trigger node settings panel, `send second message to separate output` checkbox is checked. With this specification, this trigger node will have two output ports. When the node receives an input message, it outputs the message to the first port, and after a specified period of time, it outputs the specified message to the second port.\n\nThe second trigger node is specified to handle each message ID (`msg._msgid`). This means that only the first received message among the messages with the same ID is transmitted. The time specified for it represents the retention time of information for message filtering and must be longer than the processing time for the timeout.\n","x":190,"y":60,"wires":[]},{"id":"8dcb51d5.90fbb","type":"inject","z":"58cb85a8.82904c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":160,"wires":[["69b526f1.347808"]]},{"id":"3b2238f8.71f6c8","type":"debug","z":"58cb85a8.82904c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":870,"y":200,"wires":[]},{"id":"69b526f1.347808","type":"trigger","z":"58cb85a8.82904c","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"3","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":320,"y":200,"wires":[["3802c45b.84121c"],["a3c01d51.86cbb"]]},{"id":"7096b59a.c265fc","type":"trigger","z":"58cb85a8.82904c","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"10","extend":false,"units":"s","reset":"","bytopic":"topic","topic":"_msgid","outputs":1,"x":690,"y":200,"wires":[["3b2238f8.71f6c8"]]},{"id":"3802c45b.84121c","type":"function","z":"58cb85a8.82904c","name":"Target Process","func":"// Wait for a specified time period, then send a message.\n// Must preserve incoming message id.\nvar wait = msg.payload;\nsetTimeout(function() {\n msg.payload = \"done: \"+wait+\"s\";\n node.send(msg);\n}, wait*1000);\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":120,"wires":[["7096b59a.c265fc"]]},{"id":"a3c01d51.86cbb","type":"change","z":"58cb85a8.82904c","name":"Set timeout flag","rules":[{"t":"set","p":"payload","pt":"msg","to":"timeout","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":240,"wires":[["7096b59a.c265fc"]]},{"id":"ae217597.bedf88","type":"inject","z":"58cb85a8.82904c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":150,"y":240,"wires":[["69b526f1.347808"]]},{"id":"dc6f5bbe.dc8bd8","type":"comment","z":"58cb85a8.82904c","name":"↓ target process","info":"","x":500,"y":80,"wires":[]},{"id":"fe41a803.a14158","type":"comment","z":"58cb85a8.82904c","name":"↓ send second message after specified time","info":"","x":430,"y":160,"wires":[]},{"id":"fbb2dff0.0bacb","type":"comment","z":"58cb85a8.82904c","name":"↓ pass first message with same ID","info":"","x":760,"y":160,"wires":[]}]