node-red-contrib-ecowitt-gateway
Version:
Ecowitt Gateway for NodeRED
73 lines (66 loc) • 3.16 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('ew-config-node', {
category: 'config',
defaults: {
name: { value: '', required: false },
gateway: { value: '', required: true },
port: { value: 45000, required: true, validate: RED.validators.number() },
rainMethod: { value: 'auto', required: true },
debug: { value: false, required: true }
},
label: () => {
return this.name || 'Ecowitt Gateway Config'
},
color: "#109CFF",
paletteLabel: "Ecowitt Gateway Config",
icon: "font-awesome/fa-list",
oneditsave: function () {
this.rainMethod = $("#node-config-input-rainMethod").val();
},
oneditprepare: function () {
this.rainMethod = $("#node-config-input-rainMethod").val(this.rainMethod);
}
});
</script>
<script type="text/html" data-template-name="ew-config-node">
<div class="form-row" style="display: -webkit-flex;">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name">
</div>
<div class="form-row" style="display: -webkit-flex;">
<label for="node-config-input-gateway"><i class="fa fa-tag"></i> Gateway (Host/IP)</label>
<input type="text" id="node-config-input-gateway">
</div>
<div class="form-row" style="display: -webkit-flex;">
<label for="node-config-input-port"><i class="fa fa-tag"></i> Port</label>
<input type="number" id="node-config-input-port">
</div>
<div class="form-row">
<label for="node-config-input-rainMethod"> Rain Method</label>
<select id="node-config-input-rainMethod" name="node-config-input-rainMethod">
<option value="auto">Auto</option>
<option value="false">ReadRain</option>
<option value="true">ReadRainData</option>
</select>
</div>
<div class="form-row">
<input type="checkbox" id="node-config-input-debug" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-config-input-debug" style="width: 70%;"> Debug</label>
</div>
</script>
<script type="text/x-red" data-help-name="ew-config-node">
<p>Ecowitt Gateway Configuration</p>
<h3>Settings</h3>
<dl class="message-properties">
<dt>Gateway <span class="property-type">string</span></dt>
<dd>Host address or IP for the gateway.</dd>
<dt>Port <span class="property-type">number</span></dt>
<dd>Port to connect to. Default is 45000</dd>
<dt>Rain Method <span class="property-type">option</span></dt>
<dd>Method to collect rain data. Auto runs firmware check to determin best method. ReadRainData is the legacy version</dd>
<dt>Debug <span class="property-type">bool</span></dt>
<dd>Logs debug data to the NodeRED instance</dd>
</dl>
<h3>Details</h3>
<p>This node sets up the NodeRED configuration for the Ecowitt Gateway.</p>
</script>