node-red-contrib-azure-iot-device-enhanced
Version:
Production-ready Node-RED Azure IoT Device node with enhanced reliability, infinite reconnection, and comprehensive error handling. This is a fork of the original node-red-contrib-azure-iot-device by Eric van Uum, significantly enhanced by Payman Abbasian
1 lines • 2.4 kB
JSON
[{"id":"3c650c72.46f314","type":"azureiotdevice","z":"abde64b2.51e538","deviceid":"","connectiontype":"dps","authenticationmethod":"sas","iothub":"","isIotcentral":false,"scopeid":"","enrollmenttype":"group","saskey":"","certname":"","keyname":"","protocol":"mqtt","methods":[{"name":"turnOnLed"},{"name":"blink"},{"name":"turnOffLed"},{"name":"echo"},{"name":"countdown"}],"information":[{"name":"manufacturer","value":"Contoso Inc."}],"gatewayHostname":"","caname":"","x":610,"y":240,"wires":[["152e3d20.3c97d3","647e8204.9689bc"]]},{"id":"152e3d20.3c97d3","type":"debug","z":"abde64b2.51e538","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":180,"wires":[]},{"id":"50259ef3.8d50d","type":"inject","z":"abde64b2.51e538","name":"","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":true,"onceDelay":0.1,"x":190,"y":160,"wires":[["8764f585.5784f8"]]},{"id":"8764f585.5784f8","type":"function","z":"abde64b2.51e538","name":"telemetry","func":"msg = {\n 'topic': 'telemetry',\n 'payload': {'humidity': Math.round(10000*Math.random())/100,\n 'temperature': 20 + (Math.round(2500*Math.random())/100),\n 'pressure': 850 + (Math.round(35000*Math.random())/100)\n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":160,"wires":[["3c650c72.46f314"]]},{"id":"fddc2c55.3c7d1","type":"inject","z":"abde64b2.51e538","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":240,"wires":[["97da55db.2d8878"]]},{"id":"97da55db.2d8878","type":"function","z":"abde64b2.51e538","name":"properties","func":"msg = {\n 'topic': 'property',\n 'payload': { 'fanSpeed': {'value':120},\n 'voltage': {'value':5},\n 'current': {'value':55},\n 'irSwitch': {'value':true}\n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":240,"wires":[["3c650c72.46f314"]]},{"id":"647e8204.9689bc","type":"function","z":"abde64b2.51e538","name":"command response","func":"if (msg.topic == \"command\") {\n var response = {\n \"topic\": \"response\",\n \"requestId\": msg.payload.requestId,\n \"methodName\": msg.payload.methodName,\n \"status\": 200,\n \"payload\": msg.payload.payload\n };\n return response;\n}\n","outputs":1,"noerr":0,"x":630,"y":360,"wires":[["3c650c72.46f314"]]}]