node-red-contrib-periph-power 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/examples/ade7953/demo.json +22 -7
- package/examples/ina3221/demo.json +1 -1
- package/examples/lm25066/demo.json +2 -2
- package/examples/ltc4151/demo.json +2 -2
- package/examples/max17048/demo.json +2 -2
- package/nodes/ade7953/ade7953.html +69 -24
- package/nodes/ade7953/ade7953.js +12 -5
- package/nodes/ina3221/ina3221.html +3 -3
- package/nodes/ina3221/ina3221.js +1 -1
- package/nodes/lm25066/lm25066.html +7 -7
- package/nodes/lm25066/lm25066.js +2 -2
- package/nodes/ltc4151/ltc4151.html +7 -7
- package/nodes/ltc4151/ltc4151.js +2 -2
- package/nodes/max17048/max17048.html +7 -7
- package/nodes/max17048/max17048.js +2 -2
- package/package.json +4 -5
- package/index.js +0 -11
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@ npm install node-red-contrib-periph-power
|
|
|
16
16
|
|
|
17
17
|
| Node | Kind | Description |
|
|
18
18
|
|------|------|-------------|
|
|
19
|
-
| `
|
|
19
|
+
| `ade7953-device` | config | Bus configuration for an ADE7953 |
|
|
20
|
+
| `ade7953` | input | Reads bus voltage, load current, active power, and accumulated active energy from an ADE7953 single-phase multifunction metering IC. |
|
|
20
21
|
| `axp2101-device` | config | I²C bus and address for an AXP2101 |
|
|
21
22
|
| `axp2101` | input | Reads battery, charger and power-input state from an AXP2101 single-cell power-management IC over I²C. |
|
|
22
23
|
| `ina219-device` | config | I²C bus and address for an INA219 |
|
|
@@ -26,15 +27,15 @@ npm install node-red-contrib-periph-power
|
|
|
26
27
|
| `ina260-device` | config | I²C bus and address for an INA260 |
|
|
27
28
|
| `ina260` | input | Reads bus voltage, current, and power from an INA260 power monitor (integrated 2 mΩ shunt) over I²C. |
|
|
28
29
|
| `ina3221-device` | config | I²C bus and address for an INA3221 |
|
|
29
|
-
| `
|
|
30
|
+
| `ina3221` | input | Reads bus voltage, shunt voltage, current, and power from an INA3221 three-channel power monitor over I²C. |
|
|
30
31
|
| `lc709203f-device` | config | I²C bus and address for a LC709203F |
|
|
31
32
|
| `lc709203f` | input | Reads cell voltage, state of charge and temperature from an LC709203F 1-cell Li-ion fuel gauge over I²C. |
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
33
|
+
| `lm25066-device` | config | I²C bus and address for a LM25066 |
|
|
34
|
+
| `lm25066` | input | Reads input and output voltage, input current, input power and MOSFET temperature from an LM25066 hot-swap controller over I²C/PMBus. |
|
|
35
|
+
| `ltc4151-device` | config | I²C bus and address for a LTC4151 |
|
|
36
|
+
| `ltc4151` | input | Reads supply voltage, load current and power from an LTC4151 7–80 V high-side power monitor over I²C. |
|
|
37
|
+
| `max17048-device` | config | I²C bus and address for a MAX17048 |
|
|
38
|
+
| `max17048` | input | Reads cell voltage and state of charge from a MAX17048 (1-cell) or MAX17049 (2-cell) lithium fuel gauge over I²C. |
|
|
38
39
|
|
|
39
40
|
## Links
|
|
40
41
|
|
|
@@ -5,17 +5,28 @@
|
|
|
5
5
|
"name": "ADE7953 Demo",
|
|
6
6
|
"icon": "bolt",
|
|
7
7
|
"order": 1,
|
|
8
|
-
"info": "This flow demonstrates the ADE7953 single-phase multifunction metering IC.\n\n**Continuous single-phase metering**: an inject node fires once per second into the
|
|
8
|
+
"info": "This flow demonstrates the ADE7953 single-phase multifunction metering IC.\n\n**Continuous single-phase metering**: an inject node fires once per second into the ade7953 node, which emits voltage, current, active power, and cumulative active energy for Current Channel A. A function node formats the four values as one line; a debug node prints them to the sidebar — the user sees a live single-phase energy-monitoring feed, with active energy visibly climbing over the session.\n\nThe chip is wired to the host over I²C at the chip's fixed 7-bit address 0x38; the calibration constants (voltage_gain = 251.0 V/V, current_gain = 30.0 A/V) are placeholders — replace them with the actual values for the external voltage divider and current sensor on your PCB."
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"id": "ade7953-device-1",
|
|
12
|
-
"type": "
|
|
13
|
-
"name": "ADE7953
|
|
12
|
+
"type": "ade7953-device",
|
|
13
|
+
"name": "ADE7953",
|
|
14
14
|
"bus": "1",
|
|
15
15
|
"addr": "0x38",
|
|
16
16
|
"voltageGain": "251.0",
|
|
17
|
-
"currentGain": "30.0"
|
|
18
|
-
|
|
17
|
+
"currentGain": "30.0"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "ade7953-read-1",
|
|
21
|
+
"type": "ade7953",
|
|
22
|
+
"name": "ADE7953",
|
|
23
|
+
"wires": [
|
|
24
|
+
[
|
|
25
|
+
"debug-ade7953-1",
|
|
26
|
+
"format-ade7953-1"
|
|
27
|
+
]
|
|
28
|
+
],
|
|
29
|
+
"device": "ade7953-device-1"
|
|
19
30
|
},
|
|
20
31
|
{
|
|
21
32
|
"id": "format-ade7953-1",
|
|
@@ -45,6 +56,10 @@
|
|
|
45
56
|
"crontab": "",
|
|
46
57
|
"once": false,
|
|
47
58
|
"onceDelay": 0.1,
|
|
48
|
-
"wires": [
|
|
59
|
+
"wires": [
|
|
60
|
+
[
|
|
61
|
+
"ade7953-read-1"
|
|
62
|
+
]
|
|
63
|
+
]
|
|
49
64
|
}
|
|
50
|
-
]
|
|
65
|
+
]
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"id": "cfg-lm25066",
|
|
11
|
-
"type": "
|
|
11
|
+
"type": "lm25066-device",
|
|
12
12
|
"name": "LM25066",
|
|
13
13
|
"bus": "1",
|
|
14
14
|
"address": "40",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"id": "read-lm25066",
|
|
40
|
-
"type": "
|
|
40
|
+
"type": "lm25066",
|
|
41
41
|
"name": "LM25066",
|
|
42
42
|
"device": "cfg-lm25066",
|
|
43
43
|
"z": "tab-lm25066-demo",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"id": "cfg-ltc4151",
|
|
11
|
-
"type": "
|
|
11
|
+
"type": "ltc4151-device",
|
|
12
12
|
"name": "LTC4151",
|
|
13
13
|
"bus": "1",
|
|
14
14
|
"address": "6A",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"id": "read-ltc4151",
|
|
39
|
-
"type": "
|
|
39
|
+
"type": "ltc4151",
|
|
40
40
|
"name": "LTC4151",
|
|
41
41
|
"device": "cfg-ltc4151",
|
|
42
42
|
"z": "tab-ltc4151-demo",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"id": "cfg-max17048",
|
|
11
|
-
"type": "
|
|
11
|
+
"type": "max17048-device",
|
|
12
12
|
"name": "MAX17048",
|
|
13
13
|
"bus": "1",
|
|
14
14
|
"address": "36",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"id": "read-max17048",
|
|
39
|
-
"type": "
|
|
39
|
+
"type": "max17048",
|
|
40
40
|
"name": "MAX17048",
|
|
41
41
|
"device": "cfg-max17048",
|
|
42
42
|
"z": "tab-max17048-demo",
|
|
@@ -1,4 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- Config node: one instance per physical device -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('ade7953-device', {
|
|
4
|
+
category: 'config',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
bus: { value: '1', required: true, validate: RED.validators.number() },
|
|
8
|
+
addr: { value: '0x38', required: true, validate: RED.validators.regex(/^0x[0-9a-fA-F]{1,2}$/) },
|
|
9
|
+
voltageGain: { value: '251.0', required: true, validate: RED.validators.number() },
|
|
10
|
+
currentGain: { value: '30.0', required: true, validate: RED.validators.number() }
|
|
11
|
+
},
|
|
12
|
+
label: function() {
|
|
13
|
+
return this.name || ('ADE7953 @ ' + this.addr + ' (bus ' + this.bus + ')');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script type="text/html" data-template-name="ade7953-device">
|
|
19
|
+
<div class="form-row">
|
|
20
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
21
|
+
<input type="text" id="node-config-input-name" placeholder="ADE7953">
|
|
22
|
+
</div>
|
|
23
|
+
<div class="form-row">
|
|
24
|
+
<label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
|
|
25
|
+
<input type="number" id="node-config-input-bus" min="0" style="width:80px"> (Linux /dev/i2c-N)
|
|
26
|
+
</div>
|
|
27
|
+
<div class="form-row">
|
|
28
|
+
<label for="node-config-input-addr">Address (hex)</label>
|
|
29
|
+
<input type="text" id="node-config-input-addr" placeholder="0x38" style="width:80px"> fixed: 0x38
|
|
30
|
+
</div>
|
|
31
|
+
<div class="form-row">
|
|
32
|
+
<label for="node-config-input-voltageGain">Voltage gain</label>
|
|
33
|
+
<input type="number" id="node-config-input-voltageGain" step="any" style="width:100px"> V per V at VP–VN
|
|
34
|
+
</div>
|
|
35
|
+
<div class="form-row">
|
|
36
|
+
<label for="node-config-input-currentGain">Current gain</label>
|
|
37
|
+
<input type="number" id="node-config-input-currentGain" step="any" style="width:100px"> A per V at IAP–IAN
|
|
38
|
+
</div>
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<!-- Read node -->
|
|
42
|
+
<script type="text/javascript">
|
|
43
|
+
RED.nodes.registerType('ade7953', {
|
|
44
|
+
category: 'Peripheral',
|
|
45
|
+
color: '#C084FC',
|
|
46
|
+
defaults: {
|
|
47
|
+
name: { value: '' },
|
|
48
|
+
device: { value: '', type: 'ade7953-device', required: true }
|
|
49
|
+
},
|
|
50
|
+
inputs: 1,
|
|
51
|
+
outputs: 1,
|
|
52
|
+
icon: 'font-awesome/fa-microchip',
|
|
53
|
+
label: function() { return this.name || 'ADE7953'; },
|
|
54
|
+
paletteLabel: 'ADE7953'
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<script type="text/html" data-template-name="ade7953">
|
|
59
|
+
<div class="form-row">
|
|
60
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
61
|
+
<input type="text" id="node-input-name" placeholder="ADE7953">
|
|
62
|
+
</div>
|
|
63
|
+
<div class="form-row">
|
|
64
|
+
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
65
|
+
<input type="text" id="node-input-device">
|
|
66
|
+
</div>
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<script type="text/html" data-help-name="ade7953">
|
|
2
70
|
<p>Reads bus voltage, load current, active power, and accumulated active
|
|
3
71
|
energy from an ADE7953 single-phase multifunction metering IC.</p>
|
|
4
72
|
<h3>Inputs</h3>
|
|
@@ -27,26 +95,3 @@
|
|
|
27
95
|
Both must be supplied at construction — there is no universal default
|
|
28
96
|
because they depend on the external sensor network.</p>
|
|
29
97
|
</script>
|
|
30
|
-
|
|
31
|
-
<script type="text/javascript">
|
|
32
|
-
RED.nodes.registerType('periph-ade7953', {
|
|
33
|
-
category: 'Periph',
|
|
34
|
-
color: '#C084FC',
|
|
35
|
-
defaults: {
|
|
36
|
-
name: { value: '' },
|
|
37
|
-
bus: { value: '1', validate: RED.validators.number() },
|
|
38
|
-
addr: { value: '0x38', validate: RED.validators.regex(/^0x[0-9a-fA-F]{1,2}$/) },
|
|
39
|
-
voltageGain: { value: '251.0', validate: RED.validators.number() },
|
|
40
|
-
currentGain: { value: '30.0', validate: RED.validators.number() },
|
|
41
|
-
},
|
|
42
|
-
inputs: 1,
|
|
43
|
-
outputs: 1,
|
|
44
|
-
icon: 'light.png',
|
|
45
|
-
label: function() {
|
|
46
|
-
return this.name || 'ADE7953';
|
|
47
|
-
},
|
|
48
|
-
labelStyle: function() {
|
|
49
|
-
return this.name ? 'node_label_italic' : '';
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
</script>
|
package/nodes/ade7953/ade7953.js
CHANGED
|
@@ -4,7 +4,7 @@ module.exports = function(RED) {
|
|
|
4
4
|
const { I2CConnection } = require('periph/src/connection/i2c');
|
|
5
5
|
const { ADE7953Full } = require('periph/src/chips/power/ade7953');
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function ADE7953DeviceNode(config) {
|
|
8
8
|
RED.nodes.createNode(this, config);
|
|
9
9
|
const node = this;
|
|
10
10
|
try {
|
|
@@ -24,15 +24,22 @@ module.exports = function(RED) {
|
|
|
24
24
|
node.on('close', function() {
|
|
25
25
|
if (node.connection) node.connection.close();
|
|
26
26
|
});
|
|
27
|
+
}
|
|
28
|
+
RED.nodes.registerType('ade7953-device', ADE7953DeviceNode);
|
|
29
|
+
|
|
30
|
+
function ADE7953ReadNode(config) {
|
|
31
|
+
RED.nodes.createNode(this, config);
|
|
32
|
+
const node = this;
|
|
33
|
+
const deviceNode = RED.nodes.getNode(config.device) || {};
|
|
27
34
|
|
|
28
35
|
node.on('input', async function(msg, send, done) {
|
|
29
|
-
if (!
|
|
30
|
-
node.error('No ADE7953
|
|
36
|
+
if (!deviceNode.driver) {
|
|
37
|
+
node.error('No ADE7953 device configured', msg);
|
|
31
38
|
done();
|
|
32
39
|
return;
|
|
33
40
|
}
|
|
34
41
|
try {
|
|
35
|
-
const d =
|
|
42
|
+
const d = deviceNode.driver;
|
|
36
43
|
const voltage = await d.voltage();
|
|
37
44
|
const current = await d.current();
|
|
38
45
|
const activePower = await d.activePower();
|
|
@@ -50,5 +57,5 @@ module.exports = function(RED) {
|
|
|
50
57
|
}
|
|
51
58
|
});
|
|
52
59
|
}
|
|
53
|
-
RED.nodes.registerType('
|
|
60
|
+
RED.nodes.registerType('ade7953', ADE7953ReadNode);
|
|
54
61
|
};
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
<!-- Read node: trigger → measurements -->
|
|
37
37
|
<script type="text/javascript">
|
|
38
|
-
RED.nodes.registerType('
|
|
38
|
+
RED.nodes.registerType('ina3221', {
|
|
39
39
|
category: 'Peripheral',
|
|
40
40
|
color: '#C084FC',
|
|
41
41
|
defaults: {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
});
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
|
-
<script type="text/html" data-template-name="
|
|
53
|
+
<script type="text/html" data-template-name="ina3221">
|
|
54
54
|
<div class="form-row">
|
|
55
55
|
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
56
56
|
<input type="text" id="node-input-device">
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</script>
|
|
63
63
|
|
|
64
|
-
<script type="text/html" data-help-name="
|
|
64
|
+
<script type="text/html" data-help-name="ina3221">
|
|
65
65
|
<p>Reads bus voltage, shunt voltage, current, and power from an INA3221 three-channel power monitor over I²C.</p>
|
|
66
66
|
<p>Any input message triggers a measurement. The device is configured via an <b>ina3221-device</b> config node.</p>
|
|
67
67
|
|
package/nodes/ina3221/ina3221.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Config node: one instance per physical device -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('
|
|
3
|
+
RED.nodes.registerType('lm25066-device', {
|
|
4
4
|
category: 'config',
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: '' },
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
});
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<script type="text/html" data-template-name="
|
|
18
|
+
<script type="text/html" data-template-name="lm25066-device">
|
|
19
19
|
<div class="form-row">
|
|
20
20
|
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
21
21
|
<input type="text" id="node-config-input-name" placeholder="LM25066">
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
|
|
44
44
|
<!-- Read node: trigger → measurements -->
|
|
45
45
|
<script type="text/javascript">
|
|
46
|
-
RED.nodes.registerType('
|
|
46
|
+
RED.nodes.registerType('lm25066', {
|
|
47
47
|
category: 'Peripheral',
|
|
48
48
|
color: '#C084FC',
|
|
49
49
|
defaults: {
|
|
50
50
|
name: { value: '' },
|
|
51
|
-
device: { value: '', type: '
|
|
51
|
+
device: { value: '', type: 'lm25066-device', required: true }
|
|
52
52
|
},
|
|
53
53
|
inputs: 1,
|
|
54
54
|
outputs: 1,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
});
|
|
59
59
|
</script>
|
|
60
60
|
|
|
61
|
-
<script type="text/html" data-template-name="
|
|
61
|
+
<script type="text/html" data-template-name="lm25066">
|
|
62
62
|
<div class="form-row">
|
|
63
63
|
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
64
64
|
<input type="text" id="node-input-device">
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
</div>
|
|
70
70
|
</script>
|
|
71
71
|
|
|
72
|
-
<script type="text/html" data-help-name="
|
|
72
|
+
<script type="text/html" data-help-name="lm25066">
|
|
73
73
|
<p>Reads input and output voltage, input current, input power and MOSFET temperature from an LM25066 hot-swap controller over I²C/PMBus.</p>
|
|
74
|
-
<p>Any input message triggers one reading. The device is configured via a <b>
|
|
74
|
+
<p>Any input message triggers one reading. The device is configured via a <b>lm25066-device</b> config node. The node never writes the control registers (OPERATION, GATE_MASK, DEVICE_SETUP).</p>
|
|
75
75
|
|
|
76
76
|
<h3>Input</h3>
|
|
77
77
|
<p>Any message.</p>
|
package/nodes/lm25066/lm25066.js
CHANGED
|
@@ -18,7 +18,7 @@ module.exports = function(RED) {
|
|
|
18
18
|
if (node.connection) node.connection.close();
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
RED.nodes.registerType('
|
|
21
|
+
RED.nodes.registerType('lm25066-device', LM25066DeviceNode);
|
|
22
22
|
|
|
23
23
|
function LM25066ReadNode(config) {
|
|
24
24
|
RED.nodes.createNode(this, config);
|
|
@@ -47,5 +47,5 @@ module.exports = function(RED) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
RED.nodes.registerType('
|
|
50
|
+
RED.nodes.registerType('lm25066', LM25066ReadNode);
|
|
51
51
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Config node: one instance per physical device -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('
|
|
3
|
+
RED.nodes.registerType('ltc4151-device', {
|
|
4
4
|
category: 'config',
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: '' },
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
});
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<script type="text/html" data-template-name="
|
|
17
|
+
<script type="text/html" data-template-name="ltc4151-device">
|
|
18
18
|
<div class="form-row">
|
|
19
19
|
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
20
|
<input type="text" id="node-config-input-name" placeholder="LTC4151">
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
|
|
36
36
|
<!-- Read node: trigger → measurements -->
|
|
37
37
|
<script type="text/javascript">
|
|
38
|
-
RED.nodes.registerType('
|
|
38
|
+
RED.nodes.registerType('ltc4151', {
|
|
39
39
|
category: 'Peripheral',
|
|
40
40
|
color: '#C084FC',
|
|
41
41
|
defaults: {
|
|
42
42
|
name: { value: '' },
|
|
43
|
-
device: { value: '', type: '
|
|
43
|
+
device: { value: '', type: 'ltc4151-device', required: true },
|
|
44
44
|
adin: { value: false }
|
|
45
45
|
},
|
|
46
46
|
inputs: 1,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
});
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
|
-
<script type="text/html" data-template-name="
|
|
54
|
+
<script type="text/html" data-template-name="ltc4151">
|
|
55
55
|
<div class="form-row">
|
|
56
56
|
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
57
57
|
<input type="text" id="node-input-device">
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
</div>
|
|
67
67
|
</script>
|
|
68
68
|
|
|
69
|
-
<script type="text/html" data-help-name="
|
|
69
|
+
<script type="text/html" data-help-name="ltc4151">
|
|
70
70
|
<p>Reads supply voltage, load current and power from an LTC4151 7–80 V high-side power monitor over I²C.</p>
|
|
71
|
-
<p>Any input message triggers one reading. The device is configured via a <b>
|
|
71
|
+
<p>Any input message triggers one reading. The device is configured via a <b>ltc4151-device</b> config node.</p>
|
|
72
72
|
|
|
73
73
|
<h3>Output</h3>
|
|
74
74
|
<dl class="message-properties">
|
package/nodes/ltc4151/ltc4151.js
CHANGED
|
@@ -18,7 +18,7 @@ module.exports = function(RED) {
|
|
|
18
18
|
if (node.connection) node.connection.close();
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
RED.nodes.registerType('
|
|
21
|
+
RED.nodes.registerType('ltc4151-device', LTC4151DeviceNode);
|
|
22
22
|
|
|
23
23
|
function LTC4151ReadNode(config) {
|
|
24
24
|
RED.nodes.createNode(this, config);
|
|
@@ -47,5 +47,5 @@ module.exports = function(RED) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
RED.nodes.registerType('
|
|
50
|
+
RED.nodes.registerType('ltc4151', LTC4151ReadNode);
|
|
51
51
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Config node: one instance per physical device -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('
|
|
3
|
+
RED.nodes.registerType('max17048-device', {
|
|
4
4
|
category: 'config',
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: '' },
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
});
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<script type="text/html" data-template-name="
|
|
17
|
+
<script type="text/html" data-template-name="max17048-device">
|
|
18
18
|
<div class="form-row">
|
|
19
19
|
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
20
|
<input type="text" id="node-config-input-name" placeholder="MAX17048">
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
|
|
39
39
|
<!-- Read node: trigger → measurements -->
|
|
40
40
|
<script type="text/javascript">
|
|
41
|
-
RED.nodes.registerType('
|
|
41
|
+
RED.nodes.registerType('max17048', {
|
|
42
42
|
category: 'Peripheral',
|
|
43
43
|
color: '#C084FC',
|
|
44
44
|
defaults: {
|
|
45
45
|
name: { value: '' },
|
|
46
|
-
device: { value: '', type: '
|
|
46
|
+
device: { value: '', type: 'max17048-device', required: true },
|
|
47
47
|
rate: { value: false }
|
|
48
48
|
},
|
|
49
49
|
inputs: 1,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
});
|
|
55
55
|
</script>
|
|
56
56
|
|
|
57
|
-
<script type="text/html" data-template-name="
|
|
57
|
+
<script type="text/html" data-template-name="max17048">
|
|
58
58
|
<div class="form-row">
|
|
59
59
|
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
60
60
|
<input type="text" id="node-input-device">
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
</div>
|
|
70
70
|
</script>
|
|
71
71
|
|
|
72
|
-
<script type="text/html" data-help-name="
|
|
72
|
+
<script type="text/html" data-help-name="max17048">
|
|
73
73
|
<p>Reads cell voltage and state of charge from a MAX17048 (1-cell) or MAX17049 (2-cell) lithium fuel gauge over I²C.</p>
|
|
74
|
-
<p>Any input message triggers one reading. The device is configured via a <b>
|
|
74
|
+
<p>Any input message triggers one reading. The device is configured via a <b>max17048-device</b> config node.</p>
|
|
75
75
|
|
|
76
76
|
<h3>Output</h3>
|
|
77
77
|
<dl class="message-properties">
|
|
@@ -18,7 +18,7 @@ module.exports = function(RED) {
|
|
|
18
18
|
if (node.connection) node.connection.close();
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
RED.nodes.registerType('
|
|
21
|
+
RED.nodes.registerType('max17048-device', MAX17048DeviceNode);
|
|
22
22
|
|
|
23
23
|
function MAX17048ReadNode(config) {
|
|
24
24
|
RED.nodes.createNode(this, config);
|
|
@@ -45,5 +45,5 @@ module.exports = function(RED) {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
RED.nodes.registerType('
|
|
48
|
+
RED.nodes.registerType('max17048', MAX17048ReadNode);
|
|
49
49
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-periph-power",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Node-RED nodes for power monitor chips",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"sensor",
|
|
11
11
|
"peripheral"
|
|
12
12
|
],
|
|
13
|
-
"main": "index.js",
|
|
14
13
|
"node-red": {
|
|
15
14
|
"nodes": {
|
|
16
15
|
"ina226": "nodes/ina226/ina226.js",
|
|
@@ -20,9 +19,9 @@
|
|
|
20
19
|
"ade7953": "nodes/ade7953/ade7953.js",
|
|
21
20
|
"axp2101": "nodes/axp2101/axp2101.js",
|
|
22
21
|
"lc709203f": "nodes/lc709203f/lc709203f.js",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
22
|
+
"lm25066": "nodes/lm25066/lm25066.js",
|
|
23
|
+
"ltc4151": "nodes/ltc4151/ltc4151.js",
|
|
24
|
+
"max17048": "nodes/max17048/max17048.js"
|
|
26
25
|
}
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
package/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
module.exports = function(RED) {
|
|
5
|
-
const nodesDir = path.join(__dirname, 'nodes');
|
|
6
|
-
if (!fs.existsSync(nodesDir)) return;
|
|
7
|
-
fs.readdirSync(nodesDir).forEach(function(chip) {
|
|
8
|
-
const nodeFile = path.join(nodesDir, chip, chip + '.js');
|
|
9
|
-
if (fs.existsSync(nodeFile)) require(nodeFile)(RED);
|
|
10
|
-
});
|
|
11
|
-
};
|