1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/packages/node_modules/@node-red/nodes/examples/function/switch/09 - Route message based on context value.json
2020-06-24 14:43:27 +01:00

1 line
2.7 KiB
JSON

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