UNPKG

@tsib/node-red-azure-iot-hub-mod

Version:

Connector to azure on Node-Red

174 lines (162 loc) 6.19 kB
<script type="text/javascript"> RED.nodes.registerType('azureiothub-ot',{ category: 'cloud', color: '#00abec', defaults: { name: {value:"Azure IoT Hub"}, protocol: {value:"amqp"} }, inputs:1, outputs:2, outputLabels: function(index) { if (index === 0) return "message"; if (index === 1) return "directCall"; }, icon: "azureiothub.png", label: function() { return this.name||"Azure IoT Hub"; }, paletteLabel: function(){ return "Azure IoT Hub"; }, credentials: { hostname: {type:"text"} } }); RED.nodes.registerType('azureiothubregistry-ot',{ category: 'cloud', color: '#00abec', defaults: { name: {value:"Azure IoT Hub Registry"} }, inputs:1, outputs:1, icon: "azureiothub.png", label: function() { return this.name||"Azure IoT Hub Registry"; }, paletteLabel: function(){ return "Azure IoT Hub Registry"; }, credentials: { connectionString: {type:"text"} } }); RED.nodes.registerType('azureiothubreceiver-ot',{ category: 'cloud', color: '#00abec', defaults: { name: {value:"Azure IoT Hub Receiver"} }, inputs:0, outputs:1, icon: "azureiothub.png", label: function() { return this.name||"Azure IoT Hub Receiver"; }, paletteLabel: function(){ return "Azure IoT Hub Receiver"; }, credentials: { connectionString: {type:"text"} } }); RED.nodes.registerType('azureiothubdevicetwin-ot',{ category: 'cloud', color: '#00abec', defaults: { name: {value:"Azure IoT Hub Device Twin"} }, inputs:1, outputs:1, icon: "azureiothub.png", label: function() { return this.name||"Azure IoT Hub Device Twin"; }, paletteLabel: function(){ return "Azure IoT Hub Device Twin"; }, credentials: { connectionString: {type:"text"} } }); </script> <script type="text/x-red" data-template-name="azureiothub-ot"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-protocol"><i class="icon-tag"></i> Protocol</label> <select id="node-input-protocol"> <option>http</option> <option>amqp</option> <option>mqtt</option> <option>amqpWs</option> </select> </div> <div class="form-row"> <label for="node-input-hostname"><i class="fa fa-bookmark"></i> Hostname</label> <input type="text" id="node-input-hostname"> </div> </script> <script type="text/x-red" data-help-name="azureiothub-ot"> <p>A simple node that sends the message payloads to Azure IoT Hub</p> </script> <script type="text/x-red" data-template-name="azureiothubregistry-ot"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-connectionString"><i class="fa fa-bookmark"></i> connectionString</label> <input type="text" id="node-input-connectionString"> </div> </script> <script type="text/x-red" data-help-name="azureiothubregistry-ot"> <p>A simple node that registers devices with Azure IoT Hub</p> </script> <script type="text/x-red" data-help-name="azureiothubreceiver-ot"> <p>A simple node for receiving device-to-cloud messages via default Azure Events Hub endpoint.</p> </script> <script type="text/x-red" data-template-name="azureiothubreceiver-ot"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-connectionString"><i class="fa fa-bookmark"></i> connectionString</label> <input type="text" id="node-input-connectionString"> </div> </script> <script type="text/x-red" data-help-name="azureiothubdevicetwin-ot"> <p>A simple node for retrieving Azure IoT Hub Device Twin(s).</p> <h3>Inputs</h3> <dl class="message-properties"> <dt class="optional">payload <span class="property-type" >string</span> </dt> <dd>Optional deviceId specifier to retrieve only a specific Device Twin. If this property type is not defined or not a string, all Device Twins are retrieved.</dd> <h3>Outputs</h3> <dl class="message-properties"> <dt class="optional">payload <span class="property-type">object</span> </dt> <dd>Retrieved Device Twin(s) as an array.</dd> <dt class="optional">error <span class="property-type">object</span> </dt> <dd>Error encountered. If present, <code>msg.payload</code> is always undefined.</dd> <h3>Details</h3> <p>Each input with produce an output with either <code>msg.error</code> as error object or <code>msg.payload</code> as an array of Device Twin data.</p> </script> <script type="text/x-red" data-template-name="azureiothubdevicetwin-ot"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-connectionString"><i class="fa fa-bookmark"></i> connectionString</label> <input type="text" id="node-input-connectionString"> </div> </script>