2
0

feat(gateway): add in/out gateway nodes

This commit is contained in:
Pierre CLEMENT
2017-12-31 23:10:06 +01:00
parent 5c27c9ff6e
commit 8608f4eed4
6 changed files with 334 additions and 21 deletions

View File

@@ -3,6 +3,7 @@
category: 'config',
defaults: {
name: {value: ""},
ip: {value: ""},
deviceList: {value:[{ sid:"", desc:"", model:"plug"}]},
key: {value: ""}
},
@@ -59,6 +60,13 @@
oneditsave: function() {
var devices = $("#node-config-input-devices").editableList('items');
var node = this;
RED.nodes.eachNode(function(tmpNode) {
if(tmpNode.type.indexOf("xiaomi-gateway") === 0 && tmpNode.gateway == node.id) {
tmpNode.ip = $("#node-config-input-ip").val();
tmpNode.changed = true;
console.log(tmpNode);
}
});
var devicesArray = [];
devices.each(function(i) {
var deviceElement = $(this);
@@ -81,7 +89,11 @@
<label for="node-config-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row">
<div class="form-row">
<label for="node-config-input-ip"><i class="icon-tag"></i> IP address (v4 or v6)</label>
<input type="text" id="node-config-input-ip" placeholder="IP">
</div>
<div class="form-row">
<label for="node-config-input-key"><i class="fa fa-ticket"></i> Key/Password</label>
<input type="text" id="node-config-input-key" placeholder="Key">
</div>

View File

@@ -5,6 +5,7 @@ module.exports = function(RED) {
this.name = n.name;
this.deviceList = n.deviceList || [];
this.key = n.key;
this.ip = n.ip;
var node = this;
}