node-red-contrib-zigbee2mqtt-devices
Version:
Nodes to interact with zigbee2mqtt for Node-RED
82 lines (75 loc) • 3.32 kB
HTML
<!--- DEVICES-EUROTRONICS NODE --->
<script type="text/javascript">
RED.nodes.registerType('eurotronic-spirit', {
category: 'zigbee2mqtt_thermostats-eurotronics',
color: '#59a27a',
defaults: {
name: { value: "" },
bridge: { value: "", type: "zigbee2mqtt-bridge-config" },
deviceName: { value: "", required: true },
windowSensor: { value: "" },
mirrorDisplay: { value: false },
childProtection: { value: false },
},
inputs: 1,
outputs: 1,
icon: "feed.png",
label: function () {
return this.name || "Eurotronics Spirit";
},
oneditprepare: function () {
var node = this;
var deviceName = node.deviceName;
var windowSensor = node.windowSensor;
RED.bavaria.devices.createDeviceSelector("thermostat-selection", deviceName, "EndDevice", "Eurotronic", "SPZB0001");
RED.bavaria.devices.createDeviceSelector("window-selection", windowSensor, "contact", "all", "all", false, "windowSensor");
$("#removeSensor").click(function () {
if ($('#node-input-windowSensor')[0].nodeName === "INPUT") {
$("#node-input-windowSensor").val("");
} else {
document.getElementById("node-input-windowSensor").selectedIndex = -1;
}
});
$("#removeSensorThermostat").click(function () {
if ($('#node-input-deviceName')[0].nodeName === "INPUT") {
$("#node-input-deviceName").val("");
} else {
document.getElementById("node-input-deviceName").selectedIndex = -1;
}
});
},
onEditSave: function () {
console.log
}
});
</script>
<script type="text/html" data-template-name="eurotronic-spirit">
<div class="zigbee2mqtt-devices-properties">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-bridge"><i class="fa fa-server"></i> Bridge</label>
<input type="text" id="node-input-bridge" placeholder="bridge" />
</div>
<div id="thermostat-selection" class="form-row">
</div>
<div id="thermostat-selection" class="form-row">
<button type="button" id="removeSensorThermostat" class="red-ui-button">remove</button>
</div>
<div class="form-row">
<label for="node-input-mirrorDisplay"><i class="fa fa-arrows-h"></i> Mirror Display</label>
<input type="checkbox" id="node-input-mirrorDisplay"/>
</div>
<div class="form-row">
<label for="node-input-childProtection"><i class="fa fa-lock"></i> Child Protection</label>
<input type="checkbox" id="node-input-childProtection"/>
</div>
<div id="window-selection" class="form-row">
<button type="button" id="removeSensor" class="red-ui-button">remove</button>
</div>
</div>
</script>
<script type="text/html" data-help-name="eurotronic-spirit">
</script>