node-red-contrib-s-tech-automation-tools
Version:
72 lines (68 loc) • 3.07 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('ST-MqttOut', {
category: 'S Tech tools',
color: '#FFD09D',
defaults: {
device: {value:null, required: true},
controls: {value:null, required: true},
command: {value:"on"},
locale:{value:"en-EN"},
wbserver: {value:"", type:"WB-MQTT-Server"}
},
inputs:1,
outputs:0,
icon: "S-Tech.png",
label: function(){
return "Mqtt out" + (this.device?":"+this.device:"") + (this.controls?"/"+this.controls:"");
},
oneditprepare: function() {
var userLocale = navigator.language || navigator.userLanguage;
document.getElementById('node-input-locale').value = userLocale;
},
oneditsave: function(){
this.device = $('#node-input-device').val();
this.controls = $('#node-input-controls').val();
this.command = $('#node-input-command').val();
this.wbserver = $('#node-input-wbserver').val();
}
});
</script>
<script type="text/x-red" data-template-name="ST-MqttOut">
<!-- <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name" >
</div> -->
<div class="form-row">
<label for="node-input-wbserver"><i class="fa fa-server"></i> Server</span></label>
<input type="text" id="node-input-wbserver">
</div>
<div class="form-row">
<label for="node-input-device"><i class="fa fa-server"></i> Device</span></label>
<input type="text" id="node-input-device">
</div>
<div class="form-row">
<label for="node-input-controls"><i class="fa fa-server"></i> Controls</span></label>
<input type="text" id="node-input-controls">
</div>
<div class="form-row">
<label for="node-input-command"><i class="fa fa-server"></i> Command</span></label>
<input type="text" id="node-input-command">
</div>
<div class="form-row">
<input id="node-input-locale" name="locale" type="hidden">
</div>
</script>
<script type="text/x-red" data-help-name="ST-MqttOut">
<p>Отправляет сообщение в MQTT топик в нотации Wiren Board.</p>
<h3>Конфигурация:</h3>
<ul>
<li><strong>Server</strong> - Выберете экземпляр сервера MQTT для использования.</li>
<li><strong>Device</strong> - Имя устройства для отправки сообщения.</li>
<li><strong>Controls</strong> - Имя контрола или контролов для отправки сообщения. Имена разделяются запятой.</li>
<li><strong>Command</strong> - Команда, по умолчанию "/on".</li>
</ul>
<h3>Вход:</h3>
<ul>
<li><strong>payload</strong> - Значение для отправки.</li>
</ul>
</script>