node-red-contrib-periph-light 1.5.4 → 1.6.1

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.
@@ -0,0 +1,196 @@
1
+ [
2
+ {
3
+ "id": "tab-vcnl4040-demo",
4
+ "type": "tab",
5
+ "label": "VCNL4040 Presence Light Demo",
6
+ "disabled": false,
7
+ "info": "Presence-activated display light on a VCNL4040 proximity and ambient light sensor (I²C 0x60). An inject node fires every 200 ms into vcnl4040. A function node applies a close/away hysteresis to the proximity count (close above 1000, away below 300 counts) and only passes a message when the state changes; a switch node routes 'close' to a \"wake display\" message and 'away' to a \"dim display\" message. A second debug node shows the ambient light in lux. Move a hand towards the sensor to wake the display; adjust the thresholds in the function node for your cover glass and target."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read every 200 ms",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "0.2",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-vcnl4040-demo",
21
+ "x": 150,
22
+ "y": 140,
23
+ "wires": [
24
+ [
25
+ "vcnl4040-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "vcnl4040-device-1",
31
+ "type": "vcnl4040-device",
32
+ "name": "VCNL4040",
33
+ "bus": "1",
34
+ "integration": "80",
35
+ "current": "100",
36
+ "resolution": "16"
37
+ },
38
+ {
39
+ "id": "vcnl4040-node",
40
+ "type": "vcnl4040",
41
+ "name": "VCNL4040",
42
+ "z": "tab-vcnl4040-demo",
43
+ "x": 360,
44
+ "y": 140,
45
+ "wires": [
46
+ [
47
+ "fn-hysteresis",
48
+ "fn-lux"
49
+ ]
50
+ ],
51
+ "device": "vcnl4040-device-1"
52
+ },
53
+ {
54
+ "id": "fn-hysteresis",
55
+ "type": "function",
56
+ "name": "close/away hysteresis",
57
+ "func": "// Close above 1000 counts, away below 300; only report changes.\nconst CLOSE = 1000, AWAY = 300;\nconst p = msg.payload.proximity;\nlet state = context.get('state') || 'away';\nif (state === 'away' && p > CLOSE) state = 'close';\nelse if (state === 'close' && p < AWAY) state = 'away';\nelse return null;\ncontext.set('state', state);\nnode.status({ text: state + ' (' + p + ')' });\nreturn { payload: state, topic: 'presence' };",
58
+ "outputs": 1,
59
+ "noerr": 0,
60
+ "z": "tab-vcnl4040-demo",
61
+ "x": 580,
62
+ "y": 120,
63
+ "wires": [
64
+ [
65
+ "sw-state"
66
+ ]
67
+ ]
68
+ },
69
+ {
70
+ "id": "sw-state",
71
+ "type": "switch",
72
+ "name": "close / away",
73
+ "property": "payload",
74
+ "propertyType": "msg",
75
+ "rules": [
76
+ {
77
+ "t": "eq",
78
+ "v": "close",
79
+ "vt": "str"
80
+ },
81
+ {
82
+ "t": "eq",
83
+ "v": "away",
84
+ "vt": "str"
85
+ }
86
+ ],
87
+ "checkall": "true",
88
+ "repair": false,
89
+ "outputs": 2,
90
+ "z": "tab-vcnl4040-demo",
91
+ "x": 790,
92
+ "y": 120,
93
+ "wires": [
94
+ [
95
+ "chg-wake"
96
+ ],
97
+ [
98
+ "chg-dim"
99
+ ]
100
+ ]
101
+ },
102
+ {
103
+ "id": "chg-wake",
104
+ "type": "change",
105
+ "name": "wake display",
106
+ "rules": [
107
+ {
108
+ "t": "set",
109
+ "p": "payload",
110
+ "pt": "msg",
111
+ "to": "wake display",
112
+ "tot": "str"
113
+ }
114
+ ],
115
+ "z": "tab-vcnl4040-demo",
116
+ "x": 990,
117
+ "y": 100,
118
+ "wires": [
119
+ [
120
+ "dbg-display"
121
+ ]
122
+ ]
123
+ },
124
+ {
125
+ "id": "chg-dim",
126
+ "type": "change",
127
+ "name": "dim display",
128
+ "rules": [
129
+ {
130
+ "t": "set",
131
+ "p": "payload",
132
+ "pt": "msg",
133
+ "to": "dim display",
134
+ "tot": "str"
135
+ }
136
+ ],
137
+ "z": "tab-vcnl4040-demo",
138
+ "x": 990,
139
+ "y": 140,
140
+ "wires": [
141
+ [
142
+ "dbg-display"
143
+ ]
144
+ ]
145
+ },
146
+ {
147
+ "id": "dbg-display",
148
+ "type": "debug",
149
+ "name": "display",
150
+ "active": true,
151
+ "tosidebar": true,
152
+ "console": false,
153
+ "tostatus": true,
154
+ "complete": "payload",
155
+ "targetType": "msg",
156
+ "statusVal": "payload",
157
+ "statusType": "auto",
158
+ "z": "tab-vcnl4040-demo",
159
+ "x": 1180,
160
+ "y": 120,
161
+ "wires": []
162
+ },
163
+ {
164
+ "id": "fn-lux",
165
+ "type": "function",
166
+ "name": "lux",
167
+ "func": "// Ambient light for the debug sidebar.\nreturn { payload: Math.round(msg.payload.lux * 10) / 10, topic: 'lux' };",
168
+ "outputs": 1,
169
+ "noerr": 0,
170
+ "z": "tab-vcnl4040-demo",
171
+ "x": 560,
172
+ "y": 200,
173
+ "wires": [
174
+ [
175
+ "dbg-lux"
176
+ ]
177
+ ]
178
+ },
179
+ {
180
+ "id": "dbg-lux",
181
+ "type": "debug",
182
+ "name": "lux",
183
+ "active": true,
184
+ "tosidebar": true,
185
+ "console": false,
186
+ "tostatus": true,
187
+ "complete": "payload",
188
+ "targetType": "msg",
189
+ "statusVal": "payload",
190
+ "statusType": "auto",
191
+ "z": "tab-vcnl4040-demo",
192
+ "x": 750,
193
+ "y": 200,
194
+ "wires": []
195
+ }
196
+ ]
@@ -0,0 +1,196 @@
1
+ [
2
+ {
3
+ "id": "tab-vcnl4200-demo",
4
+ "type": "tab",
5
+ "label": "VCNL4200 Presence Light Demo",
6
+ "disabled": false,
7
+ "info": "Presence-activated display light on a VCNL4200 proximity and ambient light sensor (I²C 0x51). An inject node fires every 200 ms into vcnl4200. A function node applies a close/away hysteresis to the proximity count (close above 1000, away below 300 counts) and only passes a message when the state changes; a switch node routes 'close' to a \"wake display\" message and 'away' to a \"dim display\" message. A second debug node shows the ambient light in lux. Move a hand towards the sensor to wake the display; adjust the thresholds in the function node for your cover glass and target."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read every 200 ms",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "0.2",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-vcnl4200-demo",
21
+ "x": 150,
22
+ "y": 140,
23
+ "wires": [
24
+ [
25
+ "vcnl4200-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "vcnl4200-device-1",
31
+ "type": "vcnl4200-device",
32
+ "name": "VCNL4200",
33
+ "bus": "1",
34
+ "integration": "50",
35
+ "current": "100",
36
+ "resolution": "16"
37
+ },
38
+ {
39
+ "id": "vcnl4200-node",
40
+ "type": "vcnl4200",
41
+ "name": "VCNL4200",
42
+ "z": "tab-vcnl4200-demo",
43
+ "x": 360,
44
+ "y": 140,
45
+ "wires": [
46
+ [
47
+ "fn-hysteresis",
48
+ "fn-lux"
49
+ ]
50
+ ],
51
+ "device": "vcnl4200-device-1"
52
+ },
53
+ {
54
+ "id": "fn-hysteresis",
55
+ "type": "function",
56
+ "name": "close/away hysteresis",
57
+ "func": "// Close above 1000 counts, away below 300; only report changes.\nconst CLOSE = 1000, AWAY = 300;\nconst p = msg.payload.proximity;\nlet state = context.get('state') || 'away';\nif (state === 'away' && p > CLOSE) state = 'close';\nelse if (state === 'close' && p < AWAY) state = 'away';\nelse return null;\ncontext.set('state', state);\nnode.status({ text: state + ' (' + p + ')' });\nreturn { payload: state, topic: 'presence' };",
58
+ "outputs": 1,
59
+ "noerr": 0,
60
+ "z": "tab-vcnl4200-demo",
61
+ "x": 580,
62
+ "y": 120,
63
+ "wires": [
64
+ [
65
+ "sw-state"
66
+ ]
67
+ ]
68
+ },
69
+ {
70
+ "id": "sw-state",
71
+ "type": "switch",
72
+ "name": "close / away",
73
+ "property": "payload",
74
+ "propertyType": "msg",
75
+ "rules": [
76
+ {
77
+ "t": "eq",
78
+ "v": "close",
79
+ "vt": "str"
80
+ },
81
+ {
82
+ "t": "eq",
83
+ "v": "away",
84
+ "vt": "str"
85
+ }
86
+ ],
87
+ "checkall": "true",
88
+ "repair": false,
89
+ "outputs": 2,
90
+ "z": "tab-vcnl4200-demo",
91
+ "x": 790,
92
+ "y": 120,
93
+ "wires": [
94
+ [
95
+ "chg-wake"
96
+ ],
97
+ [
98
+ "chg-dim"
99
+ ]
100
+ ]
101
+ },
102
+ {
103
+ "id": "chg-wake",
104
+ "type": "change",
105
+ "name": "wake display",
106
+ "rules": [
107
+ {
108
+ "t": "set",
109
+ "p": "payload",
110
+ "pt": "msg",
111
+ "to": "wake display",
112
+ "tot": "str"
113
+ }
114
+ ],
115
+ "z": "tab-vcnl4200-demo",
116
+ "x": 990,
117
+ "y": 100,
118
+ "wires": [
119
+ [
120
+ "dbg-display"
121
+ ]
122
+ ]
123
+ },
124
+ {
125
+ "id": "chg-dim",
126
+ "type": "change",
127
+ "name": "dim display",
128
+ "rules": [
129
+ {
130
+ "t": "set",
131
+ "p": "payload",
132
+ "pt": "msg",
133
+ "to": "dim display",
134
+ "tot": "str"
135
+ }
136
+ ],
137
+ "z": "tab-vcnl4200-demo",
138
+ "x": 990,
139
+ "y": 140,
140
+ "wires": [
141
+ [
142
+ "dbg-display"
143
+ ]
144
+ ]
145
+ },
146
+ {
147
+ "id": "dbg-display",
148
+ "type": "debug",
149
+ "name": "display",
150
+ "active": true,
151
+ "tosidebar": true,
152
+ "console": false,
153
+ "tostatus": true,
154
+ "complete": "payload",
155
+ "targetType": "msg",
156
+ "statusVal": "payload",
157
+ "statusType": "auto",
158
+ "z": "tab-vcnl4200-demo",
159
+ "x": 1180,
160
+ "y": 120,
161
+ "wires": []
162
+ },
163
+ {
164
+ "id": "fn-lux",
165
+ "type": "function",
166
+ "name": "lux",
167
+ "func": "// Ambient light for the debug sidebar.\nreturn { payload: Math.round(msg.payload.lux * 10) / 10, topic: 'lux' };",
168
+ "outputs": 1,
169
+ "noerr": 0,
170
+ "z": "tab-vcnl4200-demo",
171
+ "x": 560,
172
+ "y": 200,
173
+ "wires": [
174
+ [
175
+ "dbg-lux"
176
+ ]
177
+ ]
178
+ },
179
+ {
180
+ "id": "dbg-lux",
181
+ "type": "debug",
182
+ "name": "lux",
183
+ "active": true,
184
+ "tosidebar": true,
185
+ "console": false,
186
+ "tostatus": true,
187
+ "complete": "payload",
188
+ "targetType": "msg",
189
+ "statusVal": "payload",
190
+ "statusType": "auto",
191
+ "z": "tab-vcnl4200-demo",
192
+ "x": 750,
193
+ "y": 200,
194
+ "wires": []
195
+ }
196
+ ]
@@ -0,0 +1,81 @@
1
+ <!-- Config node: one instance per physical device -->
2
+ <script type="text/javascript">
3
+ RED.nodes.registerType('si1133-device', {
4
+ category: 'config',
5
+ defaults: {
6
+ name: { value: '' },
7
+ bus: { value: '1', required: true, validate: RED.validators.number() },
8
+ address: { value: '0x55' }
9
+ },
10
+ label: function() {
11
+ return this.name || ('Si1133 @ ' + this.address + ' (bus ' + this.bus + ')');
12
+ }
13
+ });
14
+ </script>
15
+
16
+ <script type="text/html" data-template-name="si1133-device">
17
+ <div class="form-row">
18
+ <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
19
+ <input type="text" id="node-config-input-name" placeholder="Si1133">
20
+ </div>
21
+ <div class="form-row">
22
+ <label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
23
+ <input type="number" id="node-config-input-bus" min="0" style="width:80px"> &nbsp;(Linux /dev/i2c-N)
24
+ </div>
25
+ <div class="form-row">
26
+ <label for="node-config-input-address"><i class="fa fa-microchip"></i> I²C address</label>
27
+ <select id="node-config-input-address" style="width:120px">
28
+ <option value="0x55">0x55 (AD high)</option>
29
+ <option value="0x52">0x52 (AD low)</option>
30
+ </select>
31
+ </div>
32
+ </script>
33
+
34
+ <!-- Read node -->
35
+ <script type="text/javascript">
36
+ RED.nodes.registerType('si1133', {
37
+ category: 'Peripheral',
38
+ color: '#C084FC',
39
+ defaults: {
40
+ name: { value: '' },
41
+ device: { value: '', type: 'si1133-device', required: true }
42
+ },
43
+ inputs: 1,
44
+ outputs: 1,
45
+ icon: 'bridge.svg',
46
+ label: function() { return this.name || 'Si1133'; },
47
+ paletteLabel: 'Si1133'
48
+ });
49
+ </script>
50
+
51
+ <script type="text/html" data-template-name="si1133">
52
+ <div class="form-row">
53
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
54
+ <input type="text" id="node-input-name" placeholder="Si1133">
55
+ </div>
56
+ <div class="form-row">
57
+ <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
58
+ <input type="text" id="node-input-device">
59
+ </div>
60
+ </script>
61
+
62
+ <script type="text/html" data-help-name="si1133">
63
+ <p>Reads the raw UV and white-light counts from a Silicon Labs Si1133 over I²C (address 0x55 or 0x52)
64
+ with one forced measurement per message.</p>
65
+ <h3>Inputs</h3>
66
+ <dl class="message-properties">
67
+ <dt>payload <span class="property-type">any</span></dt>
68
+ <dd>Any incoming message triggers one measurement.</dd>
69
+ </dl>
70
+ <h3>Outputs</h3>
71
+ <dl class="message-properties">
72
+ <dt>payload.uv <span class="property-type">number</span></dt>
73
+ <dd>Signed 24-bit raw count of the UV channel (UV photodiode, HW_GAIN 9).</dd>
74
+ <dt>payload.white <span class="property-type">number</span></dt>
75
+ <dd>Signed 24-bit raw count of the white-light channel (white photodiode, HW_GAIN 7).</dd>
76
+ </dl>
77
+ <h3>Configuration</h3>
78
+ <p>I²C bus number and I²C address (0x55 with AD pulled up, 0x52 with AD pulled down), set in the
79
+ <b>si1133-device</b> config node. The counts are raw ADC values; the datasheet gives no lux or
80
+ UV-index formula.</p>
81
+ </script>
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ module.exports = function(RED) {
4
+ const { I2CConnection } = require('periph/src/connection/i2c');
5
+ const { Si1133Full } = require('periph/src/chips/light/si1133');
6
+
7
+ function Si1133DeviceNode(config) {
8
+ RED.nodes.createNode(this, config);
9
+ const node = this;
10
+ try {
11
+ const address = parseInt(config.address, 16) || 0x55;
12
+ const connection = new I2CConnection(parseInt(config.bus), address);
13
+ node.connection = connection;
14
+ node.driver = new Si1133Full(connection);
15
+ node.ready = node.driver.init();
16
+ node.ready.catch((e) => {
17
+ node.error('Si1133 init failed: ' + e.message);
18
+ });
19
+ } catch (e) {
20
+ node.error('Si1133 init failed: ' + e.message);
21
+ }
22
+
23
+ node.on('close', function() {
24
+ if (node.connection) node.connection.close();
25
+ });
26
+ }
27
+ RED.nodes.registerType('si1133-device', Si1133DeviceNode);
28
+
29
+ function Si1133ReadNode(config) {
30
+ RED.nodes.createNode(this, config);
31
+ const node = this;
32
+ const deviceNode = RED.nodes.getNode(config.device) || {};
33
+
34
+ node.on('input', async function(msg, send, done) {
35
+ if (!deviceNode.driver) {
36
+ node.error('Si1133 not initialised', msg);
37
+ done();
38
+ return;
39
+ }
40
+ try {
41
+ await deviceNode.ready;
42
+ const { uv, white } = await deviceNode.driver.read();
43
+ msg.payload = { uv, white };
44
+ send(msg);
45
+ done();
46
+ } catch (e) {
47
+ done(e);
48
+ }
49
+ });
50
+ }
51
+ RED.nodes.registerType('si1133', Si1133ReadNode);
52
+ };
@@ -0,0 +1,90 @@
1
+ <!-- Config node: one instance per physical device -->
2
+ <script type="text/javascript">
3
+ RED.nodes.registerType('si1145-device', {
4
+ category: 'config',
5
+ defaults: {
6
+ name: { value: '' },
7
+ bus: { value: '1', required: true, validate: RED.validators.number() },
8
+ address: { value: '0x60' },
9
+ ledLevel: { value: '3', required: true, validate: RED.validators.number() }
10
+ },
11
+ label: function() {
12
+ return this.name || ('Si1145 @ ' + this.address + ' (bus ' + this.bus + ')');
13
+ }
14
+ });
15
+ </script>
16
+
17
+ <script type="text/html" data-template-name="si1145-device">
18
+ <div class="form-row">
19
+ <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
20
+ <input type="text" id="node-config-input-name" placeholder="Si1145">
21
+ </div>
22
+ <div class="form-row">
23
+ <label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
24
+ <input type="number" id="node-config-input-bus" min="0" style="width:80px"> &nbsp;(Linux /dev/i2c-N)
25
+ </div>
26
+ <div class="form-row">
27
+ <label for="node-config-input-address"><i class="fa fa-microchip"></i> I²C address</label>
28
+ <select id="node-config-input-address" style="width:120px">
29
+ <option value="0x60">0x60</option>
30
+ <option value="0x5A">0x5A (older silicon)</option>
31
+ </select>
32
+ </div>
33
+ <div class="form-row">
34
+ <label for="node-config-input-ledLevel"><i class="fa fa-lightbulb-o"></i> LED level</label>
35
+ <input type="number" id="node-config-input-ledLevel" min="0" max="15" style="width:80px"> &nbsp;(0 off … 15 max)
36
+ </div>
37
+ </script>
38
+
39
+ <!-- Read node -->
40
+ <script type="text/javascript">
41
+ RED.nodes.registerType('si1145', {
42
+ category: 'Peripheral',
43
+ color: '#C084FC',
44
+ defaults: {
45
+ name: { value: '' },
46
+ device: { value: '', type: 'si1145-device', required: true }
47
+ },
48
+ inputs: 1,
49
+ outputs: 1,
50
+ icon: 'bridge.svg',
51
+ label: function() { return this.name || 'Si1145'; },
52
+ paletteLabel: 'Si1145'
53
+ });
54
+ </script>
55
+
56
+ <script type="text/html" data-template-name="si1145">
57
+ <div class="form-row">
58
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
59
+ <input type="text" id="node-input-name" placeholder="Si1145">
60
+ </div>
61
+ <div class="form-row">
62
+ <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
63
+ <input type="text" id="node-input-device">
64
+ </div>
65
+ </script>
66
+
67
+ <script type="text/html" data-help-name="si1145">
68
+ <p>Reads proximity, UV index and ambient light from a Silicon Labs Si1145 over I²C (address 0x60)
69
+ with one forced PS + ALS measurement per message.</p>
70
+ <h3>Inputs</h3>
71
+ <dl class="message-properties">
72
+ <dt>payload <span class="property-type">any</span></dt>
73
+ <dd>Any incoming message triggers one measurement.</dd>
74
+ </dl>
75
+ <h3>Outputs</h3>
76
+ <dl class="message-properties">
77
+ <dt>payload.proximity <span class="property-type">number</span></dt>
78
+ <dd>Raw PS1 count from the reflected IR LED light; rises as an object approaches.</dd>
79
+ <dt>payload.uv_index <span class="property-type">number</span></dt>
80
+ <dd>UV index (AUX_DATA / 100 with the default UV coefficients).</dd>
81
+ <dt>payload.visible <span class="property-type">number</span></dt>
82
+ <dd>Raw visible ambient light count.</dd>
83
+ <dt>payload.infrared <span class="property-type">number</span></dt>
84
+ <dd>Raw infrared ambient light count.</dd>
85
+ </dl>
86
+ <h3>Configuration</h3>
87
+ <p>I²C bus number, I²C address (0x60; older silicon 0x5A) and the LED1 current level 0–15
88
+ (default 3), set in the <b>si1145-device</b> config node. Proximity and light values are raw
89
+ counts; the datasheet gives no lux formula.</p>
90
+ </script>
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ module.exports = function(RED) {
4
+ const { I2CConnection } = require('periph/src/connection/i2c');
5
+ const { Si1145Full } = require('periph/src/chips/light/si1145');
6
+
7
+ function Si1145DeviceNode(config) {
8
+ RED.nodes.createNode(this, config);
9
+ const node = this;
10
+ try {
11
+ const address = parseInt(config.address, 16) || 0x60;
12
+ const level = parseInt(config.ledLevel, 10);
13
+ const connection = new I2CConnection(parseInt(config.bus), address);
14
+ node.connection = connection;
15
+ node.driver = new Si1145Full(connection);
16
+ node.ready = node.driver.init().then(() => {
17
+ if (Number.isInteger(level) && level !== 3) return node.driver.setLedCurrent(1, level);
18
+ });
19
+ node.ready.catch((e) => {
20
+ node.error('Si1145 init failed: ' + e.message);
21
+ });
22
+ } catch (e) {
23
+ node.error('Si1145 init failed: ' + e.message);
24
+ }
25
+
26
+ node.on('close', function() {
27
+ if (node.connection) node.connection.close();
28
+ });
29
+ }
30
+ RED.nodes.registerType('si1145-device', Si1145DeviceNode);
31
+
32
+ function Si1145ReadNode(config) {
33
+ RED.nodes.createNode(this, config);
34
+ const node = this;
35
+ const deviceNode = RED.nodes.getNode(config.device) || {};
36
+
37
+ node.on('input', async function(msg, send, done) {
38
+ if (!deviceNode.driver) {
39
+ node.error('Si1145 not initialised', msg);
40
+ done();
41
+ return;
42
+ }
43
+ try {
44
+ await deviceNode.ready;
45
+ const { proximity, uv_index, visible, infrared } = await deviceNode.driver.read();
46
+ msg.payload = { proximity, uv_index, visible, infrared };
47
+ send(msg);
48
+ done();
49
+ } catch (e) {
50
+ done(e);
51
+ }
52
+ });
53
+ }
54
+ RED.nodes.registerType('si1145', Si1145ReadNode);
55
+ };