daikin-local-control 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +98 -0
- package/LICENSE +674 -0
- package/README.md +317 -0
- package/UNSUPPORTED.md +43 -0
- package/dist/authentication.d.ts +24 -0
- package/dist/authentication.d.ts.map +1 -0
- package/dist/authentication.js +30 -0
- package/dist/authentication.js.map +1 -0
- package/dist/clients/classic.d.ts +53 -0
- package/dist/clients/classic.d.ts.map +1 -0
- package/dist/clients/classic.js +142 -0
- package/dist/clients/classic.js.map +1 -0
- package/dist/clients/client.d.ts +21 -0
- package/dist/clients/client.d.ts.map +1 -0
- package/dist/clients/client.js +2 -0
- package/dist/clients/client.js.map +1 -0
- package/dist/clients/dsiot.d.ts +28 -0
- package/dist/clients/dsiot.d.ts.map +1 -0
- package/dist/clients/dsiot.js +66 -0
- package/dist/clients/dsiot.js.map +1 -0
- package/dist/codecs/classic/capabilities.d.ts +19 -0
- package/dist/codecs/classic/capabilities.d.ts.map +1 -0
- package/dist/codecs/classic/capabilities.js +208 -0
- package/dist/codecs/classic/capabilities.js.map +1 -0
- package/dist/codecs/classic/extendedControl.d.ts +20 -0
- package/dist/codecs/classic/extendedControl.d.ts.map +1 -0
- package/dist/codecs/classic/extendedControl.js +88 -0
- package/dist/codecs/classic/extendedControl.js.map +1 -0
- package/dist/codecs/classic/keyValue.d.ts +10 -0
- package/dist/codecs/classic/keyValue.d.ts.map +1 -0
- package/dist/codecs/classic/keyValue.js +36 -0
- package/dist/codecs/classic/keyValue.js.map +1 -0
- package/dist/codecs/classic/state.d.ts +18 -0
- package/dist/codecs/classic/state.d.ts.map +1 -0
- package/dist/codecs/classic/state.js +235 -0
- package/dist/codecs/classic/state.js.map +1 -0
- package/dist/codecs/credentials.d.ts +8 -0
- package/dist/codecs/credentials.d.ts.map +1 -0
- package/dist/codecs/credentials.js +14 -0
- package/dist/codecs/credentials.js.map +1 -0
- package/dist/codecs/device.d.ts +6 -0
- package/dist/codecs/device.d.ts.map +1 -0
- package/dist/codecs/device.js +35 -0
- package/dist/codecs/device.js.map +1 -0
- package/dist/codecs/dsiot/capabilities.d.ts +5 -0
- package/dist/codecs/dsiot/capabilities.d.ts.map +1 -0
- package/dist/codecs/dsiot/capabilities.js +139 -0
- package/dist/codecs/dsiot/capabilities.js.map +1 -0
- package/dist/codecs/dsiot/multireq.d.ts +37 -0
- package/dist/codecs/dsiot/multireq.d.ts.map +1 -0
- package/dist/codecs/dsiot/multireq.js +122 -0
- package/dist/codecs/dsiot/multireq.js.map +1 -0
- package/dist/codecs/dsiot/state.d.ts +92 -0
- package/dist/codecs/dsiot/state.d.ts.map +1 -0
- package/dist/codecs/dsiot/state.js +461 -0
- package/dist/codecs/dsiot/state.js.map +1 -0
- package/dist/discovery.d.ts +17 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +67 -0
- package/dist/discovery.js.map +1 -0
- package/dist/error.d.ts +15 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +20 -0
- package/dist/error.js.map +1 -0
- package/dist/factory.d.ts +26 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +31 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/models/capabilities.d.ts +42 -0
- package/dist/models/capabilities.d.ts.map +1 -0
- package/dist/models/capabilities.js +2 -0
- package/dist/models/capabilities.js.map +1 -0
- package/dist/models/device.d.ts +24 -0
- package/dist/models/device.d.ts.map +1 -0
- package/dist/models/device.js +2 -0
- package/dist/models/device.js.map +1 -0
- package/dist/models/extendedControl.d.ts +31 -0
- package/dist/models/extendedControl.d.ts.map +1 -0
- package/dist/models/extendedControl.js +7 -0
- package/dist/models/extendedControl.js.map +1 -0
- package/dist/models/state.d.ts +56 -0
- package/dist/models/state.d.ts.map +1 -0
- package/dist/models/state.js +49 -0
- package/dist/models/state.js.map +1 -0
- package/dist/transport.d.ts +75 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +118 -0
- package/dist/transport.js.map +1 -0
- package/package.json +62 -0
- package/src/authentication.ts +53 -0
- package/src/clients/classic.ts +251 -0
- package/src/clients/client.ts +29 -0
- package/src/clients/dsiot.ts +116 -0
- package/src/codecs/classic/capabilities.ts +272 -0
- package/src/codecs/classic/extendedControl.ts +132 -0
- package/src/codecs/classic/keyValue.ts +39 -0
- package/src/codecs/classic/state.ts +302 -0
- package/src/codecs/credentials.ts +19 -0
- package/src/codecs/device.ts +41 -0
- package/src/codecs/dsiot/capabilities.ts +209 -0
- package/src/codecs/dsiot/multireq.ts +162 -0
- package/src/codecs/dsiot/state.ts +644 -0
- package/src/discovery.ts +85 -0
- package/src/error.ts +20 -0
- package/src/factory.ts +66 -0
- package/src/index.ts +21 -0
- package/src/models/capabilities.ts +52 -0
- package/src/models/device.ts +25 -0
- package/src/models/extendedControl.ts +41 -0
- package/src/models/state.ts +110 -0
- package/src/transport.ts +191 -0
package/DESIGN.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Design
|
|
2
|
+
|
|
3
|
+
## Retries
|
|
4
|
+
|
|
5
|
+
`withRetry` repeats only a `DaikinConnectionError`: a connection the adapter
|
|
6
|
+
refused, reset or closed before answering. By default it tries up to five more
|
|
7
|
+
times: at once, then after 50, 100, 200 and 400 ms, so it gives up about 750 ms
|
|
8
|
+
after the first failure. The first retry waits for nothing because the likeliest cause, a
|
|
9
|
+
reused connection the adapter has already closed, fails at once and is fixed by
|
|
10
|
+
a fresh connection.
|
|
11
|
+
|
|
12
|
+
Rejected: retrying by status, 502, 503 and 504, with a timeout reported as 504.
|
|
13
|
+
|
|
14
|
+
- A timeout costs a full `timeoutInMs` per attempt, so three attempts kept a
|
|
15
|
+
unit that stopped answering from failing for over 30 seconds.
|
|
16
|
+
- An HTTP status the adapter sent, and a `ret` or `rsc` other than OK, is the
|
|
17
|
+
adapter's reply, and asking again gets the same one.
|
|
18
|
+
- A status cannot mark a connection failure: DSIOT answers `rsc` 503 itself,
|
|
19
|
+
so the transport throws a class of its own.
|
|
20
|
+
|
|
21
|
+
Writes are retried as well: each typed write sets absolute values, so repeating
|
|
22
|
+
one that landed changes nothing. `reboot()` passes `{ retry: false }`, as should
|
|
23
|
+
any caller of `command()`, `multireqGet()` or `multireqUpdate()` whose request
|
|
24
|
+
is not safe to repeat.
|
|
25
|
+
|
|
26
|
+
## Capabilities
|
|
27
|
+
|
|
28
|
+
`DaikinCapabilities` lists what a unit accepts in the vocabulary of `DaikinState`:
|
|
29
|
+
`fanSpeeds` holds `FanSpeed` values, and `targetTemperatureInC` holds one range per
|
|
30
|
+
`OperatingMode`, `null` where the mode has no setpoint or the unit does not offer it.
|
|
31
|
+
|
|
32
|
+
Rejected: a `DaikinCapabilities` shaped like the adapter's own flags (`fan.controllable`,
|
|
33
|
+
`fan.auto`, `fan.silent`, `fan.steps`, and an `identity` of the raw `cpv`,
|
|
34
|
+
`adp_kind`, `reg` and unit `type`), with a `getControlOptions` that turned it
|
|
35
|
+
into the values a caller can send.
|
|
36
|
+
|
|
37
|
+
- A caller could send nothing from `DaikinCapabilities` until `getControlOptions` had
|
|
38
|
+
translated it, so every caller needed both.
|
|
39
|
+
- A DSIOT adapter reports none of those flags, so its codec made up classic
|
|
40
|
+
values, `cpv` 3 and `type` C or N, to fill `identity`.
|
|
41
|
+
|
|
42
|
+
`parseDsiotCapabilities` reads the `adp_i` and `dgc_status` trees itself.
|
|
43
|
+
|
|
44
|
+
Rejected: `parseDsiotCapabilities` turning the trees into classic `basic_info`
|
|
45
|
+
and `get_model_info` fields and passing them to `parseClassicCapabilities`.
|
|
46
|
+
|
|
47
|
+
- `parseClassicCapabilities` offers the fixed vertical positions only to a unit
|
|
48
|
+
with five of them, so a unit on a DSIOT adapter taking three fixed values
|
|
49
|
+
was offered none, while `parseDsiotState` reported it at `position2`.
|
|
50
|
+
- The classic fields cannot carry what the trees say: `s_fdir_ud` has no bit
|
|
51
|
+
for `naturalWind` or `auto`, and the classic limits are whole degrees where a
|
|
52
|
+
DSIOT setpoint counts half degrees.
|
|
53
|
+
|
|
54
|
+
## Target humidity
|
|
55
|
+
|
|
56
|
+
`DaikinState.targetHumidity` holds a `HumiditySetting` such as `off` or
|
|
57
|
+
`autoHigh`, or a percentage as `{ percent: 50 }`, and
|
|
58
|
+
`DaikinCapabilities.targetHumidity` lists, for each mode, the values a unit
|
|
59
|
+
takes. `setState` still encodes a percentage it is given, as it encodes a fan
|
|
60
|
+
speed outside `DaikinCapabilities.fanSpeeds`.
|
|
61
|
+
|
|
62
|
+
Rejected: a `targetHumidity` that held a percentage alone, with a
|
|
63
|
+
`DaikinCapabilities.targetHumidity` of `true` or `false`.
|
|
64
|
+
|
|
65
|
+
- A unit outside Japan is set to off or to one of the four named settings, so
|
|
66
|
+
`getState` reported `null` for every setting but off, and the only value a
|
|
67
|
+
caller could send was one such a unit is never set to.
|
|
68
|
+
- Each mode takes its own settings: fan takes none, dehumidify takes no off,
|
|
69
|
+
and a unit reports the rest mode by mode, in `s_humd` or by the humidity
|
|
70
|
+
leaves it has.
|
|
71
|
+
|
|
72
|
+
Rejected: a percentage as a bare `number`, with 0 for off.
|
|
73
|
+
|
|
74
|
+
- The field holds a setting as often as a quantity, so its name cannot carry
|
|
75
|
+
the unit, and a caller read `targetHumidity: 50` without one.
|
|
76
|
+
- Off is a setting, not a quantity: a unit that takes no percentage still
|
|
77
|
+
takes off, so 0 was the one number `DaikinCapabilities.targetHumidity`
|
|
78
|
+
listed beside the named settings.
|
|
79
|
+
|
|
80
|
+
## Louver positions
|
|
81
|
+
|
|
82
|
+
`VerticalPosition` and `HorizontalPosition` name each position, such as `swing`
|
|
83
|
+
and `position3`, and each codec holds its adapter's encoding. The compiler
|
|
84
|
+
rejects a position no adapter has. Which positions a unit takes depends on the
|
|
85
|
+
unit and the mode, which no type can say, so `setState` drops a position the
|
|
86
|
+
unit does not take, as it drops a `targetTemperatureInC` in a mode without a
|
|
87
|
+
setpoint. `DaikinCapabilities.verticalPositions` and `horizontalPositions` list
|
|
88
|
+
what a unit takes.
|
|
89
|
+
|
|
90
|
+
Rejected: positions as the numbers 0 to 25, typed `number`, with
|
|
91
|
+
`applyDsiotControl` throwing an `Error` for a number it could not encode.
|
|
92
|
+
|
|
93
|
+
- The numbers were neither adapter's encoding: classic sends a digit or a
|
|
94
|
+
letter and DSIOT a three-byte value, so a caller had to look up a third
|
|
95
|
+
numbering.
|
|
96
|
+
- A caller learned of a mistyped number only when the call ran.
|
|
97
|
+
- The `Error` was the one failure of `setState` that was not a
|
|
98
|
+
`DaikinError`.
|