daikin-local-control 0.3.1 → 0.4.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/DESIGN.md +113 -2
- package/README.md +129 -11
- package/UNSUPPORTED.md +41 -3
- package/dist/clients/classic.d.ts +2 -2
- package/dist/clients/classic.d.ts.map +1 -1
- package/dist/clients/classic.js +4 -4
- package/dist/clients/classic.js.map +1 -1
- package/dist/clients/client.d.ts +5 -1
- package/dist/clients/client.d.ts.map +1 -1
- package/dist/clients/dsiot.d.ts +3 -1
- package/dist/clients/dsiot.d.ts.map +1 -1
- package/dist/clients/dsiot.js +7 -2
- package/dist/clients/dsiot.js.map +1 -1
- package/dist/codecs/classic/capabilities.d.ts.map +1 -1
- package/dist/codecs/classic/capabilities.js +5 -11
- package/dist/codecs/classic/capabilities.js.map +1 -1
- package/dist/codecs/classic/extendedControl.d.ts.map +1 -1
- package/dist/codecs/classic/extendedControl.js +10 -19
- package/dist/codecs/classic/extendedControl.js.map +1 -1
- package/dist/codecs/classic/state.d.ts.map +1 -1
- package/dist/codecs/classic/state.js +36 -95
- package/dist/codecs/classic/state.js.map +1 -1
- package/dist/codecs/classic/tables.d.ts +32 -0
- package/dist/codecs/classic/tables.d.ts.map +1 -0
- package/dist/codecs/classic/tables.js +94 -0
- package/dist/codecs/classic/tables.js.map +1 -0
- package/dist/codecs/credentials.d.ts +3 -2
- package/dist/codecs/credentials.d.ts.map +1 -1
- package/dist/codecs/credentials.js +8 -3
- package/dist/codecs/credentials.js.map +1 -1
- package/dist/codecs/device.js +2 -2
- package/dist/codecs/device.js.map +1 -1
- package/dist/codecs/dsiot/capabilities.d.ts.map +1 -1
- package/dist/codecs/dsiot/capabilities.js +8 -15
- package/dist/codecs/dsiot/capabilities.js.map +1 -1
- package/dist/codecs/dsiot/device.d.ts.map +1 -1
- package/dist/codecs/dsiot/device.js +4 -8
- package/dist/codecs/dsiot/device.js.map +1 -1
- package/dist/codecs/dsiot/multireq.d.ts +0 -19
- package/dist/codecs/dsiot/multireq.d.ts.map +1 -1
- package/dist/codecs/dsiot/multireq.js +2 -25
- package/dist/codecs/dsiot/multireq.js.map +1 -1
- package/dist/codecs/dsiot/state.d.ts +6 -62
- package/dist/codecs/dsiot/state.d.ts.map +1 -1
- package/dist/codecs/dsiot/state.js +29 -148
- package/dist/codecs/dsiot/state.js.map +1 -1
- package/dist/codecs/dsiot/tables.d.ts +116 -0
- package/dist/codecs/dsiot/tables.d.ts.map +1 -0
- package/dist/codecs/dsiot/tables.js +185 -0
- package/dist/codecs/dsiot/tables.js.map +1 -0
- package/dist/discovery.d.ts +2 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +9 -5
- package/dist/discovery.js.map +1 -1
- package/dist/factory.d.ts +7 -4
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +4 -2
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/models/state.d.ts +2 -3
- package/dist/models/state.d.ts.map +1 -1
- package/dist/simulators/classic.d.ts +61 -0
- package/dist/simulators/classic.d.ts.map +1 -0
- package/dist/simulators/classic.js +473 -0
- package/dist/simulators/classic.js.map +1 -0
- package/dist/simulators/dsiot.d.ts +49 -0
- package/dist/simulators/dsiot.d.ts.map +1 -0
- package/dist/simulators/dsiot.js +519 -0
- package/dist/simulators/dsiot.js.map +1 -0
- package/dist/simulators/index.d.ts +4 -0
- package/dist/simulators/index.d.ts.map +1 -0
- package/dist/simulators/index.js +3 -0
- package/dist/simulators/index.js.map +1 -0
- package/dist/simulators/simulator.d.ts +116 -0
- package/dist/simulators/simulator.d.ts.map +1 -0
- package/dist/simulators/simulator.js +141 -0
- package/dist/simulators/simulator.js.map +1 -0
- package/dist/transport.d.ts +6 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +7 -2
- package/dist/transport.js.map +1 -1
- package/package.json +5 -2
- package/src/clients/classic.ts +8 -8
- package/src/clients/client.ts +6 -0
- package/src/clients/dsiot.ts +8 -1
- package/src/codecs/classic/capabilities.ts +8 -11
- package/src/codecs/classic/extendedControl.ts +14 -25
- package/src/codecs/classic/state.ts +49 -101
- package/src/codecs/classic/tables.ts +123 -0
- package/src/codecs/credentials.ts +11 -3
- package/src/codecs/device.ts +2 -2
- package/src/codecs/dsiot/capabilities.ts +10 -17
- package/src/codecs/dsiot/device.ts +4 -9
- package/src/codecs/dsiot/multireq.ts +2 -25
- package/src/codecs/dsiot/state.ts +57 -193
- package/src/codecs/dsiot/tables.ts +249 -0
- package/src/discovery.ts +9 -5
- package/src/factory.ts +7 -4
- package/src/index.ts +2 -0
- package/src/models/state.ts +2 -3
- package/src/simulators/classic.ts +635 -0
- package/src/simulators/dsiot.ts +736 -0
- package/src/simulators/index.ts +9 -0
- package/src/simulators/simulator.ts +281 -0
- package/src/transport.ts +10 -3
package/DESIGN.md
CHANGED
|
@@ -130,8 +130,11 @@ Rejected: positions as the numbers 0 to 25, typed `number`, with
|
|
|
130
130
|
## Special modes
|
|
131
131
|
|
|
132
132
|
`DaikinState.specialModes` lists the special modes that are on, and `getState`
|
|
133
|
-
reads it on both protocols. `DaikinControl` leaves it out
|
|
134
|
-
|
|
133
|
+
reads it on both protocols. `DaikinControl` leaves it out: `setSpecialMode`
|
|
134
|
+
turns one mode on or off, with a request of its own on both protocols. A
|
|
135
|
+
classic adapter takes it at `/aircon/set_special_mode`, beside
|
|
136
|
+
`set_control_info`, and a DSIOT adapter takes one leaf, on the outdoor edge
|
|
137
|
+
for powerful where every leaf `setState` writes is on the indoor edge.
|
|
135
138
|
|
|
136
139
|
Rejected: a `getSpecialModes` on `ClassicDaikinClient`, beside `setSpecialMode`.
|
|
137
140
|
|
|
@@ -148,3 +151,111 @@ Rejected: one list for the whole unit.
|
|
|
148
151
|
|
|
149
152
|
- Econo is not known to be taken in fan mode, so the one list offered it in a
|
|
150
153
|
mode where UNSUPPORTED.md lists it as unknown.
|
|
154
|
+
|
|
155
|
+
## Simulators
|
|
156
|
+
|
|
157
|
+
`startClassicSimulator` and `startDsiotSimulator` each start an adapter as a
|
|
158
|
+
server. A simulator shares the codecs' tables, `src/codecs/*/tables.ts`, and
|
|
159
|
+
none of their functions. A table holds what an adapter calls a thing: its
|
|
160
|
+
field and leaf names, and the code for each value. A function does something
|
|
161
|
+
with it: a codec parses a reply and builds a request, and a simulator answers
|
|
162
|
+
the request, holds what it was sent, and builds the reply.
|
|
163
|
+
|
|
164
|
+
Rejected: a simulator that builds its replies with the codecs' functions.
|
|
165
|
+
|
|
166
|
+
- A simulator built from a codec agrees with it by construction. A codec that
|
|
167
|
+
reads a field wrongly would meet a simulator that writes it wrongly the same
|
|
168
|
+
way, and the test of one against the other would pass.
|
|
169
|
+
|
|
170
|
+
Rejected: a simulator with tables of its own, sharing nothing with the codecs.
|
|
171
|
+
|
|
172
|
+
- Every code was written twice, in two files that had to be kept alike, and a
|
|
173
|
+
caller setting a field of a simulator by hand had no table to read it from.
|
|
174
|
+
- The second writing caught a wrong code only where the simulator encoded a
|
|
175
|
+
value itself. `tables.test.ts` writes every entry out again, and catches
|
|
176
|
+
one wherever it is used.
|
|
177
|
+
|
|
178
|
+
`package.json` exports the simulators as `daikin-local-control/simulators`,
|
|
179
|
+
an entry of their own beside the package root.
|
|
180
|
+
|
|
181
|
+
Rejected: exporting them from the package root.
|
|
182
|
+
|
|
183
|
+
- A caller's production code imports the root. With the simulators in it, that
|
|
184
|
+
import loads two servers the code never starts, and a bundler has to work
|
|
185
|
+
out that it can drop them.
|
|
186
|
+
|
|
187
|
+
A simulator holds its state in the adapter's terms, `controlInfo.stemp` on a
|
|
188
|
+
classic simulator and a leaf's `pv` by its address on a DSIOT one, and takes
|
|
189
|
+
it in the package's models: a `DaikinState`, a `DaikinSensors` and a
|
|
190
|
+
`DaikinDeviceInfo`. It turns a model into the adapter's fields with functions
|
|
191
|
+
of its own, in `src/simulators/`, so a client that reads the state back
|
|
192
|
+
checks the codec that parses it against a second writing of the same
|
|
193
|
+
encoding.
|
|
194
|
+
|
|
195
|
+
Rejected: options in the adapter's terms alone, a record of strings for each
|
|
196
|
+
reply.
|
|
197
|
+
|
|
198
|
+
- A caller had to know the adapter's encodings to start a unit in a state: a
|
|
199
|
+
DSIOT setpoint of 24 °C is the leaf value `3000`.
|
|
200
|
+
|
|
201
|
+
A simulator takes what the unit has as a `DaikinSimulatorUnit`, which says it
|
|
202
|
+
in terms both protocols have flags for: `coolingOnly`, `swing`, `fan`.
|
|
203
|
+
|
|
204
|
+
Rejected: taking a `DaikinCapabilities`.
|
|
205
|
+
|
|
206
|
+
- Most values of it are ones no adapter reports. Fan speeds of `auto`,
|
|
207
|
+
`level1` and `level3` have no `frate_steps`, and a DSIOT adapter reports
|
|
208
|
+
every fan speed or none, so the simulator would throw for most of what the
|
|
209
|
+
type allows.
|
|
210
|
+
|
|
211
|
+
A simulator answers HTTP 501 to a request whose answer from an adapter is not
|
|
212
|
+
known, such as a path it does not serve.
|
|
213
|
+
|
|
214
|
+
Rejected: answering such a request the way an adapter plausibly would, with
|
|
215
|
+
HTTP 404 or `ret=PARAM NG`.
|
|
216
|
+
|
|
217
|
+
- A caller's test would then pass or fail on an answer no adapter is known to
|
|
218
|
+
give. No adapter is known to answer 501, so a caller cannot take it for an
|
|
219
|
+
adapter's reply.
|
|
220
|
+
|
|
221
|
+
A simulator answers one request at a time, and a request that arrives
|
|
222
|
+
meanwhile waits for its turn: an adapter makes concurrent requests wait.
|
|
223
|
+
`replyDelayInMs` makes the wait long enough for a test to see. Whether an
|
|
224
|
+
adapter also drops a connection while it is busy is not known, so a simulator
|
|
225
|
+
never does.
|
|
226
|
+
|
|
227
|
+
A simulator answers the discovery probe only when started with
|
|
228
|
+
`answersDiscovery`.
|
|
229
|
+
|
|
230
|
+
Rejected: answering it always.
|
|
231
|
+
|
|
232
|
+
- An adapter answers on UDP port 30050, a fixed port, so a simulator that
|
|
233
|
+
always bound it could not start beside another program that holds it, in a
|
|
234
|
+
test that never discovers anything.
|
|
235
|
+
|
|
236
|
+
Each simulator is at one `address` of the machine, `127.0.0.1` unless it is
|
|
237
|
+
given another. It answers the probe from that address, and the simulators
|
|
238
|
+
share port 30050: each hears the probe on a socket bound to every address,
|
|
239
|
+
and answers from a second socket bound to its own.
|
|
240
|
+
|
|
241
|
+
Rejected: one socket for each simulator, bound to port 30050 of its own
|
|
242
|
+
address.
|
|
243
|
+
|
|
244
|
+
- The probe is a broadcast to `255.255.255.255`, and a socket bound to one
|
|
245
|
+
address receives none of it: two simulators bound that way answered no
|
|
246
|
+
probe.
|
|
247
|
+
|
|
248
|
+
Rejected: one socket bound to every address, answering from it.
|
|
249
|
+
|
|
250
|
+
- The machine then picks the address a reply leaves from, its address on the
|
|
251
|
+
LAN, so `discoverDevices` reports the simulator there, and the simulator
|
|
252
|
+
has to listen for HTTP on the LAN where a test needs loopback alone.
|
|
253
|
+
|
|
254
|
+
`discoverDevices` keeps one device for each `host`, the address a reply came
|
|
255
|
+
from with the `api_port` it announces, so it finds every simulator on a
|
|
256
|
+
machine: they answer from one address and announce a port each.
|
|
257
|
+
|
|
258
|
+
Rejected: one device for each address.
|
|
259
|
+
|
|
260
|
+
- Simulators on one machine share its addresses, so a caller could have as
|
|
261
|
+
many discovered as the machine has addresses, two on a laptop.
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ each:
|
|
|
19
19
|
- **`ClassicDaikinClient`** — classic adapters (BRP072A42, BRP072C42, BRP069).
|
|
20
20
|
Full core control plus typed [extended controls](#extended-controls).
|
|
21
21
|
- **`DsiotDaikinClient`** — newer DSIOT adapters (BRP084). Power, mode,
|
|
22
|
-
setpoint, humidity, fan, swing and
|
|
22
|
+
setpoint, humidity, fan, swing, louver positions and special modes;
|
|
23
23
|
[UNSUPPORTED.md](UNSUPPORTED.md) lists what is not mapped yet.
|
|
24
24
|
|
|
25
25
|
You normally don't pick one yourself: `createDaikinClient` chooses the right
|
|
@@ -111,15 +111,17 @@ for you.
|
|
|
111
111
|
An adapter can need up to three things. Discovery tells you which ones apply
|
|
112
112
|
(`device.requiresRegistration`, `device.requiresLocalPassword`).
|
|
113
113
|
|
|
114
|
-
**Terminal uuid (always).** It identifies your app to the adapter.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
**Terminal uuid (always).** It identifies your app to the adapter. Pass 32
|
|
115
|
+
lowercase hexadecimal digits, a UUID without its dashes: `createDaikinClient()`
|
|
116
|
+
throws an `Error` for any other form, and sends the uuid as given. Generate it
|
|
117
|
+
**once**, store it, and reuse it on every run: an adapter that requires
|
|
118
|
+
registration remembers it, so a new uuid means registering again.
|
|
118
119
|
|
|
119
120
|
```ts
|
|
120
121
|
import { randomUUID } from "node:crypto";
|
|
121
122
|
|
|
122
|
-
const savedUuid =
|
|
123
|
+
const savedUuid =
|
|
124
|
+
loadFromConfig() ?? saveToConfig(randomUUID().replaceAll("-", ""));
|
|
123
125
|
```
|
|
124
126
|
|
|
125
127
|
**KEY (when `device.requiresRegistration` is `true`).** These
|
|
@@ -204,7 +206,12 @@ given, whether or not the unit lists it.
|
|
|
204
206
|
| `verticalPosition`, `horizontalPosition` | On a classic adapter, when the unit has no 3D airflow. On a DSIOT adapter, a fixed vertical position the unit lacks, and every fixed horizontal position |
|
|
205
207
|
|
|
206
208
|
`setState()` takes no `specialModes`: turn one on or off with
|
|
207
|
-
|
|
209
|
+
`setSpecialMode()`, which sends a request of its own. Check the mode against
|
|
210
|
+
`getCapabilities().specialModes` first: the client sends any mode as given.
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
await client.setSpecialMode("powerful", true);
|
|
214
|
+
```
|
|
208
215
|
|
|
209
216
|
Pass `maxStateAgeForSetStateInMs` to `createDaikinClient` when you poll the
|
|
210
217
|
state anyway: `setState()` reads the unit before each write, and with it builds
|
|
@@ -238,7 +245,6 @@ if (client instanceof ClassicDaikinClient) {
|
|
|
238
245
|
maxPowerInPercent: 70,
|
|
239
246
|
mode: "manual",
|
|
240
247
|
});
|
|
241
|
-
await client.setSpecialMode("powerful", true);
|
|
242
248
|
await client.setOutOfHomeAccess(false); // home network only
|
|
243
249
|
await client.setEnergyPrice(0.3); // per kWh
|
|
244
250
|
await client.setMetadata({
|
|
@@ -278,9 +284,11 @@ A client method that fails rejects with a `DaikinError`; branch on
|
|
|
278
284
|
| 504 | The request timed out, or the TLS handshake failed |
|
|
279
285
|
| Any other | The adapter's own HTTP status, such as 403 |
|
|
280
286
|
|
|
281
|
-
|
|
282
|
-
socket's error,
|
|
283
|
-
|
|
287
|
+
Three failures are not a `DaikinError`: `discoverDevices()` rejects with the
|
|
288
|
+
socket's error, `createDaikinClient()` throws an `Error` for a
|
|
289
|
+
[terminal uuid](#credentials) in the wrong form, and `multireqUpdate()` throws
|
|
290
|
+
an `Error` for a path that names a resource without a leaf, such as
|
|
291
|
+
`dgc_status`.
|
|
284
292
|
|
|
285
293
|
Only a `DaikinConnectionError` is retried, up to five times by default.
|
|
286
294
|
[DESIGN.md](DESIGN.md#retries) says why.
|
|
@@ -291,6 +299,116 @@ Only a `DaikinConnectionError` is retried, up to five times by default.
|
|
|
291
299
|
| Stop a client retrying | `retry: { delaysInMs: [] }` to `createDaikinClient` |
|
|
292
300
|
| Send one request that is not safe to repeat | `{ retry: false }` as the last argument of `command()`, `multireqGet()` or `multireqUpdate()` |
|
|
293
301
|
|
|
302
|
+
### Simulators
|
|
303
|
+
|
|
304
|
+
Test your code against a simulated adapter instead of a real one: start a
|
|
305
|
+
simulator, and point a client at its `host`. Import the simulators from
|
|
306
|
+
`daikin-local-control/simulators`: the package root does not export them.
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
import { createDaikinClient } from "daikin-local-control";
|
|
310
|
+
import { startClassicSimulator } from "daikin-local-control/simulators";
|
|
311
|
+
|
|
312
|
+
const simulator = await startClassicSimulator({
|
|
313
|
+
deviceInfo: { name: "Bedroom", macAddress: "A4:08:EA:CC:91:D4" },
|
|
314
|
+
unit: { coolingOnly: true, swing: "vertical" },
|
|
315
|
+
state: { power: true, targetTemperatureInC: 22 },
|
|
316
|
+
sensors: { indoorTemperatureInC: 27 },
|
|
317
|
+
});
|
|
318
|
+
const client = createDaikinClient(
|
|
319
|
+
{ host: simulator.host, protocol: "classic" },
|
|
320
|
+
{ terminalUuid: savedUuid },
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
await client.getState(); // power: true, mode: "cool", targetTemperatureInC: 22
|
|
324
|
+
|
|
325
|
+
simulator.setState({ power: false }); // someone uses the remote control
|
|
326
|
+
simulator.setSensors({ indoorTemperatureInC: 24 }); // the room cools down
|
|
327
|
+
|
|
328
|
+
await client.close();
|
|
329
|
+
await simulator.stop();
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
`startDsiotSimulator()` starts a DSIOT adapter and takes the same options:
|
|
333
|
+
pass `protocol: "dsiot"` to `createDaikinClient`. A simulator speaks plain
|
|
334
|
+
HTTP on a free port of `127.0.0.1`, which nothing outside the machine
|
|
335
|
+
reaches.
|
|
336
|
+
|
|
337
|
+
Describe the adapter and its unit in the types the clients resolve with:
|
|
338
|
+
|
|
339
|
+
| Option | Holds | Defaults to |
|
|
340
|
+
| --- | --- | --- |
|
|
341
|
+
| `deviceInfo` | `name`, `macAddress` and `firmwareVersion`, as `getDeviceInfo()` reads them | A name of `Simulator` |
|
|
342
|
+
| `unit` | What the unit has: see below | A heat pump with every fan speed, swing on both axes and all three special modes |
|
|
343
|
+
| `state` | Any fields of a `DaikinState`, `specialModes` included | Off, in cool at 24 °C, on the auto fan speed |
|
|
344
|
+
| `sensors` | Any fields of a `DaikinSensors`; `null` is a reading the unit lacks | 26 °C and 55 % indoors, 30 °C outdoors |
|
|
345
|
+
|
|
346
|
+
| `unit` field | Holds | Defaults to |
|
|
347
|
+
| --- | --- | --- |
|
|
348
|
+
| `coolingOnly` | `true` for a unit that offers dehumidify, cool and fan alone | `false` |
|
|
349
|
+
| `fan` | `false` for a unit whose fan speed cannot be set | `true` |
|
|
350
|
+
| `fanLevels` | 2, 3 or 5 fan levels. Classic simulator only | 5 |
|
|
351
|
+
| `swing` | `none`, `vertical` or `both` | `both` |
|
|
352
|
+
| `specialModes` | Those of `powerful`, `econo` and `streamer` the unit takes | All three |
|
|
353
|
+
| `coolTemperaturesInC`, `heatTemperaturesInC` | `{ min, max }` | 18 to 32 and 10 to 30 |
|
|
354
|
+
|
|
355
|
+
`setState()` and `setSensors()` change a running simulator the same way.
|
|
356
|
+
`setState()` throws an `Error` for a field the unit has nothing to hold, such
|
|
357
|
+
as a `verticalPosition` on a unit without fixed louver positions.
|
|
358
|
+
|
|
359
|
+
| To | Do |
|
|
360
|
+
| --- | --- |
|
|
361
|
+
| Check what the unit holds | Call `getState()` on a client |
|
|
362
|
+
| Check what your code sent | Read `simulator.requests`: each has `method`, `path`, `query`, `headers` and `body` |
|
|
363
|
+
| Require registration (classic) | Pass `key`: the simulator answers HTTP 403 until `registerTerminal()` is given it |
|
|
364
|
+
| Require the child lock code | Pass `localPassword` |
|
|
365
|
+
| Make the adapter slow | Pass `replyDelayInMs`: it answers one request at a time, so a second request waits for the first |
|
|
366
|
+
| Make the adapter unreachable | `await simulator.stop()` |
|
|
367
|
+
| Reach it from another machine | Pass `address`, an address of this machine other than the default `127.0.0.1` |
|
|
368
|
+
| Have `discoverDevices()` find it | Pass `answersDiscovery: true` |
|
|
369
|
+
|
|
370
|
+
Start as many discoverable simulators as you like, in one process or several:
|
|
371
|
+
`discoverDevices()` resolves with one device for each, at `127.0.0.1` and the
|
|
372
|
+
simulator's own port.
|
|
373
|
+
|
|
374
|
+
`discoverDevices()` broadcasts the probe, so it also finds the real adapters
|
|
375
|
+
on the LAN, and it needs a network to broadcast on. Only a program that is
|
|
376
|
+
not a simulator gets in the way: while one holds UDP port 30050, starting a
|
|
377
|
+
simulator with `answersDiscovery` rejects with the socket's error.
|
|
378
|
+
|
|
379
|
+
For anything the options above do not cover, such as humidity settings or
|
|
380
|
+
fixed louver positions, set the adapter's own fields. A classic simulator
|
|
381
|
+
takes `basicInfo`, `modelInfo`, `controlInfo` and `sensorInfo`, the fields of
|
|
382
|
+
each reply, and holds them under the same names. A DSIOT simulator takes
|
|
383
|
+
`leaves`, and holds each leaf by its address. A field given this way replaces
|
|
384
|
+
what `unit` sets, and `state` and `sensors` replace it in turn. The package
|
|
385
|
+
root exports the adapter's codes as tables, such as `CLASSIC_FAN_SPEED_CODES`
|
|
386
|
+
and `DSIOT_PATHS`.
|
|
387
|
+
|
|
388
|
+
```ts
|
|
389
|
+
// A classic unit with 3D airflow: both louvers, and five fixed positions.
|
|
390
|
+
const classic = await startClassicSimulator({
|
|
391
|
+
modelInfo: { en_fdir2: "1", s_fdir_ud: "81", s_fdir_ud_step: "5", s_fdir_lr: "1" },
|
|
392
|
+
controlInfo: { f_dir_ud: "0", f_dir_lr: "0" },
|
|
393
|
+
});
|
|
394
|
+
classic.setState({ verticalPosition: "position3" });
|
|
395
|
+
|
|
396
|
+
// A DSIOT unit that takes a humidity setting in cool.
|
|
397
|
+
const dsiot = await startDsiotSimulator({
|
|
398
|
+
leaves: {
|
|
399
|
+
"/dsiot/edge/adr_0100.dgc_status.e_1002.e_3001.p_0C": { pv: "00", pt: 2 },
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
dsiot.setState({ targetHumidity: "auto" });
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
A simulator answers HTTP 501 to a request it has no answer for, so a client
|
|
406
|
+
rejects with a `DaikinError` whose `httpStatusCode` is 501.
|
|
407
|
+
[UNSUPPORTED.md](UNSUPPORTED.md#simulators) lists what a simulator leaves out,
|
|
408
|
+
and each answer that is not known to be a real adapter's.
|
|
409
|
+
[DESIGN.md](DESIGN.md#simulators) says what a simulator shares with the
|
|
410
|
+
clients' codecs, and why no more.
|
|
411
|
+
|
|
294
412
|
## Coverage & limitations
|
|
295
413
|
|
|
296
414
|
It supports the same markets and Wi-Fi adapters as the DAIKIN Mobile Controller
|
package/UNSUPPORTED.md
CHANGED
|
@@ -15,7 +15,7 @@ To add one, pin down the request and reply first, then delete its row.
|
|
|
15
15
|
| Classic `shum_asean`, the humidity setting of a `subtype=qa` unit | What each value stands for. `setState` sends such a unit no humidity setting, and `getCapabilities` lists none. | `ClassicDaikinClient.command()` |
|
|
16
16
|
| Classic vertical louver value `f_dir_ud=C` | What it stands for. `getState` reports `null`. | `ClassicDaikinClient.command()` |
|
|
17
17
|
| Classic schedule demand mode (`mode=1`) | The full format of the weekly table it needs (`moc`..`suc`, `<day><n>_en`/`_t`/`_p`). | `ClassicDaikinClient.command()` |
|
|
18
|
-
|
|
|
18
|
+
| Heat plus: classic `spmode_kind=4`, DSIOT `dgc_status.e_1002.e_3003.p_1C` | Which units take it. | `ClassicDaikinClient.command()`, `DsiotDaikinClient.multireqUpdate()` |
|
|
19
19
|
| Timers, weekly programs, schedule timers (`/aircon/get_timer`, `set_timer`, `get_program`, `set_program`, `get_scdltimer_info`, `get_scdltimer_body`, `set_scdltimer_info`, `set_scdltimer_body`) | Their parameters. | `ClassicDaikinClient.command()` |
|
|
20
20
|
| Classic setting reads: `/aircon/get_demand_control`, `/aircon/get_price`, `/aircon/get_target`, `/common/get_holiday` | The reply fields. `getHolidayMode` reads `/common/basic_info` instead. | `ClassicDaikinClient.command()` |
|
|
21
21
|
| Classic `method` in `/common/get_remote_method` | Whether the reply carries it. `getOutOfHomeAccess` reads `/common/basic_info` instead. | `ClassicDaikinClient.command()` |
|
|
@@ -24,12 +24,13 @@ To add one, pin down the request and reply first, then delete its row.
|
|
|
24
24
|
| Compressor frequency: classic `cmpfreq` in `/aircon/get_sensor_info`, DSIOT `dgc_status.e_1003.e_2006.p_04` | The unit. | `ClassicDaikinClient.command()`, `DsiotDaikinClient.multireqGet()` |
|
|
25
25
|
| Error code: classic `err` in `/aircon/get_sensor_info` and `/common/basic_info` | Which code on the unit's display each number stands for. | `ClassicDaikinClient.command()` |
|
|
26
26
|
| Reading the settings of a DSIOT adapter: LED, holiday mode, icon, group | The value encoding of each `adp_d` leaf. | `DsiotDaikinClient.multireqGet()` |
|
|
27
|
-
| Special modes through `setState`, and on a DSIOT adapter at all | Whether a DSIOT adapter accepts a write to the leaves `getState` reads, and which value turns a mode on. | `ClassicDaikinClient.setSpecialMode()`, `DsiotDaikinClient.multireqUpdate()` |
|
|
28
27
|
| Classic `powerful` and `econo` on a unit whose `cpv` is not 3, or whose `cpv_minor` is `00` or missing | Whether such a unit takes them. `getCapabilities` lists neither for it, whatever its `en_spmode`. | `ClassicDaikinClient.setSpecialMode()` |
|
|
29
|
-
| `econo` in fan mode | Whether a unit takes it. `getCapabilities` lists it in every mode but fan. | `
|
|
28
|
+
| `econo` in fan mode | Whether a unit takes it. `getCapabilities` lists it in every mode but fan. | `DaikinClient.setSpecialMode()` |
|
|
29
|
+
| A special mode switched on while another is on | Whether the adapter switches the other off. `setSpecialMode` writes the one mode it is given. | `DaikinClient.setSpecialMode()` |
|
|
30
30
|
| Classic notifications, clock and account: `/common/get_notify`, `set_notify`, `set_push_notice`, `set_timezone`, `notify_date_time`, `set_account` | Their parameters. | `ClassicDaikinClient.command()` |
|
|
31
31
|
| Classic network: `/common/get_network_setting`, `set_network_setting`, `start_wifi_scan`, `get_wifi_scan_result`, `start_wifi_connection`, `permit_wifi_connection`, `set_lpw` | Their parameters. | `ClassicDaikinClient.command()` |
|
|
32
32
|
| Classic firmware update: a POST to `/dkac/system/fwupdate` | The format of the upload. | Not reachable |
|
|
33
|
+
| A terminal uuid in another form: with dashes, uppercase, or not 32 hexadecimal digits | Whether the adapter accepts it. `createDaikinClient` throws an `Error` for one. | Not reachable |
|
|
33
34
|
|
|
34
35
|
## Not modelled
|
|
35
36
|
|
|
@@ -50,3 +51,40 @@ stands for is not known:
|
|
|
50
51
|
| --- | --- |
|
|
51
52
|
| `DeviceMetadata.icon` | The `icon` that classic `/common/set_icon` takes |
|
|
52
53
|
| `DaikinCapabilities.model` | The classic `model` field, or DSIOT `dgc_status.e_1002.e_A001.p_0D`, such as `0ABB` |
|
|
54
|
+
|
|
55
|
+
## Simulators
|
|
56
|
+
|
|
57
|
+
`startClassicSimulator` and `startDsiotSimulator` answer HTTP 501 to every
|
|
58
|
+
request this table leaves them without an answer for:
|
|
59
|
+
|
|
60
|
+
| Left out | What is unknown |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| A classic endpoint without a typed method on `ClassicDaikinClient`, and any method but GET | The reply fields. |
|
|
63
|
+
| Classic `/common/register_terminal` on an adapter started without a `key` | What an adapter that requires no registration answers. |
|
|
64
|
+
| A DSIOT resource other than `adp_i`, `adp_d` and the `dgc_status` of the indoor and the outdoor unit | The leaves and their encodings. |
|
|
65
|
+
| A DSIOT read of a node below a resource, a read with a query other than `filter`, and a write that names a leaf the adapter does not report | What an adapter answers. |
|
|
66
|
+
| A `/dsiot/multireq` body that is not JSON, has no `requests`, or carries an `op` other than 2 in a POST and 3 in a PUT | What an adapter answers. |
|
|
67
|
+
| `setState` on a DSIOT simulator with a humidity percentage, or a fixed horizontal louver position: it throws an `Error` | The step a percentage is counted in, and which value each position is. Set the leaf in `leaves`. |
|
|
68
|
+
| HTTPS | The certificate an adapter presents is issued by Daikin's own CA. A simulator started with a `key` reports `adp_kind=4`, an adapter that registers terminals over HTTP. |
|
|
69
|
+
|
|
70
|
+
These answers are a simulator's own choice, where an adapter's is not known:
|
|
71
|
+
|
|
72
|
+
| A simulator | What is unknown |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| Answers HTTP 403 to a terminal that is not registered, `/common/basic_info` included, and to `/common/register_terminal` with the wrong key | Which of HTTP 401 and 403 an adapter answers, which endpoints it answers before registration, and what it answers to a wrong key. |
|
|
75
|
+
| Answers `ret=LPW NG` to every classic endpoint without the right `lpw` | Which endpoints an adapter answers without it. |
|
|
76
|
+
| Answers `rsc` 4001, with HTTP 200, to a DSIOT request without the right `Authorization` | Whether an adapter answers that or HTTP 401. |
|
|
77
|
+
| Answers `ret=PARAM NG` to a classic write without a parameter, or with a `spmode_kind` other than 1, 2 and 4. `/aircon/set_control_info` needs `pow`, `mode`, `stemp`, `f_rate` and, on a unit that reports it, `shum` | Which requests an adapter answers `PARAM NG`, and whether it takes a `set_control_info` without one of them. |
|
|
78
|
+
| Holds any value it is sent or set to, and a special mode the unit does not report taking | What an adapter answers to a value the unit does not take. |
|
|
79
|
+
| Drops a `/aircon/set_control_info` parameter that is not a control field or the `dt`, `dh` or `dfd` of a mode | Which other parameters an adapter takes. |
|
|
80
|
+
| Answers `/common/get_remote_method` with `notice_ip_int` and `notice_sync_int` alone | Whether the reply carries `method`. |
|
|
81
|
+
| Answers every reply's fields in one order, with no field beyond those it holds | The order of an adapter's fields, and the fields no caller of this package reads. |
|
|
82
|
+
| Keeps answering after `/common/reboot` and `/config/system/reboot` | How long an adapter stays away. |
|
|
83
|
+
| Answers `rsc` 2000 to a DSIOT read and 2004 to a write, without `fr`, and without `pc` on a write | Which `rsc` from 2000 to 2004 an adapter answers each with, and what else the reply carries. |
|
|
84
|
+
| Sends a leaf's `pn` and `pt` whatever a read's `filter` lists, its `pv` and `md` when the filter lists them, and all four without a filter | What an adapter sends for a filter other than `pv`, `pv,md` and `pv,pt,md`. |
|
|
85
|
+
| Sends `b` as the `pt` inside each `md`, and gives a leaf `pt` 2 where a write is known for it and 3 otherwise | What `md.pt` holds, and what tells `pt` 2 from 3 beyond a special mode's leaf. |
|
|
86
|
+
| Leaves every other leaf as it is when one is written: switching powerful on leaves econo on | Which leaves a DSIOT adapter changes on its own. |
|
|
87
|
+
| Holds `--` as the `stemp` and `shum` of a classic mode without a `dt` or a `dh`, when `setState` changes to it | What a unit holds in fan mode after a change on its remote control. |
|
|
88
|
+
| Still answers `f_dir` in `/aircon/get_control_info` on a classic simulator started with a `unit` whose `swing` is `none` | Whether a classic unit without a louver reports the field. |
|
|
89
|
+
| Makes a request wait while it answers another | Whether an adapter also drops a connection while it is busy. |
|
|
90
|
+
| Answers a discovery probe from UDP port 30050 of its address | The port an adapter answers from. |
|
|
@@ -22,6 +22,8 @@ export declare class ClassicDaikinClient implements DaikinClient {
|
|
|
22
22
|
setState(control: DaikinControl): Promise<void>;
|
|
23
23
|
getSensors(): Promise<DaikinSensors>;
|
|
24
24
|
getStateAndSensors(): Promise<DaikinStateAndSensors>;
|
|
25
|
+
/** `set_special_mode`, an endpoint of its own beside `set_control_info`. */
|
|
26
|
+
setSpecialMode(mode: SpecialMode, enabled: boolean): Promise<void>;
|
|
25
27
|
/** Whether the adapter's status LED is on (`basic_info`): `null` when the
|
|
26
28
|
* adapter does not report it. */
|
|
27
29
|
getLed(): Promise<boolean | null>;
|
|
@@ -34,8 +36,6 @@ export declare class ClassicDaikinClient implements DaikinClient {
|
|
|
34
36
|
setHolidayMode(enabled: boolean): Promise<void>;
|
|
35
37
|
/** Demand control — cap the unit's power draw (`set_demand_control`). */
|
|
36
38
|
setDemandControl(demand: DemandControl): Promise<void>;
|
|
37
|
-
/** Powerful, econo or streamer (`set_special_mode`). */
|
|
38
|
-
setSpecialMode(mode: SpecialMode, enabled: boolean): Promise<void>;
|
|
39
39
|
/** Whether the unit can be operated from outside the home network
|
|
40
40
|
* (`basic_info`): `null` when the adapter does not report it. */
|
|
41
41
|
getOutOfHomeAccess(): Promise<boolean | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic.d.ts","sourceRoot":"","sources":["../../src/clients/classic.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,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5B;IAED;;;6DAGyD;IACnD,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,EAAE,KAAY,EAAE,GAAE,oBAAyB,GAC1C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAqBjC;YAEa,eAAe;IAM7B,OAAO,CAAC,oBAAoB;CAY7B"}
|
package/dist/clients/classic.js
CHANGED
|
@@ -69,6 +69,10 @@ export class ClassicDaikinClient {
|
|
|
69
69
|
async getStateAndSensors() {
|
|
70
70
|
return { state: await this.getState(), sensors: await this.getSensors() };
|
|
71
71
|
}
|
|
72
|
+
/** `set_special_mode`, an endpoint of its own beside `set_control_info`. */
|
|
73
|
+
async setSpecialMode(mode, enabled) {
|
|
74
|
+
await this.command(CLASSIC_ROUTES.setSpecialMode, encodeClassicSpecialMode(mode, enabled));
|
|
75
|
+
}
|
|
72
76
|
// --- extended controls ---------------------------------------------------
|
|
73
77
|
// Each write goes to its own endpoint, not `set_control_info`.
|
|
74
78
|
/** Whether the adapter's status LED is on (`basic_info`): `null` when the
|
|
@@ -93,10 +97,6 @@ export class ClassicDaikinClient {
|
|
|
93
97
|
async setDemandControl(demand) {
|
|
94
98
|
await this.command(CLASSIC_ROUTES.setDemandControl, encodeClassicDemandControl(demand));
|
|
95
99
|
}
|
|
96
|
-
/** Powerful, econo or streamer (`set_special_mode`). */
|
|
97
|
-
async setSpecialMode(mode, enabled) {
|
|
98
|
-
await this.command(CLASSIC_ROUTES.setSpecialMode, encodeClassicSpecialMode(mode, enabled));
|
|
99
|
-
}
|
|
100
100
|
/** Whether the unit can be operated from outside the home network
|
|
101
101
|
* (`basic_info`): `null` when the adapter does not report it. */
|
|
102
102
|
async getOutOfHomeAccess() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic.js","sourceRoot":"","sources":["../../src/clients/classic.ts"],"names":[],"mappings":"AAAA,OAAO,EAC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ACH,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,oBAAoB;QAC1B,IAAI,CAAC,gBAAgB,KAAK,CAAC,KAAK,IAAI,EAAE,CACpC,4BAA4B,CAC1B,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,EAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAChD,CAAC,EAAE,CAAC;QACP,6DAA6D;QAC7D,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF"}
|
package/dist/clients/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DaikinCapabilities } from "../models/capabilities.js";
|
|
2
2
|
import type { DaikinDeviceInfo } from "../models/device.js";
|
|
3
|
-
import type { DaikinControl, DaikinSensors, DaikinState, DaikinStateAndSensors } from "../models/state.js";
|
|
3
|
+
import type { DaikinControl, DaikinSensors, DaikinState, DaikinStateAndSensors, SpecialMode } from "../models/state.js";
|
|
4
4
|
/** The controls every adapter offers, whatever its wire protocol or
|
|
5
5
|
* authentication. `createDaikinClient` picks the implementation, so a caller
|
|
6
6
|
* needs the concrete class only for what one protocol adds, such as
|
|
@@ -18,6 +18,10 @@ export interface DaikinClient {
|
|
|
18
18
|
* a reply to `getState` or `getStateAndSensors` younger than
|
|
19
19
|
* `CreateDaikinClientOptions.maxStateAgeForSetStateInMs`. */
|
|
20
20
|
setState(control: DaikinControl): Promise<void>;
|
|
21
|
+
/** Turn powerful, econo or streamer on or off, with a request of its own.
|
|
22
|
+
* `DaikinCapabilities.specialModes` lists the ones the unit takes in each
|
|
23
|
+
* mode, and the client sends any other as given. */
|
|
24
|
+
setSpecialMode(mode: SpecialMode, enabled: boolean): Promise<void>;
|
|
21
25
|
/** Read-only temperature / humidity readings. */
|
|
22
26
|
getSensors(): Promise<DaikinSensors>;
|
|
23
27
|
/** What `getState` and `getSensors` resolve with, together. A DSIOT adapter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/clients/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/clients/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B;;;;2CAI2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,4DAA4D;IAC5D,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE3C,qCAAqC;IACrC,eAAe,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE/C,kCAAkC;IAClC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAEjC;;;iEAG6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;wDAEoD;IACpD,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE,iDAAiD;IACjD,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAErC;;8DAE0D;IAC1D,kBAAkB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAErD,2CAA2C;IAC3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
package/dist/clients/dsiot.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DsiotUpdate } from "../codecs/dsiot/multireq.js";
|
|
2
2
|
import type { DaikinCapabilities } from "../models/capabilities.js";
|
|
3
3
|
import type { DaikinDeviceInfo } from "../models/device.js";
|
|
4
|
-
import type { DaikinControl, DaikinSensors, DaikinState, DaikinStateAndSensors } from "../models/state.js";
|
|
4
|
+
import type { DaikinControl, DaikinSensors, DaikinState, DaikinStateAndSensors, SpecialMode } from "../models/state.js";
|
|
5
5
|
import { type DaikinRequestOptions, type DaikinRetryOptions, type DaikinTransport } from "../transport.js";
|
|
6
6
|
import type { DaikinClient } from "./client.js";
|
|
7
7
|
/** DSIOT adapter (BRP084-style). One endpoint, `/dsiot/multireq`: POST to read
|
|
@@ -21,6 +21,8 @@ export declare class DsiotDaikinClient implements DaikinClient {
|
|
|
21
21
|
setState(control: DaikinControl): Promise<void>;
|
|
22
22
|
getSensors(): Promise<DaikinSensors>;
|
|
23
23
|
getStateAndSensors(): Promise<DaikinStateAndSensors>;
|
|
24
|
+
/** One leaf of `dgc_status`, on the outdoor unit for powerful. */
|
|
25
|
+
setSpecialMode(mode: SpecialMode, enabled: boolean): Promise<void>;
|
|
24
26
|
/** Reboot the adapter (`/config/system/reboot`). */
|
|
25
27
|
reboot(): Promise<void>;
|
|
26
28
|
/** Raw multireq read of whole resources (`DSIOT_TARGETS` values or any `to`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsiot.d.ts","sourceRoot":"","sources":["../../src/clients/dsiot.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"dsiot.d.ts","sourceRoot":"","sources":["../../src/clients/dsiot.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,6BAA6B,CAAC;AAQrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAUhD;6DAC6D;AAC7D,qBAAa,iBAAkB,YAAW,YAAY;IAOlD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAPhC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAE9C;;iEAE6D;IAC7D,YACmB,SAAS,EAAE,eAAe,EAC1B,YAAY,CAAC,EAAE,kBAAkB,YAAA,EAClD,0BAA0B,SAAI,EAG/B;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;IAEK,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAO/C;IAEK,eAAe,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAQnD;IAEK,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAErC;IAEK,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAKpD;IAEK,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC,CAOzC;IAEK,kBAAkB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAMzD;IAED,kEAAkE;IAC5D,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;IAID,oDAAoD;IAC9C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAK5B;IAED;4CACwC;IAClC,WAAW,CACf,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAEjC;IAED;iFAC6E;IACvE,cAAc,CAClB,OAAO,EAAE,WAAW,EAAE,EACtB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAEjC;YAEa,QAAQ;YAoBR,UAAU;CAQzB"}
|
package/dist/clients/dsiot.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { parseDsiotCapabilities } from "../codecs/dsiot/capabilities.js";
|
|
2
2
|
import { parseDsiotDeviceInfo } from "../codecs/dsiot/device.js";
|
|
3
|
-
import { buildDsiotMultireqGet, buildDsiotMultireqUpdate,
|
|
4
|
-
import { applyDsiotControl, parseDsiotSensors, parseDsiotState, } from "../codecs/dsiot/state.js";
|
|
3
|
+
import { buildDsiotMultireqGet, buildDsiotMultireqUpdate, parseDsiotMultireqReply, } from "../codecs/dsiot/multireq.js";
|
|
4
|
+
import { applyDsiotControl, buildDsiotSpecialModeUpdate, parseDsiotSensors, parseDsiotState, } from "../codecs/dsiot/state.js";
|
|
5
|
+
import { DSIOT_TARGETS } from "../codecs/dsiot/tables.js";
|
|
5
6
|
import { withRetry, } from "../transport.js";
|
|
6
7
|
import { SetStateCache } from "./setStateCache.js";
|
|
7
8
|
// DSIOT endpoints (BRP084-style). Climate state is a POST (read) or PUT (write)
|
|
@@ -61,6 +62,10 @@ export class DsiotDaikinClient {
|
|
|
61
62
|
sensors: parseDsiotSensors(values),
|
|
62
63
|
};
|
|
63
64
|
}
|
|
65
|
+
/** One leaf of `dgc_status`, on the outdoor unit for powerful. */
|
|
66
|
+
async setSpecialMode(mode, enabled) {
|
|
67
|
+
await this.multireq("PUT", buildDsiotSpecialModeUpdate(mode, enabled));
|
|
68
|
+
}
|
|
64
69
|
// --- extended controls ---------------------------------------------------
|
|
65
70
|
/** Reboot the adapter (`/config/system/reboot`). */
|
|
66
71
|
async reboot() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsiot.js","sourceRoot":"","sources":["../../src/clients/dsiot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"dsiot.js","sourceRoot":"","sources":["../../src/clients/dsiot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EAExB,uBAAuB,GACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAU1D,OAAO,EAIL,SAAS,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,gFAAgF;AAChF,yCAAyC;AACzC,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,uBAAuB;CACvB,CAAC;AAEX;6DAC6D;AAC7D,MAAM,OAAO,iBAAiB;IAOT,SAAS;IAC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AS,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAC5D,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,sEAAsE;YACtE,YAAY;YACZ,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU;QACtB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YACpC,aAAa,CAAC,YAAY;YAC1B,aAAa,CAAC,aAAa;SAC5B,CAAC,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/codecs/classic/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/codecs/classic/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,8BAA8B,CAAC;AAoDtC;;;;yBAIyB;AACzB,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED;;;qBAGqB;AACrB,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,kBAAkB,CAmCpB;AA0ED;wEACwE;AACxE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAE5E;AAoCD;wCACwC;AACxC,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAY7E"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { FIXED_LOUVER_POSITIONS, HUMIDITY_SETTINGS, OPERATING_MODES, SPECIAL_MODES, SWING_MODES, } from "../../models/state.js";
|
|
2
|
+
import { CLASSIC_COOLING_ONLY_TYPE, CLASSIC_SPECIAL_MODE_BITS, } from "./tables.js";
|
|
2
3
|
const CAPABILITY_VERSIONS = ["0", "1", "2", "3"];
|
|
3
|
-
// `en_spmode` sets one bit for each special mode the unit takes. Bit 8 is a
|
|
4
|
-
// mode outside `SpecialMode`. The powerful and econo bits count only at
|
|
5
|
-
// `cpv=3` with a `cpv_minor` other than `00`: see UNSUPPORTED.md.
|
|
6
|
-
const SPECIAL_MODE_BITS = {
|
|
7
|
-
powerful: 1,
|
|
8
|
-
econo: 2,
|
|
9
|
-
streamer: 4,
|
|
10
|
-
};
|
|
11
4
|
const COOLING_ONLY_MODES = [
|
|
12
5
|
"cool",
|
|
13
6
|
"dehumidify",
|
|
@@ -87,11 +80,12 @@ export function parseClassicCapabilities(fields) {
|
|
|
87
80
|
};
|
|
88
81
|
}
|
|
89
82
|
// Lists none for a unit that reports no `en_spmode`, and econo in every mode
|
|
90
|
-
// but fan
|
|
83
|
+
// but fan. The powerful and econo bits count only at `cpv=3` with a
|
|
84
|
+
// `cpv_minor` other than `00`: see UNSUPPORTED.md.
|
|
91
85
|
function specialModes(fields, cpv, offeredModes) {
|
|
92
86
|
const bits = Number.parseInt(fields.en_spmode ?? "", 10);
|
|
93
87
|
const followsPowerfulAndEcono = cpv === "3" && (fields.cpv_minor ?? "00") !== "00";
|
|
94
|
-
const taken = SPECIAL_MODES.filter((specialMode) => (bits &
|
|
88
|
+
const taken = SPECIAL_MODES.filter((specialMode) => (bits & CLASSIC_SPECIAL_MODE_BITS[specialMode]) !== 0 &&
|
|
95
89
|
(specialMode === "streamer" || followsPowerfulAndEcono));
|
|
96
90
|
const inMode = (mode) => offeredModes.includes(mode)
|
|
97
91
|
? taken.filter((specialMode) => mode !== "fan" || specialMode !== "econo")
|
|
@@ -111,7 +105,7 @@ function modes(fields, cpv) {
|
|
|
111
105
|
if (!CAPABILITY_VERSIONS.includes(cpv)) {
|
|
112
106
|
return [];
|
|
113
107
|
}
|
|
114
|
-
return fields.model_type ===
|
|
108
|
+
return fields.model_type === CLASSIC_COOLING_ONLY_TYPE
|
|
115
109
|
? OPERATING_MODES.filter((mode) => COOLING_ONLY_MODES.includes(mode))
|
|
116
110
|
: [...OPERATING_MODES];
|
|
117
111
|
}
|