Added Content
This commit is contained in:
BIN
mqtt-domo-in/icons/domo.png
Normal file
BIN
mqtt-domo-in/icons/domo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
37
mqtt-domo-in/miBrightConv.html
Normal file
37
mqtt-domo-in/miBrightConv.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('mqtt-domo-in-bright',{
|
||||
category: 'Domoticz MQTT Input Formater',
|
||||
color: '#00b0e2',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
Savetocontex: {value: false},
|
||||
idx: {value:""}
|
||||
},
|
||||
paletteLabel:"MQTT In Brightness converter",
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "domo.png",
|
||||
label: function() {
|
||||
return this.name||"MQTT In Brightness converter";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="mqtt-domo-in-bright">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-Savetocontex"><i class="icon-tag"></i> Save to context database</label>
|
||||
<input type="checkbox" id="node-input-Savetocontex" >
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-idx"><i class="icon-tag"></i> IDX</label>
|
||||
<input type="number" id="node-input-idx" placeholder="IDX">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="mqtt-domo-in-bright">
|
||||
<p>A node that converts domoticz level to msg.payload and stores to context db</p>
|
||||
</script>
|
||||
21
mqtt-domo-in/miBrightConv.js
Normal file
21
mqtt-domo-in/miBrightConv.js
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = function(RED) {
|
||||
function mqttdomoinbright(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
this.idx = config.idx;
|
||||
this.Savetocontex = config.Savetocontex;
|
||||
var flowContext = this.context().flow;
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
msg.payload = msg.payload.Level;
|
||||
node.send(msg);
|
||||
if (node.Savetocontex === true) {
|
||||
if (node.idx === 'undefined' || node.idx === null || node.idx === "" ) {
|
||||
node.warn("IDX not set");
|
||||
} else{
|
||||
flowContext.set(node.idx + "-brightness", msg.payload)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("mqtt-domo-in-bright",mqttdomoinbright);
|
||||
}
|
||||
37
mqtt-domo-in/miOnOffConv.html
Normal file
37
mqtt-domo-in/miOnOffConv.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('mqtt-domo-in-onoff',{
|
||||
category: 'Domoticz MQTT Input Formater',
|
||||
color: '#00b0e2',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
Savetocontex: {value: false},
|
||||
idx: {value:""}
|
||||
},
|
||||
paletteLabel:"MQTT In On/Off converter",
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "domo.png",
|
||||
label: function() {
|
||||
return this.name||"MQTT In On/Off converter";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="mqtt-domo-in-onoff">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-Savetocontex"><i class="icon-tag"></i> Save to context database</label>
|
||||
<input type="checkbox" id="node-input-Savetocontex" >
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-idx"><i class="icon-tag"></i> IDX</label>
|
||||
<input type="number" id="node-input-idx" placeholder="IDX">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="mqtt-domo-in-onoff">
|
||||
<p>A node that converts domoticz on to true and of to false</p>
|
||||
</script>
|
||||
26
mqtt-domo-in/miOnOffConv.js
Normal file
26
mqtt-domo-in/miOnOffConv.js
Normal file
@@ -0,0 +1,26 @@
|
||||
module.exports = function(RED) {
|
||||
function mqttdomoinonoff(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
this.idx = config.idx;
|
||||
this.Savetocontex = config.Savetocontex;
|
||||
var flowContext = this.context().flow;
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
var stat = msg.payload.nvalue;
|
||||
if (stat === 0) {
|
||||
msg.payload = false;
|
||||
} else {
|
||||
msg.payload = true;
|
||||
}
|
||||
node.send(msg);
|
||||
if (node.Savetocontex === true) {
|
||||
if (node.idx === 'undefined' || node.idx === null || node.idx === "" ) {
|
||||
node.warn("IDX not set");
|
||||
} else{
|
||||
flowContext.set(node.idx + "-state", msg.payload)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("mqtt-domo-in-onoff",mqttdomoinonoff);
|
||||
}
|
||||
37
mqtt-domo-in/miRGBConv.html
Normal file
37
mqtt-domo-in/miRGBConv.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('mqtt-domo-in-rgb',{
|
||||
category: 'Domoticz MQTT Input Formater',
|
||||
color: '#00b0e2',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
Savetocontex: {value: false},
|
||||
idx: {value:""}
|
||||
},
|
||||
paletteLabel:"MQTT In RGB converter",
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "domo.png",
|
||||
label: function() {
|
||||
return this.name||"MQTT In RGB converter";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="mqtt-domo-in-rgb">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-Savetocontex"><i class="icon-tag"></i> Save to context database</label>
|
||||
<input type="checkbox" id="node-input-Savetocontex" >
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-idx"><i class="icon-tag"></i> IDX</label>
|
||||
<input type="number" id="node-input-idx" placeholder="IDX">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="mqtt-domo-in-rgb">
|
||||
<p>A node that converts domoticz rgb to hex</p>
|
||||
</script>
|
||||
29
mqtt-domo-in/miRGBConv.js
Normal file
29
mqtt-domo-in/miRGBConv.js
Normal file
@@ -0,0 +1,29 @@
|
||||
module.exports = function(RED) {
|
||||
function mqttdomoinrgb(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
this.idx = config.idx;
|
||||
this.Savetocontex = config.Savetocontex;
|
||||
var flowContext = this.context().flow;
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
var r = msg.payload.Color.r;
|
||||
var g = msg.payload.Color.g;
|
||||
var b = msg.payload.Color.b;
|
||||
function componentToHex(c) {
|
||||
var hex = c.toString(16);
|
||||
return hex.length == 1 ? "0" + hex : hex;
|
||||
}
|
||||
msg.payload = "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
|
||||
node.send(msg);
|
||||
|
||||
if (node.Savetocontex === true) {
|
||||
if (node.idx === 'undefined' || node.idx === null || node.idx === "" ) {
|
||||
node.warn("IDX not set");
|
||||
} else{
|
||||
flowContext.set(node.idx + "-color", msg.payload)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("mqtt-domo-in-rgb",mqttdomoinrgb);
|
||||
}
|
||||
32
mqtt-domo-in/miTempConv.html
Normal file
32
mqtt-domo-in/miTempConv.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('mqtt-domo-in-temp',{
|
||||
category: 'Domoticz MQTT Input Formater',
|
||||
color: '#00b0e2',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
sname: {value:""}
|
||||
},
|
||||
paletteLabel:"MQTT In Temperature converter",
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "domo.png",
|
||||
label: function() {
|
||||
return this.name||"MQTT In Temperature converter";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="mqtt-domo-in-temp">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-idx"><i class="icon-tag"></i> Sensor name</label>
|
||||
<input type="text" id="node-input-sname" placeholder="Sensor name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="mqtt-domo-in-temp">
|
||||
<p>A node that converts domoticz svalue1 to msg.payload and adds a confiurable topic for use with dashboad graph</p>
|
||||
</script>
|
||||
16
mqtt-domo-in/miTempConv.js
Normal file
16
mqtt-domo-in/miTempConv.js
Normal file
@@ -0,0 +1,16 @@
|
||||
module.exports = function(RED) {
|
||||
function mqttdomointemp(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
this.sname = config.sname;
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
msg.payload = msg.payload.svalue1;
|
||||
if (node.sname === 'undefined' || node.sname === null || node.sname === "" ) {
|
||||
} else{
|
||||
msg.topic = node.sname
|
||||
}
|
||||
node.send(msg);
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("mqtt-domo-in-temp",mqttdomointemp);
|
||||
}
|
||||
Reference in New Issue
Block a user