Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
node-red-contrib-azure-iot-central/samples/flow SenseHAT commands.json
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 lines (1 sloc)
2.28 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"a18e3709.68a298","type":"tab","label":"Rasp - HAT - Command","disabled":false,"info":""},{"id":"60e2d33b.d8d26c","type":"rpi-sensehat out","z":"a18e3709.68a298","name":"","x":650,"y":160,"wires":[]},{"id":"54183c23.99b6e4","type":"rpi-sensehat in","z":"a18e3709.68a298","name":"","motion":false,"env":true,"stick":false,"x":90,"y":260,"wires":[["3c0dcf86.64a1b","954a7927.aee1b8"]]},{"id":"3c0dcf86.64a1b","type":"delay","z":"a18e3709.68a298","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":300,"y":260,"wires":[["3d3aa6ab.21876a","b0f52563.d3a488"]]},{"id":"3d3aa6ab.21876a","type":"debug","z":"a18e3709.68a298","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":260,"wires":[]},{"id":"b0f52563.d3a488","type":"Azure IoT Central","z":"a18e3709.68a298","scopeid":"","deviceid":"","primarykey":"","command1":"turnLedOn","command2":"turnLedOff","command3":"","command4":"","command5":"","property1":"","property2":"","property3":"","property4":"","property5":"","transport":"mqtt","auth":"sas","certfile":"","certkeyfile":"","passwordi":"","x":510,"y":300,"wires":[[]]},{"id":"954a7927.aee1b8","type":"function","z":"a18e3709.68a298","name":"turnLedOn, turnLedOff","func":"\n// Create a commands with the same name 'turnOn' and 'turnOff'\n// in the Azure IoT Central node\nfunction turnLedOn(request, response) {\n node.log('Received asynchronous call to turn on LED');\n msg.payload = \"*,*,green\";\n response.send(200, (err) => {\n node.send(msg);\n if (err) {\n node.error('Unable to send method response: ' + err.toString());\n }\n });\n}\n\nfunction turnLedOff(request, response) {\n node.log('Received asynchronous call to turn off LED');\n msg.payload = \"*,*,off\";\n response.send(200, (err) => {\n node.send(msg);\n if (err) {\n node.error('Unable to send method response: ' + err.toString());\n }\n });\n}\n\n// Function handlers\nflow.set('turnLedOn',turnLedOn);\nflow.set('turnLedOff',turnLedOff);\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":120,"wires":[["60e2d33b.d8d26c","3d3aa6ab.21876a"]]}] |