@ya-modbus/driver-spm01r 0.0.0-stage → 0.0.0
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 +100 -2
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/src/index.d.ts +49 -0
- package/dist/cjs/src/index.d.ts.map +1 -0
- package/dist/cjs/src/index.js +339 -0
- package/dist/cjs/src/index.js.map +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/src/index.d.ts +49 -0
- package/dist/esm/src/index.d.ts.map +1 -0
- package/dist/esm/src/index.js +335 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +68 -4
package/README.md
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ya-modbus/driver-spm01r
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Bituo SPM01R FLEX single-phase energy meter driver for ya-modbus.
|
|
4
|
+
|
|
5
|
+
> **Not yet confirmed on hardware.** The register list comes from the vendor user guide. No real meter has been tested yet. In particular, the scale of active and apparent power (the guide says kW and kVA) is not confirmed.
|
|
6
|
+
|
|
7
|
+
## Device Information
|
|
8
|
+
|
|
9
|
+
- **Manufacturer**: Bituo Technik
|
|
10
|
+
- **Model**: SPM01R FLEX, order code SPM01-D2M1
|
|
11
|
+
- **Type**: Single-phase + N energy meter, 63 A, built-in current sensor, RS-485 (isolated). Measures energy in both directions.
|
|
12
|
+
- **Communication**: Modbus RTU. Function codes 03 and 04 return the same data. Floats are 32-bit, big-endian (ABCD), 2 registers each.
|
|
13
|
+
- **Default Settings**:
|
|
14
|
+
- Address: 247
|
|
15
|
+
- Baud rate: 9600
|
|
16
|
+
- Parity: None
|
|
17
|
+
- Stop bits: 1
|
|
18
|
+
- Data bits: 8
|
|
19
|
+
|
|
20
|
+
A press of 5 seconds on the reset button restores address, baud rate and format to these defaults.
|
|
21
|
+
|
|
22
|
+
The same user guide also covers the 3-phase SPM02R. It is not supported by this driver.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @ya-modbus/driver-spm01r
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { createDriver, DEFAULT_CONFIG } from '@ya-modbus/driver-spm01r'
|
|
34
|
+
import { createRTUTransport } from '@ya-modbus/transport'
|
|
35
|
+
|
|
36
|
+
const transport = await createRTUTransport({
|
|
37
|
+
port: '/dev/ttyUSB0',
|
|
38
|
+
baudRate: DEFAULT_CONFIG.baudRate,
|
|
39
|
+
parity: DEFAULT_CONFIG.parity,
|
|
40
|
+
dataBits: DEFAULT_CONFIG.dataBits,
|
|
41
|
+
stopBits: DEFAULT_CONFIG.stopBits,
|
|
42
|
+
slaveId: DEFAULT_CONFIG.defaultAddress,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const driver = await createDriver({ transport, slaveId: DEFAULT_CONFIG.defaultAddress })
|
|
46
|
+
|
|
47
|
+
const values = await driver.readDataPoints(['voltage', 'active_power', 'active_energy_total'])
|
|
48
|
+
console.log(values)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Data Points
|
|
52
|
+
|
|
53
|
+
### Measurements
|
|
54
|
+
|
|
55
|
+
Read-only, polled on every poll. All 12 come from one request: 24 holding registers from 20000.
|
|
56
|
+
|
|
57
|
+
| ID | Register | Type, scale | Unit |
|
|
58
|
+
| ---------------------------------- | ----------- | -------------------------- | ---- |
|
|
59
|
+
| `voltage` | 20000-20001 | float32 | V |
|
|
60
|
+
| `current` | 20002-20003 | float32 | A |
|
|
61
|
+
| `active_power` | 20004-20005 | float32, x1000 (kW to W) | W |
|
|
62
|
+
| `power_factor` | 20006-20007 | float32 | - |
|
|
63
|
+
| `frequency` | 20008-20009 | float32 | Hz |
|
|
64
|
+
| `active_energy_forward_resettable` | 20010-20011 | float32 | kWh |
|
|
65
|
+
| `active_energy_reverse_resettable` | 20012-20013 | float32 | kWh |
|
|
66
|
+
| `active_energy_total_resettable` | 20014-20015 | float32 | kWh |
|
|
67
|
+
| `active_energy_forward` | 20016-20017 | float32 | kWh |
|
|
68
|
+
| `active_energy_reverse` | 20018-20019 | float32 | kWh |
|
|
69
|
+
| `active_energy_total` | 20020-20021 | float32 | kWh |
|
|
70
|
+
| `apparent_power` | 20022-20023 | float32, x1000 (kVA to VA) | VA |
|
|
71
|
+
|
|
72
|
+
The guide marks only the first two (registers 20010 and 20012) as "can be reset". Register 20014 is listed just as "Total (absolute)"; it is probably resettable too, because register 20020 is its non-resettable copy, but this is not confirmed on hardware. The last three (`active_energy_forward`, `active_energy_reverse`, `active_energy_total`) are the non-resettable lifetime counters. Names follow `driver-or-we-516` and `driver-sdm630`: `total` never means a resettable value without the `_resettable` suffix.
|
|
73
|
+
|
|
74
|
+
### Settings
|
|
75
|
+
|
|
76
|
+
Read/write, `pollType: 'on-demand'`.
|
|
77
|
+
|
|
78
|
+
| ID | Register | Values |
|
|
79
|
+
| ---------------- | -------- | ----------------------------------------------- |
|
|
80
|
+
| `device_address` | 6000 | 1-247 |
|
|
81
|
+
| `baud_rate` | 6001 | 2400, 4800, 9600, 19200, 38400 |
|
|
82
|
+
| `parity` | 6002 | `none`, `even`, `odd` (8 data bits, 1 stop bit) |
|
|
83
|
+
|
|
84
|
+
Notes on the codes:
|
|
85
|
+
|
|
86
|
+
- Baud rate: the guide lists codes 0 and 3 both as 9600. Reading accepts both. Writing 9600 sends code 3.
|
|
87
|
+
- Parity: code 3 is "no parity, 2 stop bits". It reads as `none` (stop bits are not a data point), so a read `none` may mean 2 stop bits. It cannot be written. Writing `none` sets N81 (1 stop bit).
|
|
88
|
+
|
|
89
|
+
### Not exposed
|
|
90
|
+
|
|
91
|
+
Register 10000 (LED blink), 10001 (energy reset) and 30000 (broadcast address change) are commands, not data points. The driver never writes them.
|
|
92
|
+
|
|
93
|
+
## Sources
|
|
94
|
+
|
|
95
|
+
- User guide V1.2, page "Modbus Register List": https://downloads.bituo-technik.com/User-Guide/SPM01R02R-All-in-One_User-Guide_ENCN.pdf
|
|
96
|
+
- Product docs: https://docs.bituo-technik.com/product-document/spm-series/spm01r-flex
|
|
97
|
+
- Datasheet: https://downloads.bituo-technik.com/Datasheet/SPM01R-FLEX-All_Datasheet_EN.pdf
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
GPL-3.0-or-later
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bituo SPM01R FLEX Single-Phase Energy Meter Driver
|
|
3
|
+
*
|
|
4
|
+
* Single-phase + N energy meter, 63 A, built-in current sensor, RS-485, Modbus RTU.
|
|
5
|
+
*
|
|
6
|
+
* Factory default specifications are exported via the DEFAULT_CONFIG constant.
|
|
7
|
+
* See DEFAULT_CONFIG for baud rate, parity, data bits, stop bits, and default address.
|
|
8
|
+
*
|
|
9
|
+
* Register mapping (from the vendor user guide, not yet confirmed on hardware):
|
|
10
|
+
* - 20000-20023: 12 float32 values, big-endian (ABCD), read in one request of 24 registers
|
|
11
|
+
* - 6000: Modbus address, 6001: baud rate code, 6002: parity and stop bits code
|
|
12
|
+
*
|
|
13
|
+
* The guide prints active and apparent power in kW and kVA. The driver multiplies them
|
|
14
|
+
* by 1000 and returns W and VA. This scale is not yet confirmed on hardware.
|
|
15
|
+
*
|
|
16
|
+
* Not exposed on purpose: 10000 (LED blink), 10001 (energy reset), 30000 (broadcast address).
|
|
17
|
+
*/
|
|
18
|
+
import type { CreateDriverFunction } from '@ya-modbus/driver-types';
|
|
19
|
+
/**
|
|
20
|
+
* Supported configuration values for SPM01R
|
|
21
|
+
*
|
|
22
|
+
* The meter also has a "no parity, 2 stop bits" mode (code 3). It is not listed here:
|
|
23
|
+
* the driver supports 1 stop bit only.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SUPPORTED_CONFIG: {
|
|
26
|
+
readonly validBaudRates: readonly [2400, 4800, 9600, 19200, 38400];
|
|
27
|
+
readonly validParity: readonly ["none", "even", "odd"];
|
|
28
|
+
readonly validDataBits: readonly [8];
|
|
29
|
+
readonly validStopBits: readonly [1];
|
|
30
|
+
readonly validAddressRange: readonly [1, 247];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Default SPM01R device configuration
|
|
34
|
+
*
|
|
35
|
+
* Use these values when connecting to a factory-default SPM01R device.
|
|
36
|
+
* A 5 second press of the reset button restores them.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DEFAULT_CONFIG: {
|
|
39
|
+
readonly baudRate: 9600;
|
|
40
|
+
readonly parity: "none";
|
|
41
|
+
readonly dataBits: 8;
|
|
42
|
+
readonly stopBits: 1;
|
|
43
|
+
readonly defaultAddress: 247;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Create SPM01R device driver
|
|
47
|
+
*/
|
|
48
|
+
export declare const createDriver: CreateDriverFunction;
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,OAAO,KAAK,EACV,oBAAoB,EAMrB,MAAM,yBAAyB,CAAA;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;CAMa,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;CAMa,CAAA;AAgOxC;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,oBA4G1B,CAAA"}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bituo SPM01R FLEX Single-Phase Energy Meter Driver
|
|
4
|
+
*
|
|
5
|
+
* Single-phase + N energy meter, 63 A, built-in current sensor, RS-485, Modbus RTU.
|
|
6
|
+
*
|
|
7
|
+
* Factory default specifications are exported via the DEFAULT_CONFIG constant.
|
|
8
|
+
* See DEFAULT_CONFIG for baud rate, parity, data bits, stop bits, and default address.
|
|
9
|
+
*
|
|
10
|
+
* Register mapping (from the vendor user guide, not yet confirmed on hardware):
|
|
11
|
+
* - 20000-20023: 12 float32 values, big-endian (ABCD), read in one request of 24 registers
|
|
12
|
+
* - 6000: Modbus address, 6001: baud rate code, 6002: parity and stop bits code
|
|
13
|
+
*
|
|
14
|
+
* The guide prints active and apparent power in kW and kVA. The driver multiplies them
|
|
15
|
+
* by 1000 and returns W and VA. This scale is not yet confirmed on hardware.
|
|
16
|
+
*
|
|
17
|
+
* Not exposed on purpose: 10000 (LED blink), 10001 (energy reset), 30000 (broadcast address).
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.createDriver = exports.DEFAULT_CONFIG = exports.SUPPORTED_CONFIG = void 0;
|
|
21
|
+
const driver_sdk_1 = require("@ya-modbus/driver-sdk");
|
|
22
|
+
/**
|
|
23
|
+
* Supported configuration values for SPM01R
|
|
24
|
+
*
|
|
25
|
+
* The meter also has a "no parity, 2 stop bits" mode (code 3). It is not listed here:
|
|
26
|
+
* the driver supports 1 stop bit only.
|
|
27
|
+
*/
|
|
28
|
+
exports.SUPPORTED_CONFIG = {
|
|
29
|
+
validBaudRates: [2400, 4800, 9600, 19200, 38400],
|
|
30
|
+
validParity: ['none', 'even', 'odd'],
|
|
31
|
+
validDataBits: [8],
|
|
32
|
+
validStopBits: [1],
|
|
33
|
+
validAddressRange: [1, 247],
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Default SPM01R device configuration
|
|
37
|
+
*
|
|
38
|
+
* Use these values when connecting to a factory-default SPM01R device.
|
|
39
|
+
* A 5 second press of the reset button restores them.
|
|
40
|
+
*/
|
|
41
|
+
exports.DEFAULT_CONFIG = {
|
|
42
|
+
baudRate: 9600,
|
|
43
|
+
parity: 'none',
|
|
44
|
+
dataBits: 8,
|
|
45
|
+
stopBits: 1,
|
|
46
|
+
defaultAddress: 247,
|
|
47
|
+
};
|
|
48
|
+
/** First register of the measurement block and its size in registers */
|
|
49
|
+
const MEASUREMENT_ADDRESS = 20000;
|
|
50
|
+
const MEASUREMENT_COUNT = 24;
|
|
51
|
+
/** Settings registers: address, baud rate, parity (neighbours, read together) */
|
|
52
|
+
const ADDRESS_REGISTER = 6000;
|
|
53
|
+
const BAUD_RATE_REGISTER = 6001;
|
|
54
|
+
const PARITY_REGISTER = 6002;
|
|
55
|
+
const SETTINGS_COUNT = 3;
|
|
56
|
+
const MEASUREMENTS = [
|
|
57
|
+
{
|
|
58
|
+
id: 'voltage',
|
|
59
|
+
name: 'Voltage',
|
|
60
|
+
unit: 'V',
|
|
61
|
+
decimals: 1,
|
|
62
|
+
description: 'Line voltage',
|
|
63
|
+
register: 20000,
|
|
64
|
+
factor: 1,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'current',
|
|
68
|
+
name: 'Current',
|
|
69
|
+
unit: 'A',
|
|
70
|
+
decimals: 3,
|
|
71
|
+
description: 'Line current',
|
|
72
|
+
register: 20002,
|
|
73
|
+
factor: 1,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'active_power',
|
|
77
|
+
name: 'Active Power',
|
|
78
|
+
unit: 'W',
|
|
79
|
+
decimals: 1,
|
|
80
|
+
description: 'Active power in watts (the register is in kW)',
|
|
81
|
+
register: 20004,
|
|
82
|
+
factor: 1000,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'power_factor',
|
|
86
|
+
name: 'Power Factor',
|
|
87
|
+
decimals: 3,
|
|
88
|
+
description: 'Power factor',
|
|
89
|
+
register: 20006,
|
|
90
|
+
factor: 1,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'frequency',
|
|
94
|
+
name: 'Grid Frequency',
|
|
95
|
+
unit: 'Hz',
|
|
96
|
+
decimals: 2,
|
|
97
|
+
description: 'Grid frequency',
|
|
98
|
+
register: 20008,
|
|
99
|
+
factor: 1,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'active_energy_forward_resettable',
|
|
103
|
+
name: 'Forward Active Energy (resettable)',
|
|
104
|
+
unit: 'kWh',
|
|
105
|
+
decimals: 2,
|
|
106
|
+
description: 'Forward (import) active energy; the guide says it can be reset',
|
|
107
|
+
register: 20010,
|
|
108
|
+
factor: 1,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'active_energy_reverse_resettable',
|
|
112
|
+
name: 'Reverse Active Energy (resettable)',
|
|
113
|
+
unit: 'kWh',
|
|
114
|
+
decimals: 2,
|
|
115
|
+
description: 'Reverse (export) active energy; the guide says it can be reset',
|
|
116
|
+
register: 20012,
|
|
117
|
+
factor: 1,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 'active_energy_total_resettable',
|
|
121
|
+
name: 'Total Active Energy (resettable)',
|
|
122
|
+
unit: 'kWh',
|
|
123
|
+
decimals: 2,
|
|
124
|
+
description: 'Total (absolute) active energy; probably resettable like the two above, as 20020 is its non-resettable copy (not confirmed on hardware)',
|
|
125
|
+
register: 20014,
|
|
126
|
+
factor: 1,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 'active_energy_forward',
|
|
130
|
+
name: 'Forward Active Energy',
|
|
131
|
+
unit: 'kWh',
|
|
132
|
+
decimals: 2,
|
|
133
|
+
description: 'Forward (import) active energy, cannot be reset',
|
|
134
|
+
register: 20016,
|
|
135
|
+
factor: 1,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'active_energy_reverse',
|
|
139
|
+
name: 'Reverse Active Energy',
|
|
140
|
+
unit: 'kWh',
|
|
141
|
+
decimals: 2,
|
|
142
|
+
description: 'Reverse (export) active energy, cannot be reset',
|
|
143
|
+
register: 20018,
|
|
144
|
+
factor: 1,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: 'active_energy_total',
|
|
148
|
+
name: 'Total Active Energy',
|
|
149
|
+
unit: 'kWh',
|
|
150
|
+
decimals: 2,
|
|
151
|
+
description: 'Total (absolute) active energy, cannot be reset',
|
|
152
|
+
register: 20020,
|
|
153
|
+
factor: 1,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: 'apparent_power',
|
|
157
|
+
name: 'Apparent Power',
|
|
158
|
+
unit: 'VA',
|
|
159
|
+
decimals: 1,
|
|
160
|
+
description: 'Apparent power in volt-amperes (the register is in kVA)',
|
|
161
|
+
register: 20022,
|
|
162
|
+
factor: 1000,
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
/** Baud rate codes. The guide lists 0 and 3 both as 9600; the driver writes 3. */
|
|
166
|
+
const BAUD_RATE_DECODE = {
|
|
167
|
+
0: 9600,
|
|
168
|
+
1: 2400,
|
|
169
|
+
2: 4800,
|
|
170
|
+
3: 9600,
|
|
171
|
+
4: 19200,
|
|
172
|
+
5: 38400,
|
|
173
|
+
};
|
|
174
|
+
const BAUD_RATE_ENCODE = { 2400: 1, 4800: 2, 9600: 3, 19200: 4, 38400: 5 };
|
|
175
|
+
/**
|
|
176
|
+
* Parity codes. Code 3 is no parity with 2 stop bits; it reads as 'none'
|
|
177
|
+
* because stop bits are not a data point.
|
|
178
|
+
*/
|
|
179
|
+
const PARITY_DECODE = { 0: 'none', 1: 'even', 2: 'odd', 3: 'none' };
|
|
180
|
+
const PARITY_ENCODE = { none: 0, even: 1, odd: 2 };
|
|
181
|
+
const SETTING_IDS = ['device_address', 'baud_rate', 'parity'];
|
|
182
|
+
const DATA_POINTS = [
|
|
183
|
+
...MEASUREMENTS.map(({ id, name, unit, decimals, description }) => ({
|
|
184
|
+
id,
|
|
185
|
+
name,
|
|
186
|
+
type: 'float',
|
|
187
|
+
...(unit && { unit }),
|
|
188
|
+
access: 'r',
|
|
189
|
+
description,
|
|
190
|
+
decimals,
|
|
191
|
+
})),
|
|
192
|
+
{
|
|
193
|
+
id: 'device_address',
|
|
194
|
+
name: 'Device Address',
|
|
195
|
+
type: 'integer',
|
|
196
|
+
access: 'rw',
|
|
197
|
+
pollType: 'on-demand',
|
|
198
|
+
description: 'Modbus device address (1-247)',
|
|
199
|
+
min: 1,
|
|
200
|
+
max: 247,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: 'baud_rate',
|
|
204
|
+
name: 'Baud Rate',
|
|
205
|
+
type: 'enum',
|
|
206
|
+
access: 'rw',
|
|
207
|
+
pollType: 'on-demand',
|
|
208
|
+
description: 'Serial baud rate',
|
|
209
|
+
enumValues: {
|
|
210
|
+
2400: '2400 bps',
|
|
211
|
+
4800: '4800 bps',
|
|
212
|
+
9600: '9600 bps',
|
|
213
|
+
19200: '19200 bps',
|
|
214
|
+
38400: '38400 bps',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: 'parity',
|
|
219
|
+
name: 'Parity',
|
|
220
|
+
type: 'enum',
|
|
221
|
+
access: 'rw',
|
|
222
|
+
pollType: 'on-demand',
|
|
223
|
+
description: "Serial parity, 8 data bits. Writing 'none' sets N81 (1 stop bit). When read, 'none' may also mean N82 (2 stop bits), which this driver cannot write",
|
|
224
|
+
enumValues: { none: 'None', even: 'Even', odd: 'Odd' },
|
|
225
|
+
},
|
|
226
|
+
];
|
|
227
|
+
const MEASUREMENT_BY_ID = new Map(MEASUREMENTS.map((m) => [m.id, m]));
|
|
228
|
+
const isValidBaudRate = (0, driver_sdk_1.createEnumValidator)(exports.SUPPORTED_CONFIG.validBaudRates);
|
|
229
|
+
const isValidParity = (0, driver_sdk_1.createEnumValidator)(exports.SUPPORTED_CONFIG.validParity);
|
|
230
|
+
const isValidAddress = (0, driver_sdk_1.createRangeValidator)(...exports.SUPPORTED_CONFIG.validAddressRange);
|
|
231
|
+
function decodeBaudRate(code) {
|
|
232
|
+
const baudRate = BAUD_RATE_DECODE[code];
|
|
233
|
+
if (baudRate === undefined) {
|
|
234
|
+
throw new Error(`Unknown baud rate encoding from device: ${code}`);
|
|
235
|
+
}
|
|
236
|
+
return baudRate;
|
|
237
|
+
}
|
|
238
|
+
function decodeParity(code) {
|
|
239
|
+
const parity = PARITY_DECODE[code];
|
|
240
|
+
if (parity === undefined) {
|
|
241
|
+
throw new Error(`Unknown parity encoding from device: ${code}`);
|
|
242
|
+
}
|
|
243
|
+
return parity;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Create SPM01R device driver
|
|
247
|
+
*/
|
|
248
|
+
const createDriver = (config) => {
|
|
249
|
+
const { transport } = config;
|
|
250
|
+
function assertKnown(ids) {
|
|
251
|
+
const unknown = ids.filter((id) => !MEASUREMENT_BY_ID.has(id) && !SETTING_IDS.includes(id));
|
|
252
|
+
if (unknown.length > 0) {
|
|
253
|
+
throw new Error(unknown.length === 1 && ids.length === 1
|
|
254
|
+
? `Unknown data point: ${unknown[0]}`
|
|
255
|
+
: `Unknown data points: ${unknown.join(', ')}`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
async function readMeasurements(ids) {
|
|
259
|
+
const buffer = await transport.readHoldingRegisters(MEASUREMENT_ADDRESS, MEASUREMENT_COUNT);
|
|
260
|
+
if (buffer.length < MEASUREMENT_COUNT * 2) {
|
|
261
|
+
throw new Error(`Buffer too short: expected at least ${MEASUREMENT_COUNT * 2} bytes, got ${buffer.length}`);
|
|
262
|
+
}
|
|
263
|
+
const result = {};
|
|
264
|
+
for (const id of ids) {
|
|
265
|
+
const { register, factor } = MEASUREMENT_BY_ID.get(id);
|
|
266
|
+
result[id] = buffer.readFloatBE((register - MEASUREMENT_ADDRESS) * 2) * factor;
|
|
267
|
+
}
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
const driver = {
|
|
271
|
+
name: 'SPM01R',
|
|
272
|
+
manufacturer: 'Bituo Technik',
|
|
273
|
+
model: 'SPM01R FLEX',
|
|
274
|
+
dataPoints: DATA_POINTS,
|
|
275
|
+
async readDataPoint(id) {
|
|
276
|
+
assertKnown([id]);
|
|
277
|
+
if (id === 'device_address') {
|
|
278
|
+
return (await transport.readHoldingRegisters(ADDRESS_REGISTER, 1)).readUInt16BE(0);
|
|
279
|
+
}
|
|
280
|
+
if (id === 'baud_rate') {
|
|
281
|
+
return decodeBaudRate((await transport.readHoldingRegisters(BAUD_RATE_REGISTER, 1)).readUInt16BE(0));
|
|
282
|
+
}
|
|
283
|
+
if (id === 'parity') {
|
|
284
|
+
return decodeParity((await transport.readHoldingRegisters(PARITY_REGISTER, 1)).readUInt16BE(0));
|
|
285
|
+
}
|
|
286
|
+
return (await readMeasurements([id]))[id];
|
|
287
|
+
},
|
|
288
|
+
async readDataPoints(ids) {
|
|
289
|
+
assertKnown(ids);
|
|
290
|
+
const result = {};
|
|
291
|
+
const measurementIds = ids.filter((id) => MEASUREMENT_BY_ID.has(id));
|
|
292
|
+
if (measurementIds.length > 0) {
|
|
293
|
+
Object.assign(result, await readMeasurements(measurementIds));
|
|
294
|
+
}
|
|
295
|
+
const settingIds = ids.filter((id) => SETTING_IDS.includes(id));
|
|
296
|
+
if (settingIds.length > 0) {
|
|
297
|
+
const buffer = await transport.readHoldingRegisters(ADDRESS_REGISTER, SETTINGS_COUNT);
|
|
298
|
+
for (const id of settingIds) {
|
|
299
|
+
if (id === 'device_address')
|
|
300
|
+
result[id] = buffer.readUInt16BE(0);
|
|
301
|
+
else if (id === 'baud_rate')
|
|
302
|
+
result[id] = decodeBaudRate(buffer.readUInt16BE(2));
|
|
303
|
+
else
|
|
304
|
+
result[id] = decodeParity(buffer.readUInt16BE(4));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return result;
|
|
308
|
+
},
|
|
309
|
+
async writeDataPoint(id, value) {
|
|
310
|
+
assertKnown([id]);
|
|
311
|
+
if (id === 'device_address') {
|
|
312
|
+
const [min, max] = exports.SUPPORTED_CONFIG.validAddressRange;
|
|
313
|
+
if (!(0, driver_sdk_1.isValidInteger)(value) || !isValidAddress(value)) {
|
|
314
|
+
throw new Error((0, driver_sdk_1.formatRangeError)('device address', value, min, max));
|
|
315
|
+
}
|
|
316
|
+
await transport.writeSingleRegister(ADDRESS_REGISTER, value);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (id === 'baud_rate') {
|
|
320
|
+
if (!isValidBaudRate(value)) {
|
|
321
|
+
throw new Error((0, driver_sdk_1.formatEnumError)('baud rate', value, exports.SUPPORTED_CONFIG.validBaudRates));
|
|
322
|
+
}
|
|
323
|
+
await transport.writeSingleRegister(BAUD_RATE_REGISTER, BAUD_RATE_ENCODE[value]);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (id === 'parity') {
|
|
327
|
+
if (!isValidParity(value)) {
|
|
328
|
+
throw new Error((0, driver_sdk_1.formatEnumError)('parity', value, exports.SUPPORTED_CONFIG.validParity));
|
|
329
|
+
}
|
|
330
|
+
await transport.writeSingleRegister(PARITY_REGISTER, PARITY_ENCODE[value]);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
throw new Error(`Data point ${id} is read-only`);
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
return Promise.resolve(driver);
|
|
337
|
+
};
|
|
338
|
+
exports.createDriver = createDriver;
|
|
339
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,sDAM8B;AAU9B;;;;;GAKG;AACU,QAAA,gBAAgB,GAAG;IAC9B,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC;IAChD,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,C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