add examples for function category nodes

This commit is contained in:
Hiroyasu Nishiyama
2020-06-01 14:44:18 +09:00
parent cbf1afc9fe
commit b67f2d874b
48 changed files with 48 additions and 0 deletions

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":[]}]