node-red-contrib-blynk-iot
Version:
Node Red integration with new Blynk IoT Platform
84 lines (75 loc) • 3.04 kB
HTML
<script type="text/javascript">
// eslint-disable-next-line func-names
(function () {
function validPin(tmppin) {
const tmpPin = parseInt(tmppin, 10);
if (Number.isInteger(tmpPin) && tmpPin >= 0 && tmpPin <= 255) {
return true;
}
return false;
}
function onEditPrepare() {
}
function onEditSave() {
}
function label() {
let pin = 'pin error';
const type = 'LCD';
if (validPin(this.pin)) {
pin = `Pin V${this.pin} - ${type}`;
}
return this.name || pin;
}
RED.nodes.registerType('blynk-iot-out-lcd', {
category: 'Blynk IoT',
paletteLabel: 'lcd',
defaults: {
name: { value: '' },
pin: { value: '', required: true, validate: RED.validators.regex(/^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/) },
client: { type: 'blynk-iot-client', required: true },
},
color: '#8be8c8',
icon: 'lcd.png',
align: 'right',
inputs: 1,
outputs: 0,
labelStyle() {
return this.name ? 'node_label_italic' : '';
},
label,
oneditsave: onEditSave,
oneditprepare: onEditPrepare,
});
}());
</script>
<!-- Blynk out Node - LCD -->
<script type="text/x-red" data-template-name="blynk-iot-out-lcd">
<div class="form-row" id="client-row">
<label for="node-input-client"><i class="fa fa-bookmark"></i> <span>Connection</span></label>
<input type="text" id="node-input-client">
</div>
<div class="form-row">
<label for="node-input-pin"><i class="fa fa-dot-circle-o"></i> <span>Virtual Pin</span></label>
<input type="number" id="node-input-pin" min="0" max="255" placeholder="pin">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
</script>
<script type="text/x-red" data-help-name="blynk-iot-out-lcd">
<p>Blynk LCD node.</p>
<p>For use with Blynk app LCD Widget in advanced mode.</p>
<p>Set <code>msg.text</code> to the text you want displayed.<br/>
Set <code>msg.y</code> to the line you want <code>text</code> it shown on (0,1), default 0.<br/>
Set <code>msg.x</code> to x position you want <code>text</code> it shown on (0,15), default 0.<br/>
Set <code>msg.text1</code> to the text you want displayed on second line.<br/>
Set <code>msg.y1</code> to the line you want <code>text1</code> it shown on (0,1), default 1.<br/>
Set <code>msg.x1</code> to x position you want <code>text1</code> it shown on (0,15), default 0.<br/>
Set <code>msg.clear</code> to <code>true</code> if you want to clear it before write.
</p>
<p class="form-tips">
Official documentation:
<a href="https://docs.blynk.io/en/blynk.apps/widgets-app#lcd">LCD</a>
<p>
</script>