node-red/packages/node_modules/@node-red/nodes/examples/function/switch/08 - Route message based on...

1 line
2.0 KiB
JSON

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