@ya-modbus/driver-or-we-526 0.0.0-stage → 0.1.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/CHANGELOG.md +10 -0
- package/LICENSE +674 -0
- package/README.md +209 -2
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/src/data-points.d.ts +21 -0
- package/dist/cjs/src/data-points.d.ts.map +1 -0
- package/dist/cjs/src/data-points.js +265 -0
- package/dist/cjs/src/data-points.js.map +1 -0
- package/dist/cjs/src/index.d.ts +39 -0
- package/dist/cjs/src/index.d.ts.map +1 -0
- package/dist/cjs/src/index.js +86 -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/data-points.d.ts +21 -0
- package/dist/esm/src/data-points.d.ts.map +1 -0
- package/dist/esm/src/data-points.js +262 -0
- package/dist/esm/src/data-points.js.map +1 -0
- package/dist/esm/src/index.d.ts +39 -0
- package/dist/esm/src/index.d.ts.map +1 -0
- package/dist/esm/src/index.js +82 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +71 -4
package/README.md
CHANGED
|
@@ -1,3 +1,210 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ya-modbus/driver-or-we-526
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ORNO OR-WE-526 single-phase multi-tariff energy meter driver for ya-modbus.
|
|
4
|
+
|
|
5
|
+
## Device Information
|
|
6
|
+
|
|
7
|
+
- **Manufacturer**: ORNO
|
|
8
|
+
- **Model**: OR-WE-526, a single-phase MID meter, DIN rail (1 module), RS-485. Rated 5 A base, 100 A maximum. Tariffs T1-T4 and a clock with a battery. The OR-WE-525 is the same meter without tariffs and clock.
|
|
9
|
+
- **Communication**: Modbus RTU, holding registers (function code 03), big-endian, high word first for 32-bit values
|
|
10
|
+
- **Default Settings** (from the manual):
|
|
11
|
+
- Address: 1
|
|
12
|
+
- Baud rate: 9600
|
|
13
|
+
- Parity: None
|
|
14
|
+
- Stop bits: 1
|
|
15
|
+
- Data bits: 8
|
|
16
|
+
- **Supported Settings**: baud rate 9600, 19200, 38400 or 115200; no, odd or even parity; 1 or 2 stop bits; address 1 to 247
|
|
17
|
+
|
|
18
|
+
The register list is in [docs/register-map.md](https://github.com/groupsky/ya-modbus/blob/main/packages/driver-or-we-526/docs/register-map.md). It is written from ORNO's register list (PDF made 2023-05-31), see [Sources](#sources).
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @ya-modbus/driver-or-we-526
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { createDriver, DEFAULT_CONFIG } from '@ya-modbus/driver-or-we-526'
|
|
30
|
+
import { createRTUTransport } from '@ya-modbus/transport'
|
|
31
|
+
|
|
32
|
+
const transport = await createRTUTransport({
|
|
33
|
+
port: '/dev/ttyUSB0',
|
|
34
|
+
baudRate: DEFAULT_CONFIG.baudRate,
|
|
35
|
+
parity: DEFAULT_CONFIG.parity,
|
|
36
|
+
dataBits: DEFAULT_CONFIG.dataBits,
|
|
37
|
+
stopBits: DEFAULT_CONFIG.stopBits,
|
|
38
|
+
slaveId: DEFAULT_CONFIG.defaultAddress,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const driver = await createDriver({ transport, slaveId: DEFAULT_CONFIG.defaultAddress })
|
|
42
|
+
|
|
43
|
+
const values = await driver.readDataPoints(['voltage', 'active_power', 'active_energy_forward'])
|
|
44
|
+
console.log(values)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Data Points
|
|
48
|
+
|
|
49
|
+
All data points are read-only. The driver writes nothing to the meter.
|
|
50
|
+
|
|
51
|
+
"Poll" says when the bridge reads the value: `dynamic` on every poll, `static` once at the start (restart the bridge to see a setting that was changed on the meter's buttons).
|
|
52
|
+
|
|
53
|
+
### Measurements
|
|
54
|
+
|
|
55
|
+
| ID | Register | Type, scale | Unit | Poll |
|
|
56
|
+
| ---------------- | ----------- | ------------ | ---- | ------- |
|
|
57
|
+
| `voltage` | 0x100-0x101 | INT32, 0.001 | V | dynamic |
|
|
58
|
+
| `current` | 0x102-0x103 | INT32, 0.001 | A | dynamic |
|
|
59
|
+
| `active_power` | 0x104-0x105 | INT32, 1 | W | dynamic |
|
|
60
|
+
| `apparent_power` | 0x106-0x107 | INT32, 1 | VA | dynamic |
|
|
61
|
+
| `reactive_power` | 0x108-0x109 | INT32, 1 | VAr | dynamic |
|
|
62
|
+
| `frequency` | 0x10A | INT16, 0.1 | Hz | dynamic |
|
|
63
|
+
| `power_factor` | 0x10B | INT16, 0.001 | - | dynamic |
|
|
64
|
+
|
|
65
|
+
### Energy
|
|
66
|
+
|
|
67
|
+
All are INT32, 0.01, read on every poll. Each id without a suffix is the sum of all tariffs; `_t1` to `_t4` are the tariffs (for example `active_energy_forward_t2`). On a meter without tariffs, T1 equals the total and T2-T4 are 0.
|
|
68
|
+
|
|
69
|
+
| ID (+ `_t1` ... `_t4`) | Registers | Unit | Meaning |
|
|
70
|
+
| ------------------------- | ----------- | ----- | ----------------------------------------------------- |
|
|
71
|
+
| `active_energy_forward` | 0x10E-0x117 | kWh | Forward (taken from the grid) active energy |
|
|
72
|
+
| `active_energy_reverse` | 0x118-0x121 | kWh | Reverse (given to the grid) active energy |
|
|
73
|
+
| `active_energy_total` | 0x122-0x12B | kWh | Total active energy, made as the `combined_code` says |
|
|
74
|
+
| `reactive_energy_forward` | 0x12C-0x135 | kVArh | Forward reactive energy |
|
|
75
|
+
| `reactive_energy_reverse` | 0x136-0x13F | kVArh | Reverse reactive energy |
|
|
76
|
+
| `reactive_energy_total` | 0x140-0x149 | kVArh | Total reactive energy |
|
|
77
|
+
| `reactive_energy_q1` | 0x14A-0x153 | kVArh | Reactive energy in quadrant 1 |
|
|
78
|
+
| `reactive_energy_q2` | 0x154-0x15D | kVArh | Reactive energy in quadrant 2 |
|
|
79
|
+
| `reactive_energy_q3` | 0x15E-0x167 | kVArh | Reactive energy in quadrant 3 |
|
|
80
|
+
| `reactive_energy_q4` | 0x168-0x171 | kVArh | Reactive energy in quadrant 4 |
|
|
81
|
+
|
|
82
|
+
| ID | Register | Unit | Meaning |
|
|
83
|
+
| ---------------------------- | ----------- | ----- | ------------------------------------ |
|
|
84
|
+
| `active_energy_resettable` | 0x172-0x173 | kWh | Active energy since the last reset |
|
|
85
|
+
| `reactive_energy_resettable` | 0x174-0x175 | kVArh | Reactive energy since the last reset |
|
|
86
|
+
|
|
87
|
+
### Demand
|
|
88
|
+
|
|
89
|
+
All are INT32, 0.1, read on every poll.
|
|
90
|
+
|
|
91
|
+
| ID | Register | Unit |
|
|
92
|
+
| ----------------------------------- | ----------- | ---- |
|
|
93
|
+
| `active_power_demand_forward` | 0x176-0x177 | W |
|
|
94
|
+
| `active_power_demand_forward_max` | 0x178-0x179 | W |
|
|
95
|
+
| `active_power_demand_reverse` | 0x17A-0x17B | W |
|
|
96
|
+
| `active_power_demand_reverse_max` | 0x17C-0x17D | W |
|
|
97
|
+
| `reactive_power_demand_forward` | 0x180-0x181 | VAr |
|
|
98
|
+
| `reactive_power_demand_forward_max` | 0x182-0x183 | VAr |
|
|
99
|
+
| `reactive_power_demand_reverse` | 0x184-0x185 | VAr |
|
|
100
|
+
| `reactive_power_demand_reverse_max` | 0x186-0x187 | VAr |
|
|
101
|
+
|
|
102
|
+
### Meter, clock and settings
|
|
103
|
+
|
|
104
|
+
| ID | Register | Type | Value | Poll |
|
|
105
|
+
| ------------------- | ------------- | --------- | ------------------------------------------------------------------ | ------- |
|
|
106
|
+
| `serial_number` | 0x1000-0x1002 | string | 12 digits | static |
|
|
107
|
+
| `device_address` | 0x1003 | integer | 1-247 | static |
|
|
108
|
+
| `software_version` | 0x1004 | integer | | static |
|
|
109
|
+
| `hardware_version` | 0x1005 | integer | | static |
|
|
110
|
+
| `firmware_checksum` | 0x1006 | integer | | static |
|
|
111
|
+
| `clock` | 0x1007-0x100A | timestamp | `2026-11-03T14:05:09`, local time without a time zone | dynamic |
|
|
112
|
+
| `scroll_time` | 0x100B | integer | seconds, 0-99 | static |
|
|
113
|
+
| `baud_rate` | 0x100C | enum | 9600, 19200, 38400, 115200 | static |
|
|
114
|
+
| `parity` | 0x100D | enum | `none`, `odd`, `even` | static |
|
|
115
|
+
| `stop_bits` | 0x100E | integer | 1 or 2 | static |
|
|
116
|
+
| `combined_code` | 0x100F | enum | `forward`, `reverse`, `forward+reverse`, `forward-reverse` | static |
|
|
117
|
+
| `demand_mode` | 0x1010 | enum | `interval`, `slip` | static |
|
|
118
|
+
| `demand_cycle` | 0x1011 | integer | minutes, 1-30 | static |
|
|
119
|
+
| `display_mode` | 0x1012-0x1015 | string | 16 hex digits, one bit per screen shown in turn | static |
|
|
120
|
+
| `password` | 0x1016 | string | 4 digits, the password of the meter's buttons | static |
|
|
121
|
+
| `running_time` | 0x1018-0x1019 | integer | counts while the current is above `startup_current`; no unit given | dynamic |
|
|
122
|
+
| `startup_current` | 0x101A-0x101B | float | A (the meter gives mA) | static |
|
|
123
|
+
|
|
124
|
+
An enum code that is not in the list reads as `null`. Only the multi-tariff version has the clock and the running time.
|
|
125
|
+
|
|
126
|
+
### Requests
|
|
127
|
+
|
|
128
|
+
A full read takes 8 requests: 0x100 (12 registers), 0x10E (60), 0x14A (44), 0x176 (18), 0x1000 (7), 0x1007 (5), 0x100C (11) and 0x1018 (4). A block is read only when one of its data points is asked for. The first two are the same requests as the old reader. The demand block also reads 0x17E-0x17F, which are not in the list; the old reader read them too. The bridge reads the `static` blocks only at the start, so a normal poll takes 6 requests.
|
|
129
|
+
|
|
130
|
+
## Old field to data point id
|
|
131
|
+
|
|
132
|
+
The old homy reader (`or-we-526.js`) published these fields. Each one has a data point here.
|
|
133
|
+
|
|
134
|
+
| Old field | Data point id |
|
|
135
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
136
|
+
| `v` | `voltage` |
|
|
137
|
+
| `c` | `current` |
|
|
138
|
+
| `ap` | `active_power` |
|
|
139
|
+
| `app` | `apparent_power` |
|
|
140
|
+
| `rp` | `reactive_power` |
|
|
141
|
+
| `freq` | `frequency` |
|
|
142
|
+
| `pow` | `power_factor` |
|
|
143
|
+
| `tot_act`, `tot_act_t1` ... `tot_act_t4` | `active_energy_forward`, `active_energy_forward_t1` ... `_t4` |
|
|
144
|
+
| `tot_act_rev`, `tot_act_rev_t1` ... `tot_act_rev_t4` | `active_energy_reverse`, `active_energy_reverse_t1` ... `_t4` |
|
|
145
|
+
| `act`, `act_t1` ... `act_t4` | `active_energy_total`, `active_energy_total_t1` ... `_t4` |
|
|
146
|
+
| `tot_react`, `tot_react_t1` ... `tot_react_t4` | `reactive_energy_forward`, `reactive_energy_forward_t1` ... `_t4` |
|
|
147
|
+
| `tot_react_rev`, `tot_react_rev_t1` ... `_t4` | `reactive_energy_reverse`, `reactive_energy_reverse_t1` ... `_t4` |
|
|
148
|
+
| `react`, `react_t1` ... `react_t4` | `reactive_energy_total`, `reactive_energy_total_t1` ... `_t4` |
|
|
149
|
+
| `react_1` ... `react_4`, each with `_t1` ... `_t4` | `reactive_energy_q1` ... `reactive_energy_q4`, each with `_t1` ... `_t4` |
|
|
150
|
+
| `act_reset` | `active_energy_resettable` |
|
|
151
|
+
| `react_reset` | `reactive_energy_resettable` |
|
|
152
|
+
| `act_demand` | `active_power_demand_forward` |
|
|
153
|
+
| `act_demand_max` | `active_power_demand_forward_max` |
|
|
154
|
+
| `act_demand_rev` | `active_power_demand_reverse` |
|
|
155
|
+
| `act_demand_max_rev` | `active_power_demand_reverse_max` |
|
|
156
|
+
| `react_demand` | `reactive_power_demand_forward` (other register, see below) |
|
|
157
|
+
| `react_demand_max` | `reactive_power_demand_forward_max` (other register, see below) |
|
|
158
|
+
| `react_demand_rev` | `reactive_power_demand_reverse` (other register, see below) |
|
|
159
|
+
| `react_demand_max_rev` | `reactive_power_demand_reverse_max` (other register, see below) |
|
|
160
|
+
| `serial` | `serial_number` |
|
|
161
|
+
| `id` | `device_address` |
|
|
162
|
+
| `fw` | `software_version` |
|
|
163
|
+
| `hw` | `hardware_version` |
|
|
164
|
+
| `fw_checksum` | `firmware_checksum` |
|
|
165
|
+
| `time` | `clock` (other format, see below) |
|
|
166
|
+
| `scroll_time` | `scroll_time` |
|
|
167
|
+
| `baud_rate` | `baud_rate` |
|
|
168
|
+
| `parity` | `parity` |
|
|
169
|
+
| `stop_bits` | `stop_bits` |
|
|
170
|
+
| `combined_code` | `combined_code` |
|
|
171
|
+
| `demand_mode` | `demand_mode` |
|
|
172
|
+
| `demand_cycle` | `demand_cycle` |
|
|
173
|
+
| `display_mode` | `display_mode` |
|
|
174
|
+
| `password` | `password` |
|
|
175
|
+
| `running_time` | `running_time` (other register, see below) |
|
|
176
|
+
| `startup_current` | `startup_current` (other register, in A, see below) |
|
|
177
|
+
|
|
178
|
+
The old reader could also read the tariff tables (`timePeriod_1` ... `timePeriod_8`, `timeZone`, `holidays`), but only with `tariffs: true`. That option is off by default and the homy configuration does not set it, so these were never published. The driver does not read them.
|
|
179
|
+
|
|
180
|
+
## Differences from the old reader
|
|
181
|
+
|
|
182
|
+
The old reader and ORNO's register list disagree on these points. The driver follows the list.
|
|
183
|
+
|
|
184
|
+
- **Reactive demand.** The old reader reads the four reactive demand values 2 registers too early: 0x17E, 0x180, 0x182, 0x184. The list has them at 0x180, 0x182, 0x184, 0x186; 0x17E is not in the list. So the old `react_demand` came from an unlisted register, `react_demand_max` was in fact the forward reactive demand, `react_demand_rev` the forward maximum, and `react_demand_max_rev` the reverse reactive demand.
|
|
185
|
+
- **Running time and timing current.** The old reader reads them from 0x1017-0x1018 and 0x1019-0x101A, low word first. The list has them at 0x1018-0x1019 and 0x101A-0x101B. The driver reads the listed registers, high word first like all other values. The list does not give the word order for these two; see "Open questions".
|
|
186
|
+
- **Timing current unit.** The old `startup_current` was in mA. `startup_current` here is in A (the unit list has no mA).
|
|
187
|
+
- **Power factor and frequency are signed.** The list says INT16. The old reader read them unsigned, so a negative power factor (power given to the grid) came out as about 64.5 instead of -1.0.
|
|
188
|
+
- **Clock.** The old `time` was a number: milliseconds since 1970, made from the meter's local time in the time zone of the reader. `clock` is the meter's local time as text, `YYYY-MM-DDTHH:MM:SS`, without a time zone. Like the old reader, the driver does not report the week day.
|
|
189
|
+
- **Settings and identity are read once.** The old reader read them on every poll. The bridge reads the `static` data points once at the start.
|
|
190
|
+
- **No writes.** The old reader wrote the clock and the scrolling time, and could change the settings. Its scrolling time write went to 0x100C, which is the baud rate (the scrolling time is 0x100B). The driver writes nothing.
|
|
191
|
+
|
|
192
|
+
## Open questions
|
|
193
|
+
|
|
194
|
+
These need a check on the real meter:
|
|
195
|
+
|
|
196
|
+
- Word order of `running_time` and `startup_current`. The old reader wrote them low word first. If the old `startup_current` was a very large number (about 65536 times a small one), the timing current is stored low word first and the driver must swap the words.
|
|
197
|
+
- The demand block reads up to 0x187 and the settings block reads 0x1018-0x101B. The old reader never read 0x186-0x187 or 0x101B. Check that the meter answers these requests.
|
|
198
|
+
- The unit of `running_time` (the list gives none).
|
|
199
|
+
- The reactive demand registers. The list puts them at 0x180-0x186 and skips 0x17E; the old reader read 0x17E-0x184. If the list is wrong, all four reactive demand values are one slot off. Check: read 0x176-0x187 under a reactive load and see which registers follow the forward reactive demand.
|
|
200
|
+
|
|
201
|
+
## Sources
|
|
202
|
+
|
|
203
|
+
- ORNO register list "Rejestry OR-WE-524, OR-WE-525 i OR-WE-526" (PDF made 2023-05-31): https://files.orno.pl/support/Others/ORNO/ORWE526_5908254827853/OR-WE-526_rejestry.pdf
|
|
204
|
+
- ORNO manual for OR-WE-524, OR-WE-525, OR-WE-526 (PL/EN/DE, 07/2025; ratings, default serial settings, which model has which value): https://files.orno.pl/support/ManualsUserPDF/ORNO/PL-EN-DE/OR-WE-524,525,526_manual_PL_EN_DE.pdf
|
|
205
|
+
|
|
206
|
+
Both seen on 2026-11-03.
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
GPL-3.0-or-later
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data points of the ORNO OR-WE-526 and where each one lives.
|
|
3
|
+
*
|
|
4
|
+
* Registers come from ORNO's register list for the OR-WE-524, OR-WE-525 and OR-WE-526
|
|
5
|
+
* (PDF made 2023-05-31). All registers are holding registers (function code 03). 32-bit values
|
|
6
|
+
* are read high word first, as the old homy reader does on the real meter.
|
|
7
|
+
*/
|
|
8
|
+
import type { DataPoint } from '@ya-modbus/driver-types';
|
|
9
|
+
/** One read request of holding registers */
|
|
10
|
+
export interface Block {
|
|
11
|
+
address: number;
|
|
12
|
+
count: number;
|
|
13
|
+
}
|
|
14
|
+
export interface Register {
|
|
15
|
+
block: Block;
|
|
16
|
+
point: DataPoint;
|
|
17
|
+
/** Value from the buffer of the block */
|
|
18
|
+
decode: (buffer: Buffer) => unknown;
|
|
19
|
+
}
|
|
20
|
+
export declare const REGISTERS: ReadonlyArray<Register>;
|
|
21
|
+
//# sourceMappingURL=data-points.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-points.d.ts","sourceRoot":"","sources":["../../../src/data-points.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAA;AAExE,4CAA4C;AAC5C,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAmBD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,SAAS,CAAA;IAChB,yCAAyC;IACzC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAA;CACpC;AAkHD,eAAO,MAAM,SAAS,EAAE,aAAa,CAAC,QAAQ,CA0L7C,CAAA"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Data points of the ORNO OR-WE-526 and where each one lives.
|
|
4
|
+
*
|
|
5
|
+
* Registers come from ORNO's register list for the OR-WE-524, OR-WE-525 and OR-WE-526
|
|
6
|
+
* (PDF made 2023-05-31). All registers are holding registers (function code 03). 32-bit values
|
|
7
|
+
* are read high word first, as the old homy reader does on the real meter.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.REGISTERS = void 0;
|
|
11
|
+
const driver_sdk_1 = require("@ya-modbus/driver-sdk");
|
|
12
|
+
/** Voltage, current, powers, frequency and power factor (0x100-0x10B) */
|
|
13
|
+
const INSTANT = { address: 0x100, count: 12 };
|
|
14
|
+
/** Forward, reverse and total energy with tariffs T1-T4 (0x10E-0x149) */
|
|
15
|
+
const ENERGY = { address: 0x10e, count: 60 };
|
|
16
|
+
/** Reactive energy per quadrant and the resettable energy (0x14A-0x175) */
|
|
17
|
+
const QUADRANTS = { address: 0x14a, count: 44 };
|
|
18
|
+
/** Demand (0x176-0x187). 0x17E-0x17F are not in the list; the old reader read them too */
|
|
19
|
+
const DEMAND = { address: 0x176, count: 18 };
|
|
20
|
+
/** Serial number, address, versions and checksum (0x1000-0x1006) */
|
|
21
|
+
const METER = { address: 0x1000, count: 7 };
|
|
22
|
+
/** Clock and scrolling time (0x1007-0x100B) */
|
|
23
|
+
const CLOCK = { address: 0x1007, count: 5 };
|
|
24
|
+
/** Serial settings, combined code, demand, display and password (0x100C-0x1016) */
|
|
25
|
+
const SETTINGS = { address: 0x100c, count: 11 };
|
|
26
|
+
/** Running time and timing current (0x1018-0x101B) */
|
|
27
|
+
const RUNNING = { address: 0x1018, count: 4 };
|
|
28
|
+
const offset = (block, address) => (address - block.address) * 2;
|
|
29
|
+
/** Signed 32-bit value, high word first, divided by `scale` */
|
|
30
|
+
const int32 = (block, address, scale = 1) => (buffer) => buffer.readInt32BE(offset(block, address)) / scale;
|
|
31
|
+
/** Signed 16-bit value divided by `scale` */
|
|
32
|
+
const int16 = (block, address, scale) => (buffer) => (0, driver_sdk_1.readScaledInt16BE)(buffer, offset(block, address), scale);
|
|
33
|
+
const uint16 = (block, address) => (buffer) => buffer.readUInt16BE(offset(block, address));
|
|
34
|
+
/** Registers as hex digits, 4 per register */
|
|
35
|
+
const hex = (block, address, registers) => (buffer) => {
|
|
36
|
+
const start = offset(block, address);
|
|
37
|
+
return buffer.toString('hex', start, start + registers * 2);
|
|
38
|
+
};
|
|
39
|
+
/** A code from a table, or null for a code that is not in the table */
|
|
40
|
+
const code = (block, address, table) => (buffer) => table[buffer.readUInt16BE(offset(block, address))] ?? null;
|
|
41
|
+
function point(id, type, block, decode, options) {
|
|
42
|
+
return { block, decode, point: { id, type, access: 'r', ...options } };
|
|
43
|
+
}
|
|
44
|
+
/** Settings and identity are read once, when the bridge starts */
|
|
45
|
+
const once = { pollType: 'static' };
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Energy: each value comes as total, T1, T2, T3, T4 in 5 neighbouring pairs
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
const TARIFFS = ['', '_t1', '_t2', '_t3', '_t4'];
|
|
50
|
+
/**
|
|
51
|
+
* Total and T1-T4 of one energy value, kWh or kVArh with 2 decimals.
|
|
52
|
+
* On a meter without tariffs, T1 equals the total and T2-T4 are 0.
|
|
53
|
+
*/
|
|
54
|
+
function energy(block, first, id, name, unit) {
|
|
55
|
+
return TARIFFS.map((suffix, i) => {
|
|
56
|
+
const tariff = suffix ? ` ${suffix.slice(1).toUpperCase()}` : '';
|
|
57
|
+
return point(`${id}${suffix}`, 'float', block, int32(block, first + i * 2, 100), {
|
|
58
|
+
name: `${name}${tariff}`,
|
|
59
|
+
description: `${name}${tariff ? `, tariff${tariff}` : ', all tariffs'}`,
|
|
60
|
+
unit,
|
|
61
|
+
decimals: 2,
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function demand(address, id, name, unit) {
|
|
66
|
+
return point(id, 'float', DEMAND, int32(DEMAND, address, 10), {
|
|
67
|
+
name,
|
|
68
|
+
description: name,
|
|
69
|
+
unit,
|
|
70
|
+
decimals: 1,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const BAUD_RATES = { 6: 9600, 7: 19200, 8: 38400, 9: 115200 };
|
|
74
|
+
const PARITIES = { 0: 'none', 1: 'odd', 2: 'even' };
|
|
75
|
+
const COMBINED_CODES = {
|
|
76
|
+
1: 'forward',
|
|
77
|
+
2: 'reverse',
|
|
78
|
+
3: 'forward+reverse',
|
|
79
|
+
4: 'forward-reverse',
|
|
80
|
+
};
|
|
81
|
+
const DEMAND_MODES = { 0: 'interval', 1: 'slip' };
|
|
82
|
+
/**
|
|
83
|
+
* The meter clock (0x1007-0x100A) as local date-time `YYYY-MM-DDTHH:MM:SS`, without a time zone.
|
|
84
|
+
* Bytes: 0, year, month, day, week day, hour, minute, second; each one BCD (0x26 = 26).
|
|
85
|
+
* The week day is not used.
|
|
86
|
+
*/
|
|
87
|
+
function decodeClock(buffer) {
|
|
88
|
+
const byte = (i) => buffer.toString('hex', i, i + 1);
|
|
89
|
+
return `20${byte(1)}-${byte(2)}-${byte(3)}T${byte(5)}:${byte(6)}:${byte(7)}`;
|
|
90
|
+
}
|
|
91
|
+
exports.REGISTERS = [
|
|
92
|
+
// Instantaneous values
|
|
93
|
+
point('voltage', 'float', INSTANT, int32(INSTANT, 0x100, 1000), {
|
|
94
|
+
name: 'Voltage',
|
|
95
|
+
description: 'Line voltage',
|
|
96
|
+
unit: 'V',
|
|
97
|
+
decimals: 3,
|
|
98
|
+
}),
|
|
99
|
+
point('current', 'float', INSTANT, int32(INSTANT, 0x102, 1000), {
|
|
100
|
+
name: 'Current',
|
|
101
|
+
description: 'Line current, forward and reverse',
|
|
102
|
+
unit: 'A',
|
|
103
|
+
decimals: 3,
|
|
104
|
+
}),
|
|
105
|
+
point('active_power', 'integer', INSTANT, int32(INSTANT, 0x104), {
|
|
106
|
+
name: 'Active Power',
|
|
107
|
+
description: 'Active power, negative for reverse',
|
|
108
|
+
unit: 'W',
|
|
109
|
+
}),
|
|
110
|
+
point('apparent_power', 'integer', INSTANT, int32(INSTANT, 0x106), {
|
|
111
|
+
name: 'Apparent Power',
|
|
112
|
+
description: 'Apparent power',
|
|
113
|
+
unit: 'VA',
|
|
114
|
+
}),
|
|
115
|
+
point('reactive_power', 'integer', INSTANT, int32(INSTANT, 0x108), {
|
|
116
|
+
name: 'Reactive Power',
|
|
117
|
+
description: 'Reactive power',
|
|
118
|
+
unit: 'VAr',
|
|
119
|
+
}),
|
|
120
|
+
point('frequency', 'float', INSTANT, int16(INSTANT, 0x10a, 10), {
|
|
121
|
+
name: 'Grid Frequency',
|
|
122
|
+
description: 'Grid frequency',
|
|
123
|
+
unit: 'Hz',
|
|
124
|
+
decimals: 1,
|
|
125
|
+
}),
|
|
126
|
+
point('power_factor', 'float', INSTANT, int16(INSTANT, 0x10b, 1000), {
|
|
127
|
+
name: 'Power Factor',
|
|
128
|
+
description: 'Power factor, with the sign of the active power',
|
|
129
|
+
decimals: 3,
|
|
130
|
+
}),
|
|
131
|
+
// Energy
|
|
132
|
+
...energy(ENERGY, 0x10e, 'active_energy_forward', 'Forward Active Energy', 'kWh'),
|
|
133
|
+
...energy(ENERGY, 0x118, 'active_energy_reverse', 'Reverse Active Energy', 'kWh'),
|
|
134
|
+
...energy(ENERGY, 0x122, 'active_energy_total', 'Total Active Energy', 'kWh'),
|
|
135
|
+
...energy(ENERGY, 0x12c, 'reactive_energy_forward', 'Forward Reactive Energy', 'kVArh'),
|
|
136
|
+
...energy(ENERGY, 0x136, 'reactive_energy_reverse', 'Reverse Reactive Energy', 'kVArh'),
|
|
137
|
+
...energy(ENERGY, 0x140, 'reactive_energy_total', 'Total Reactive Energy', 'kVArh'),
|
|
138
|
+
...energy(QUADRANTS, 0x14a, 'reactive_energy_q1', 'Reactive Energy Quadrant 1', 'kVArh'),
|
|
139
|
+
...energy(QUADRANTS, 0x154, 'reactive_energy_q2', 'Reactive Energy Quadrant 2', 'kVArh'),
|
|
140
|
+
...energy(QUADRANTS, 0x15e, 'reactive_energy_q3', 'Reactive Energy Quadrant 3', 'kVArh'),
|
|
141
|
+
...energy(QUADRANTS, 0x168, 'reactive_energy_q4', 'Reactive Energy Quadrant 4', 'kVArh'),
|
|
142
|
+
point('active_energy_resettable', 'float', QUADRANTS, int32(QUADRANTS, 0x172, 100), {
|
|
143
|
+
name: 'Resettable Active Energy',
|
|
144
|
+
description: 'Total active energy since the last reset',
|
|
145
|
+
unit: 'kWh',
|
|
146
|
+
decimals: 2,
|
|
147
|
+
}),
|
|
148
|
+
point('reactive_energy_resettable', 'float', QUADRANTS, int32(QUADRANTS, 0x174, 100), {
|
|
149
|
+
name: 'Resettable Reactive Energy',
|
|
150
|
+
description: 'Total reactive energy since the last reset',
|
|
151
|
+
unit: 'kVArh',
|
|
152
|
+
decimals: 2,
|
|
153
|
+
}),
|
|
154
|
+
// Demand
|
|
155
|
+
demand(0x176, 'active_power_demand_forward', 'Forward Active Demand', 'W'),
|
|
156
|
+
demand(0x178, 'active_power_demand_forward_max', 'Forward Maximum Active Demand', 'W'),
|
|
157
|
+
demand(0x17a, 'active_power_demand_reverse', 'Reverse Active Demand', 'W'),
|
|
158
|
+
demand(0x17c, 'active_power_demand_reverse_max', 'Reverse Maximum Active Demand', 'W'),
|
|
159
|
+
demand(0x180, 'reactive_power_demand_forward', 'Forward Reactive Demand', 'VAr'),
|
|
160
|
+
demand(0x182, 'reactive_power_demand_forward_max', 'Forward Maximum Reactive Demand', 'VAr'),
|
|
161
|
+
demand(0x184, 'reactive_power_demand_reverse', 'Reverse Reactive Demand', 'VAr'),
|
|
162
|
+
demand(0x186, 'reactive_power_demand_reverse_max', 'Reverse Maximum Reactive Demand', 'VAr'),
|
|
163
|
+
// Identity
|
|
164
|
+
point('serial_number', 'string', METER, hex(METER, 0x1000, 3), {
|
|
165
|
+
name: 'Serial Number',
|
|
166
|
+
description: 'Serial number, 12 digits',
|
|
167
|
+
...once,
|
|
168
|
+
}),
|
|
169
|
+
point('device_address', 'integer', METER, uint16(METER, 0x1003), {
|
|
170
|
+
name: 'Device Address',
|
|
171
|
+
description: 'Modbus address set in the meter (1-247)',
|
|
172
|
+
...once,
|
|
173
|
+
}),
|
|
174
|
+
point('software_version', 'integer', METER, uint16(METER, 0x1004), {
|
|
175
|
+
name: 'Software Version',
|
|
176
|
+
description: 'Firmware version',
|
|
177
|
+
...once,
|
|
178
|
+
}),
|
|
179
|
+
point('hardware_version', 'integer', METER, uint16(METER, 0x1005), {
|
|
180
|
+
name: 'Hardware Version',
|
|
181
|
+
description: 'Hardware version',
|
|
182
|
+
...once,
|
|
183
|
+
}),
|
|
184
|
+
point('firmware_checksum', 'integer', METER, uint16(METER, 0x1006), {
|
|
185
|
+
name: 'Firmware Checksum',
|
|
186
|
+
description: 'Firmware checksum',
|
|
187
|
+
...once,
|
|
188
|
+
}),
|
|
189
|
+
// Clock
|
|
190
|
+
point('clock', 'timestamp', CLOCK, decodeClock, {
|
|
191
|
+
name: 'Clock',
|
|
192
|
+
description: 'Clock of the meter as local date-time YYYY-MM-DDTHH:MM:SS, without a time zone. ' +
|
|
193
|
+
'Only the multi-tariff version has a clock',
|
|
194
|
+
}),
|
|
195
|
+
// Settings
|
|
196
|
+
point('scroll_time', 'integer', CLOCK, uint16(CLOCK, 0x100b), {
|
|
197
|
+
name: 'Scrolling Time',
|
|
198
|
+
description: 'Time each screen stays on the display (0-99)',
|
|
199
|
+
unit: 's',
|
|
200
|
+
...once,
|
|
201
|
+
}),
|
|
202
|
+
point('baud_rate', 'enum', SETTINGS, code(SETTINGS, 0x100c, BAUD_RATES), {
|
|
203
|
+
name: 'Baud Rate',
|
|
204
|
+
description: 'Serial baud rate',
|
|
205
|
+
enumValues: { 9600: '9600 bps', 19200: '19200 bps', 38400: '38400 bps', 115200: '115200 bps' },
|
|
206
|
+
...once,
|
|
207
|
+
}),
|
|
208
|
+
point('parity', 'enum', SETTINGS, code(SETTINGS, 0x100d, PARITIES), {
|
|
209
|
+
name: 'Parity',
|
|
210
|
+
description: 'Serial parity',
|
|
211
|
+
enumValues: { none: 'No parity', odd: 'Odd parity', even: 'Even parity' },
|
|
212
|
+
...once,
|
|
213
|
+
}),
|
|
214
|
+
point('stop_bits', 'integer', SETTINGS, uint16(SETTINGS, 0x100e), {
|
|
215
|
+
name: 'Stop Bits',
|
|
216
|
+
description: 'Serial stop bits, 1 or 2',
|
|
217
|
+
...once,
|
|
218
|
+
}),
|
|
219
|
+
point('combined_code', 'enum', SETTINGS, code(SETTINGS, 0x100f, COMBINED_CODES), {
|
|
220
|
+
name: 'Combined Code',
|
|
221
|
+
description: 'How the total active energy is made from forward and reverse energy',
|
|
222
|
+
enumValues: {
|
|
223
|
+
forward: 'Total = forward',
|
|
224
|
+
reverse: 'Total = reverse',
|
|
225
|
+
'forward+reverse': 'Total = forward + reverse',
|
|
226
|
+
'forward-reverse': 'Total = forward - reverse',
|
|
227
|
+
},
|
|
228
|
+
...once,
|
|
229
|
+
}),
|
|
230
|
+
point('demand_mode', 'enum', SETTINGS, code(SETTINGS, 0x1010, DEMAND_MODES), {
|
|
231
|
+
name: 'Demand Mode',
|
|
232
|
+
description: 'How the demand is calculated',
|
|
233
|
+
enumValues: { interval: 'Interval', slip: 'Slip' },
|
|
234
|
+
...once,
|
|
235
|
+
}),
|
|
236
|
+
point('demand_cycle', 'integer', SETTINGS, uint16(SETTINGS, 0x1011), {
|
|
237
|
+
name: 'Demand Cycle',
|
|
238
|
+
description: 'Demand period (1-30)',
|
|
239
|
+
unit: 'min',
|
|
240
|
+
...once,
|
|
241
|
+
}),
|
|
242
|
+
point('display_mode', 'string', SETTINGS, hex(SETTINGS, 0x1012, 4), {
|
|
243
|
+
name: 'Display Content',
|
|
244
|
+
description: 'Bits of the screens shown in turn, as 16 hex digits; 0 = not shown',
|
|
245
|
+
...once,
|
|
246
|
+
}),
|
|
247
|
+
point('password', 'string', SETTINGS, (b) => String(uint16(SETTINGS, 0x1016)(b)).padStart(4, '0'), {
|
|
248
|
+
name: 'Display Password',
|
|
249
|
+
description: 'Password of the buttons on the meter, 4 digits',
|
|
250
|
+
...once,
|
|
251
|
+
}),
|
|
252
|
+
point('running_time', 'integer', RUNNING, int32(RUNNING, 0x1018), {
|
|
253
|
+
name: 'Running Time',
|
|
254
|
+
description: 'Meter running time: counts while the current is above the timing current. ' +
|
|
255
|
+
'The register list gives no unit. Only the multi-tariff version has it',
|
|
256
|
+
}),
|
|
257
|
+
point('startup_current', 'float', RUNNING, int32(RUNNING, 0x101a, 1000), {
|
|
258
|
+
name: 'Timing Current',
|
|
259
|
+
description: 'The running time counts while the current is above this value',
|
|
260
|
+
unit: 'A',
|
|
261
|
+
decimals: 3,
|
|
262
|
+
...once,
|
|
263
|
+
}),
|
|
264
|
+
];
|
|
265
|
+
//# sourceMappingURL=data-points.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-points.js","sourceRoot":"","sources":["../../../src/data-points.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,sDAAyD;AASzD,yEAAyE;AACzE,MAAM,OAAO,GAAU,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AACpD,yEAAyE;AACzE,MAAM,MAAM,GAAU,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AACnD,2EAA2E;AAC3E,MAAM,SAAS,GAAU,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AACtD,0FAA0F;AAC1F,MAAM,MAAM,GAAU,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;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AAC;QACX,GAAG,IAAI;KACR,CAAC;CACH,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ORNO OR-WE-526 Single-Phase Energy Meter Driver
|
|
3
|
+
*
|
|
4
|
+
* Single-phase energy meter with tariffs T1-T4 and a clock, DIN rail (1 module), RS-485,
|
|
5
|
+
* Modbus RTU. All values are holding registers (function code 03).
|
|
6
|
+
*
|
|
7
|
+
* The driver only reads. It writes nothing to the meter.
|
|
8
|
+
*/
|
|
9
|
+
import type { CreateDriverFunction } from '@ya-modbus/driver-types';
|
|
10
|
+
/**
|
|
11
|
+
* Supported serial settings
|
|
12
|
+
*
|
|
13
|
+
* From the register list (0x100C-0x100E) and the manual: 9600-115200 baud, any parity,
|
|
14
|
+
* 1 or 2 stop bits, address 1-247.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SUPPORTED_CONFIG: {
|
|
17
|
+
readonly validBaudRates: readonly [9600, 19200, 38400, 115200];
|
|
18
|
+
readonly validParity: readonly ["none", "even", "odd"];
|
|
19
|
+
readonly validDataBits: readonly [8];
|
|
20
|
+
readonly validStopBits: readonly [1, 2];
|
|
21
|
+
readonly validAddressRange: readonly [1, 247];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Factory default serial settings
|
|
25
|
+
*
|
|
26
|
+
* From the manual: address 1, 9600 baud, no parity, 1 stop bit.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DEFAULT_CONFIG: {
|
|
29
|
+
readonly baudRate: 9600;
|
|
30
|
+
readonly parity: "none";
|
|
31
|
+
readonly dataBits: 8;
|
|
32
|
+
readonly stopBits: 1;
|
|
33
|
+
readonly defaultAddress: 1;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Create the OR-WE-526 driver
|
|
37
|
+
*/
|
|
38
|
+
export declare const createDriver: CreateDriverFunction;
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAMrB,MAAM,yBAAyB,CAAA;AAIhC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;CAMa,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;CAMa,CAAA;AAMxC;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,oBAiD1B,CAAA"}
|