node-red-contrib-blynk-ws
Version:
Node Red integration with Blynk App and Server through websockets
90 lines (83 loc) • 3.53 kB
HTML
<script type="text/javascript">
// eslint-disable-next-line func-names
(function () {
function onEditSave() {
}
function onEditPrepare() {
$('#node-input-queue').on('change', function onQueueChange() {
if (this.checked) {
$('#queue-details').show();
} else {
$('#queue-details').hide();
}
}).change();
}
function label() {
return this.name || 'notify';
}
RED.nodes.registerType('blynk-ws-out-notify', {
category: 'Blynk_ws',
paletteLabel: 'notify',
defaults: {
name: { value: '' },
client: { type: 'blynk-ws-client', required: true },
queue: { value: false },
rate: { value: 5 },
},
color: '#1BC17C',
icon: 'notify.png',
align: 'right',
inputs: 1,
outputs: 0,
labelStyle() {
return this.name ? 'node_label_italic' : '';
},
label,
oneditsave: onEditSave,
oneditprepare: onEditPrepare,
});
}());
</script>
<!-- Blynk out Node - Notify -->
<script type="text/x-red" data-template-name="blynk-ws-out-notify">
<div class="form-row" id="websocket-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-queue"><i class="fa fa-clock-o"></i> <span>Queue</span></label>
<input type="checkbox" id="node-input-queue" style="width: 30px;" >
<label style="width: 250px; opacity: 1;" for="node-input-queue">Enable queue messages with delay</label>
</div>
<div id="queue-details">
<div class="form-row">
<label for="node-input-rate"></label>
<label for="node-input-rate" style="width: 80px;margin-left: 30px;"><span>1 msg every</span></label>
<input type="text" id="node-input-rate" placeholder="5" style="text-align:end; width:40px !important">
<label for="node-input-rate" style="margin-left: 5px;"><span>seconds</span></label>
</div>
</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-ws-out-notify">
<p>Blynk Notify node.</p>
<p>For use with Blynk app Push Notifications Widget.</p>
<p>Notify node allows you to send push notification to your device.</p>
<p>Set <code>msg.payload</code> with the text of you want to notificate.</p>
<p>Set the "Queue" property to save messages in a queue. Message delivery is distributed over the configured period of time. The status shows the number of messages currently in the queue. Especially useful with Blynk Cloud server</p>
<p>
Limitations :
<ul>
<li>Maximum allowed body length is 120 symbols.</li>
<li>Only 1 notification per 5 seconds is allowed on Blynk Cloud.</li>
</ul>
</p>
<p>You can also use <code>{DEVICE_NAME}</code> placeholder for device name, that will be replaced by your device name on the server side.</p>
<p class="form-tips">
Official documentation:
<a href="https://gablau.dev/blynk-legacy-docs/#widgets-notifications-push-notifications">Push Notifications</a>
<p>
</script>