Initial Commit
This commit is contained in:
commit
80c449f70b
37
bluetti/bluetti.html
Normal file
37
bluetti/bluetti.html
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<script type="text/javascript">
|
||||||
|
//RED.log.error(
|
||||||
|
console.error("Bluetti PLEASE register me!");
|
||||||
|
//(function() {
|
||||||
|
// 'use strict';
|
||||||
|
// RED.log.error(*Bluetti HTML register");
|
||||||
|
|
||||||
|
RED.nodes.registerType('bluetti', {
|
||||||
|
category: 'function',
|
||||||
|
color: '#a6bbcf',
|
||||||
|
defaults: {
|
||||||
|
name: {value:""},
|
||||||
|
},
|
||||||
|
inputs: 1,
|
||||||
|
outputs: 1,
|
||||||
|
inputLabels: "Generic Bluetti message",
|
||||||
|
label: function() {
|
||||||
|
return this.name || "bluetti";
|
||||||
|
},
|
||||||
|
icon: "bluetti.png"
|
||||||
|
});
|
||||||
|
console.error("Bluetti registered HTML");
|
||||||
|
|
||||||
|
//}());
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" data-template-name="bluetti">
|
||||||
|
<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>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" data-help-name="bluetti">
|
||||||
|
<p>A node that converts the bluetti message payloads into breakout streams</p>
|
||||||
|
</script>
|
||||||
|
|
||||||
34
bluetti/bluetti.html~
Normal file
34
bluetti/bluetti.html~
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<script type="text/javascript">
|
||||||
|
//RED.log.error("Bluetti PLEASE register me!");
|
||||||
|
|
||||||
|
//(function() {
|
||||||
|
// 'use strict';
|
||||||
|
RED.log.error(*Bluetti HTML register");
|
||||||
|
|
||||||
|
RED.nodes.registerType('bluetti', {
|
||||||
|
category: 'function',
|
||||||
|
color: '#a6bbcf',
|
||||||
|
defaults: {
|
||||||
|
name: {value:""},
|
||||||
|
},
|
||||||
|
inputs: 1,
|
||||||
|
outputs: 1,
|
||||||
|
inputLabels: "Generic Bluetti message",
|
||||||
|
label: function() {
|
||||||
|
return this.name || "bluetti";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//}());
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" data-template-name="bluetti">
|
||||||
|
<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>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" data-help-name="bluetti">
|
||||||
|
<p>A node that converts the bluetti message payloads into breakout streams</p>
|
||||||
|
</script>
|
||||||
|
|
||||||
20
bluetti/bluetti.js
Normal file
20
bluetti/bluetti.js
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
module.exports = function(RED) {
|
||||||
|
// Bluetti combobulator
|
||||||
|
'use strict';
|
||||||
|
function bluetti(config) {
|
||||||
|
//RED.log.
|
||||||
|
// this.error('CONFIG BLUETTI');
|
||||||
|
RED.nodes.createNode(this, config);
|
||||||
|
var node = this;
|
||||||
|
node.error('CONFIG BLUETTI 2');
|
||||||
|
node.config = config;
|
||||||
|
// // Node logic here
|
||||||
|
// node.on('input', function(msg) {
|
||||||
|
// msg.payload = msg.payload.toUpperCase();
|
||||||
|
// node.send(msg);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
RED.log.error('PRE-REG bluetti');
|
||||||
|
RED.nodes.registerType('bluetti', bluetti);
|
||||||
|
RED.log.info('POST-REG bluetti');
|
||||||
|
};
|
||||||
22
bluetti/bluetti.js~
Normal file
22
bluetti/bluetti.js~
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
module.exports = function(RED) {
|
||||||
|
// Bluetti combobulator
|
||||||
|
'use strict';
|
||||||
|
RED.log.error('IWANNA CONFIG BLUETTI');
|
||||||
|
function bluetti(config) {
|
||||||
|
var scuzz = 12345 / 0;
|
||||||
|
//RED.log.
|
||||||
|
// this.error('CONFIG BLUETTI');
|
||||||
|
RED.nodes.createNode(this, config);
|
||||||
|
var node = this;
|
||||||
|
node.error('CONFIG BLUETTI 2');
|
||||||
|
node.config = config;
|
||||||
|
// // Node logic here
|
||||||
|
// node.on('input', function(msg) {
|
||||||
|
// msg.payload = msg.payload.toUpperCase();
|
||||||
|
// node.send(msg);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
RED.log.error('PRE-REG');
|
||||||
|
RED.nodes.registerType('bluetti', bluetti);
|
||||||
|
RED.log.info('POST-REG');
|
||||||
|
};
|
||||||
BIN
icons/bluetti-node.png
Normal file
BIN
icons/bluetti-node.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
5362
package-lock.json
generated
Normal file
5362
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
21
package.json
Normal file
21
package.json
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "node-red-contrib-bluetti",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"description": "Master router/breakout for Bluetti MQ messages",
|
||||||
|
"main" : "bluetti.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha \"test/bluetti_spec.js\""
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"node-red",
|
||||||
|
"bluetti"
|
||||||
|
],
|
||||||
|
"node-red": {
|
||||||
|
"nodes": {
|
||||||
|
"bluetti": "bluetti/bluetti.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"author": "Tim Holloway",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
||||||
21
test/bluetti_spec.js
Normal file
21
test/bluetti_spec.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
var helper = require("node-red-node-test-helper");
|
||||||
|
var lowerNode = require("../bluetti/bluetti.js");
|
||||||
|
|
||||||
|
describe('bluetti Node', function () {
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
helper.unload();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be loaded', function (done) {
|
||||||
|
console.error("STAET");
|
||||||
|
var flow = [{ id: "n1", type: "bluetti", name: "test name" }];
|
||||||
|
helper.load(lowerNode, flow, function () {
|
||||||
|
var n1 = helper.getNode("n1");
|
||||||
|
console.error("Got node");
|
||||||
|
console.error(n1);
|
||||||
|
n1.should.have.property('name', 'test name');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
20
test/bluetti_spec.js~
Normal file
20
test/bluetti_spec.js~
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
var helper = require("node-red-node-test-helper");
|
||||||
|
var lowerNode = require("../bluetti/bluetti.js");
|
||||||
|
|
||||||
|
describe('bluetti Node', function () {
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
helper.unload();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be loaded', function (done) {
|
||||||
|
console.error("STAET");
|
||||||
|
var flow = [{ id: "n1", type: "bluetti", name: "test name" }];
|
||||||
|
helper.load(lowerNode, flow, function () {
|
||||||
|
var n1 = helper.getNode("n1");
|
||||||
|
console.error("Got node");
|
||||||
|
n1.should.have.property('name', 'test name');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user