node-red-contrib-wio-seeed
Version:
Wio Link Nodes using Grove modules for Node RED
79 lines (77 loc) • 2.2 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('wio-output', {
paletteLabel: 'output',
category: 'wio',
color: '#C0EDC0',
defaults: {
name: { value: '' },
connection: { type: 'wio-config' },
node: { value: '' },
port: { value: '' },
logic: { value: 'auto' }
},
inputs: 1,
outputs: 1,
icon: 'light.png',
label: function () {
return this.name || 'output';
},
oneditprepare: function () {
var config = this;
var skus = {
'3a9d9a84-8c59-11e5-8994-feff819cdc9f': {
name: 'Generic Digital Output',
module: 'GenericDOut'
},
'101020073': {
name: 'Grove Electromagnet',
module: 'GroveElecMagnet'
},
'103020005': {
name: 'Grove Relay',
module: 'GroveRelay'
},
'103020012': {
name: 'Grove SPDT Relay',
module: 'GroveSPDTRelay30A'
},
'103020014': {
name: 'Grove Dry Reed Relay',
module: 'GroveDryReedRelay'
}
};
$.getScript('wio-common').done(function (res) {
WioCommon(config, skus);
});
}
});
</script>
<script type="text/x-red" data-template-name="wio-output">
<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-connection"><i class="icon-tag"></i> Connection</label>
<select type="text" id="node-input-connection"></select>
</div>
<div class="form-row">
<label for="node-input-node"><i class="icon-tag"></i> Node</label>
<select type="text" id="node-input-node"></select>
</div>
<div class="form-row">
<label for="node-input-port"><i class="icon-tag"></i> Port</label>
<select type="text" id="node-input-port"></select>
</div>
<div class="form-row">
<label for="node-input-logic"><i class="icon-tag"></i> Logic</label>
<select type="text" id="node-input-logic">
<option value="auto">Auto</option>
<option value="on">On</option>
<option value="off">Off</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="wio-output">
<p>Wio Output</p>
</script>