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/function/07 - Showing status information.json
2020-06-24 14:43:27 +01:00

1 line
2.0 KiB
JSON

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