node-red-contrib-iot-virtual-device
Version:
A set of nodes to help you create simulated IoT devices connected to IBM Watson IoT Platform.
90 lines (73 loc) • 3.02 kB
HTML
<!--
Copyright 2014, 2015, 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- stop virtual device-->
<script type="text/x-red" data-template-name="stop virtual device">
<div class="form-row">
<label for="node-input-name" style="width:130px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Turn On/Off" style="width:300px;">
</div>
<div class="form-row">
<label for="node-input-deviceId" style="width:130px;"><i class="fa fa-street-view"></i> Device Id</label>
<input type="text" id="node-input-deviceId" style="width:300px;">
</div>
<div class="form-row" id = "node-input-schema-div">
<label for="node-input-schema" id="node-input-schemaLabel" style="width:130px;"><i class="fa fa-sitemap"></i> Device Schema</label>
<input type="text" id="node-input-schema" style="width:300px;">
</div>
<div class="form-tips"><b>Tip:</b> Leave the device Id blank if you want to set it by using <b>msg.payload.deviceId</b>.</div>
</script>
<script type="text/x-red" data-help-name="stop virtual device">
<p>Deletes a virtual IoT device instance.</p>
<p>
<p>
<b>Important:</b> To use the out-of-the-box simulator dashboard, use an input link to connect this node to the <i>Stop Device</i> link in the simulator dashboard flow.
This connection lets the simulator dashboard delete devices directly via the simulator dashboard UI.
</p>
<ul>
<li><h4>Input:</h4>
<ul>
<li><code>msg.payload.deviceId</code>: The ID of the virtual device to delete.
</ul>
</li>
<li><h4>Output:</h4>
<ul>
<li><code>msg.payload.deviceId</code>: The deleted virtual device ID.</li>
<li><code>msg.payload.deviceType</code>: The deleted virtual device type.</li>
<li><code>msg.payload.properties</code>: Object with the properties and values of the deleted virtual device (e.g. {temperature: 20}).</li>
</ul>
</li>
</p>
<p>
<b>Note</b>: If the device does not exist, a warning is posted in the debug window, the flow stops, and no output is sent to the next node.
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('stop virtual device',{
category: 'Virtual_IoT_Device',
color:"#FF5050",
defaults: {
name: {value:""},
deviceId: {value:""},
schema: {type:"Device Schema", required: false}
},
inputs:1,
outputs:1,
icon: "vdStop.png",
label: function() {
return this.name || "stop virtual device";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
}
});
</script>