daikin-local-control 0.3.1 → 0.5.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 +156 -2
- package/README.md +274 -48
- package/UNSUPPORTED.md +66 -3
- package/dist/clients/airbase.d.ts +64 -0
- package/dist/clients/airbase.d.ts.map +1 -0
- package/dist/clients/airbase.js +175 -0
- package/dist/clients/airbase.js.map +1 -0
- 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 +7 -2
- 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/airbase/capabilities.d.ts +23 -0
- package/dist/codecs/airbase/capabilities.d.ts.map +1 -0
- package/dist/codecs/airbase/capabilities.js +108 -0
- package/dist/codecs/airbase/capabilities.js.map +1 -0
- package/dist/codecs/airbase/state.d.ts +29 -0
- package/dist/codecs/airbase/state.d.ts.map +1 -0
- package/dist/codecs/airbase/state.js +166 -0
- package/dist/codecs/airbase/state.js.map +1 -0
- package/dist/codecs/airbase/tables.d.ts +7 -0
- package/dist/codecs/airbase/tables.d.ts.map +1 -0
- package/dist/codecs/airbase/tables.js +27 -0
- package/dist/codecs/airbase/tables.js.map +1 -0
- package/dist/codecs/airbase/zone.d.ts +12 -0
- package/dist/codecs/airbase/zone.d.ts.map +1 -0
- package/dist/codecs/airbase/zone.js +50 -0
- package/dist/codecs/airbase/zone.js.map +1 -0
- 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 +34 -0
- package/dist/codecs/classic/tables.d.ts.map +1 -0
- package/dist/codecs/classic/tables.js +96 -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.d.ts +7 -1
- package/dist/codecs/device.d.ts.map +1 -1
- package/dist/codecs/device.js +15 -3
- 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 +119 -0
- package/dist/codecs/dsiot/tables.d.ts.map +1 -0
- package/dist/codecs/dsiot/tables.js +188 -0
- package/dist/codecs/dsiot/tables.js.map +1 -0
- package/dist/discovery.d.ts +20 -9
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +102 -32
- package/dist/discovery.js.map +1 -1
- package/dist/factory.d.ts +13 -7
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +16 -4
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/models/device.d.ts +3 -2
- package/dist/models/device.d.ts.map +1 -1
- package/dist/models/device.js +1 -1
- package/dist/models/device.js.map +1 -1
- package/dist/models/state.d.ts +2 -3
- package/dist/models/state.d.ts.map +1 -1
- package/dist/models/zone.d.ts +9 -0
- package/dist/models/zone.d.ts.map +1 -0
- package/dist/models/zone.js +2 -0
- package/dist/models/zone.js.map +1 -0
- package/dist/simulators/airbase.d.ts +82 -0
- package/dist/simulators/airbase.d.ts.map +1 -0
- package/dist/simulators/airbase.js +352 -0
- package/dist/simulators/airbase.js.map +1 -0
- 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 +5 -0
- package/dist/simulators/index.d.ts.map +1 -0
- package/dist/simulators/index.js +4 -0
- package/dist/simulators/index.js.map +1 -0
- package/dist/simulators/simulator.d.ts +117 -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 +8 -3
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +10 -2
- package/dist/transport.js.map +1 -1
- package/package.json +11 -4
- package/src/clients/airbase.ts +274 -0
- package/src/clients/classic.ts +8 -8
- package/src/clients/client.ts +8 -1
- package/src/clients/dsiot.ts +8 -1
- package/src/codecs/airbase/capabilities.ts +150 -0
- package/src/codecs/airbase/state.ts +223 -0
- package/src/codecs/airbase/tables.ts +32 -0
- package/src/codecs/airbase/zone.ts +62 -0
- 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 +126 -0
- package/src/codecs/credentials.ts +11 -3
- package/src/codecs/device.ts +19 -3
- 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 +253 -0
- package/src/discovery.ts +107 -34
- package/src/factory.ts +26 -7
- package/src/index.ts +8 -0
- package/src/models/device.ts +3 -2
- package/src/models/state.ts +2 -3
- package/src/models/zone.ts +8 -0
- package/src/simulators/airbase.ts +495 -0
- package/src/simulators/classic.ts +636 -0
- package/src/simulators/dsiot.ts +736 -0
- package/src/simulators/index.ts +10 -0
- package/src/simulators/simulator.ts +282 -0
- package/src/transport.ts +15 -4
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { FanSpeed, HorizontalPosition, HumiditySetting, OperatingMode, SpecialMode, VerticalPosition } from "../../models/state.js";
|
|
2
|
+
export declare const DSIOT_OPERATIONS: {
|
|
3
|
+
readonly get: 2;
|
|
4
|
+
readonly update: 3;
|
|
5
|
+
readonly delete: 4;
|
|
6
|
+
};
|
|
7
|
+
/** The indoor and the outdoor unit are separate edges on the adapter. */
|
|
8
|
+
export declare const DSIOT_EDGES: {
|
|
9
|
+
readonly indoor: "adr_0100";
|
|
10
|
+
readonly outdoor: "adr_0200";
|
|
11
|
+
};
|
|
12
|
+
/** What the `to` of a request starts with: an adapter resource follows as
|
|
13
|
+
* `.adp_i`, and a unit's as `/adr_0100.dgc_status`. */
|
|
14
|
+
export declare const DSIOT_EDGE_ROOT = "/dsiot/edge";
|
|
15
|
+
/** What a read fetches, as the `to` of a request: whole trees, never single
|
|
16
|
+
* leaves. The status trees come with `pt`, which `parseDsiotCapabilities`
|
|
17
|
+
* reads. */
|
|
18
|
+
export declare const DSIOT_TARGETS: {
|
|
19
|
+
readonly adapterInfo: "/dsiot/edge.adp_i?filter=pv";
|
|
20
|
+
readonly adapterSettings: "/dsiot/edge.adp_d?filter=pv";
|
|
21
|
+
readonly indoorStatus: "/dsiot/edge/adr_0100.dgc_status?filter=pv,pt,md";
|
|
22
|
+
readonly outdoorStatus: "/dsiot/edge/adr_0200.dgc_status?filter=pv,pt,md";
|
|
23
|
+
};
|
|
24
|
+
/** `type` in a discovery reply from a DSIOT adapter. */
|
|
25
|
+
export declare const DSIOT_ADAPTER_TYPE = "GPF";
|
|
26
|
+
/** `cdev` in a discovery reply from a DSIOT adapter whose unit is an air
|
|
27
|
+
* cleaner. */
|
|
28
|
+
export declare const DSIOT_AIR_CLEANER_DEVICES: readonly string[];
|
|
29
|
+
/** Dotted paths into the `adp_i` and `adp_d` trees. The MAC address and the
|
|
30
|
+
* version hold the value a classic adapter sends in `basic_info`, and the
|
|
31
|
+
* name is plain text, where a classic adapter form-encodes it. */
|
|
32
|
+
export declare const DSIOT_ADAPTER_PATHS: {
|
|
33
|
+
readonly name: "adp_d.name";
|
|
34
|
+
readonly macAddress: "adp_i.mac";
|
|
35
|
+
readonly firmwareVersion: "adp_i.ver";
|
|
36
|
+
readonly region: "adp_i.reg";
|
|
37
|
+
readonly kind: "adp_i.kind";
|
|
38
|
+
readonly energyMonitoring: "adp_i.func.en_ipower";
|
|
39
|
+
readonly demandControl: "adp_i.func.en_demand";
|
|
40
|
+
readonly scheduleTimer: "adp_i.func.en_scdltmr";
|
|
41
|
+
};
|
|
42
|
+
/** Full dotted paths into the `dgc_status` trees. `e_1002` lives on the indoor
|
|
43
|
+
* edge and `e_1003` on the outdoor edge. */
|
|
44
|
+
export declare const DSIOT_PATHS: {
|
|
45
|
+
readonly power: "dgc_status.e_1002.e_A002.p_01";
|
|
46
|
+
/** Sent with every control. */
|
|
47
|
+
readonly powerTransition: "dgc_status.e_1002.e_3003.p_2D";
|
|
48
|
+
readonly mode: "dgc_status.e_1002.e_3001.p_01";
|
|
49
|
+
readonly indoorTemperature: "dgc_status.e_1002.e_A00B.p_01";
|
|
50
|
+
readonly indoorHumidity: "dgc_status.e_1002.e_A00B.p_02";
|
|
51
|
+
readonly outdoorTemperature: "dgc_status.e_1003.e_A00D.p_01";
|
|
52
|
+
readonly model: "dgc_status.e_1002.e_A001.p_0D";
|
|
53
|
+
readonly modelType: "dgc_status.e_1002.e_A001.p_07";
|
|
54
|
+
readonly energyMonitoring: "dgc_status.e_1002.e_A011.p_01";
|
|
55
|
+
};
|
|
56
|
+
/** What a leaf that is on or off holds, such as the power. */
|
|
57
|
+
export declare const DSIOT_ON = "01";
|
|
58
|
+
export declare const DSIOT_OFF = "00";
|
|
59
|
+
/** `DSIOT_PATHS.modelType` on a unit that only cools. */
|
|
60
|
+
export declare const DSIOT_COOLING_ONLY_MODEL_TYPE = "01";
|
|
61
|
+
/** Each leaf holds `01` while its mode is on. Powerful is on the outdoor
|
|
62
|
+
* edge. */
|
|
63
|
+
export declare const DSIOT_SPECIAL_MODE_PATHS: Record<SpecialMode, string>;
|
|
64
|
+
export interface DsiotSetpoint {
|
|
65
|
+
path: string;
|
|
66
|
+
/** Auto and dehumidify are a signed byte; cool and heat are little-endian. */
|
|
67
|
+
signed: boolean;
|
|
68
|
+
/** The dehumidify setpoint is read-only. */
|
|
69
|
+
writable: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface DsiotHumidity {
|
|
72
|
+
/** Counted in steps of the leaf's `md.st`. */
|
|
73
|
+
value: string;
|
|
74
|
+
/** The setting: `00` or `05` off, `01` the percentage in `value`, and one
|
|
75
|
+
* value for each `HumiditySetting`. */
|
|
76
|
+
flag: string;
|
|
77
|
+
}
|
|
78
|
+
export interface DsiotModePaths {
|
|
79
|
+
/** Absent in fan mode. */
|
|
80
|
+
setpoint?: DsiotSetpoint;
|
|
81
|
+
/** Absent in fan mode. */
|
|
82
|
+
humidity?: DsiotHumidity;
|
|
83
|
+
fanSpeed: string;
|
|
84
|
+
vertical: string;
|
|
85
|
+
horizontal: string;
|
|
86
|
+
}
|
|
87
|
+
export declare const DSIOT_MODE_NODE = "dgc_status.e_1002.e_3001";
|
|
88
|
+
export declare const DSIOT_MODE_PATHS: Record<OperatingMode, DsiotModePaths>;
|
|
89
|
+
export declare const DSIOT_OPERATING_MODE_CODES: Record<OperatingMode, string>;
|
|
90
|
+
export declare const DSIOT_FAN_SPEED_CODES: Record<FanSpeed, string>;
|
|
91
|
+
/** The values a louver leaf holds besides a fixed position, which is 1-14.
|
|
92
|
+
* The leaf is three bytes, little-endian, and bit n of its `md.mx` is set
|
|
93
|
+
* when the unit takes value n. */
|
|
94
|
+
export declare const DSIOT_LOUVER_VALUES: {
|
|
95
|
+
readonly stop: 0;
|
|
96
|
+
readonly swing: 15;
|
|
97
|
+
readonly auto: 16;
|
|
98
|
+
readonly naturalWind: 19;
|
|
99
|
+
readonly floorWarming: 25;
|
|
100
|
+
};
|
|
101
|
+
/** The values that are fixed positions: 1 to 14. */
|
|
102
|
+
export declare const DSIOT_FIXED_LOUVER_VALUES: number[];
|
|
103
|
+
export declare const DSIOT_LOUVER_STOP = "000000";
|
|
104
|
+
export declare const DSIOT_LOUVER_SWING = "0F0000";
|
|
105
|
+
/** The value each `VerticalPosition` is held as. A fixed position has none: it
|
|
106
|
+
* is held as the value at its rank among the fixed values the unit takes. */
|
|
107
|
+
export declare const DSIOT_VERTICAL_POSITION_VALUES: Partial<Record<VerticalPosition, number>>;
|
|
108
|
+
/** The value each `HorizontalPosition` is held as. `stop` and a fixed position
|
|
109
|
+
* have none: see UNSUPPORTED.md. */
|
|
110
|
+
export declare const DSIOT_HORIZONTAL_POSITION_VALUES: Partial<Record<HorizontalPosition, number>>;
|
|
111
|
+
/** What a humidity flag holds while the setting is off. */
|
|
112
|
+
export declare const DSIOT_HUMIDITY_OFF = "00";
|
|
113
|
+
/** What a humidity flag holds while the setting is a percentage, held in the
|
|
114
|
+
* mode's `value` leaf. */
|
|
115
|
+
export declare const DSIOT_HUMIDITY_PERCENTAGE = "01";
|
|
116
|
+
/** Also reads as off, and a control that switches humidity off leaves it. */
|
|
117
|
+
export declare const DSIOT_HUMIDITY_OFF_KEPT = "05";
|
|
118
|
+
export declare const DSIOT_HUMIDITY_SETTING_FLAGS: Record<Exclude<HumiditySetting, "off">, string>;
|
|
119
|
+
//# sourceMappingURL=tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,gBAAgB;aAC3B,GAAG,EAAE,CAAC;aACN,MAAM,EAAE,CAAC;aACT,MAAM,EAAE,CAAC;CACD,CAAC;AAEX,yEAAyE;AACzE,eAAO,MAAM,WAAW;aACtB,MAAM,EAAE,UAAU;aAClB,OAAO,EAAE,UAAU;CACX,CAAC;AAEX;uDACuD;AACvD,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;YAEY;AACZ,eAAO,MAAM,aAAa;aACxB,WAAW;aACX,eAAe;aACf,YAAY;aACZ,aAAa;CACL,CAAC;AAEX,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC;cACc;AACd,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAAiB,CAAC;AAEzE;;kEAEkE;AAClE,eAAO,MAAM,mBAAmB;aAC9B,IAAI,EAAE,YAAY;aAClB,UAAU,EAAE,WAAW;aACvB,eAAe,EAAE,WAAW;aAC5B,MAAM,EAAE,WAAW;aACnB,IAAI,EAAE,YAAY;aAClB,gBAAgB,EAAE,sBAAsB;aACxC,aAAa,EAAE,sBAAsB;aACrC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAEX;4CAC4C;AAC5C,eAAO,MAAM,WAAW;aACtB,KAAK,EAAE,+BAA+B;I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AQ1D,CAAC;AAEF;;kCAEkC;AAClC,eAAO,MAAM,mBAAmB;aAC9B,IAAI,EAAE,CAAC;aACP,KAAK,EAAE,EAAE;aACT,IAAI,EAAE,EAAE;aACR,WAAW,EAAE,EAAE;aACf,YAAY,EAAE,EAAE;CACR,CAAC;AAEX,oDAAoD;AACpD,eAAO,MAAM,yBAAyB,UAGrC,CAAC;AAEF,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAC1C,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C;6EAC6E;AAC7E,eAAO,MAAM,8BAA8B,EAAE,OAAO,CAClD,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAOjC,CAAC;AAEF;oCACoC;AACpC,eAAO,MAAM,gCAAgC,EAAE,OAAO,CACpD,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAInC,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC;0BAC0B;AAC1B,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAC/C,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,EAC/B,MAAM,CAMP,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// The resources, leaves and codes a DSIOT adapter holds each value of a model
|
|
2
|
+
// as. The codecs and the simulators both read them from here: see
|
|
3
|
+
// DESIGN.md#simulators.
|
|
4
|
+
export const DSIOT_OPERATIONS = {
|
|
5
|
+
get: 2,
|
|
6
|
+
update: 3,
|
|
7
|
+
delete: 4,
|
|
8
|
+
};
|
|
9
|
+
/** The indoor and the outdoor unit are separate edges on the adapter. */
|
|
10
|
+
export const DSIOT_EDGES = {
|
|
11
|
+
indoor: "adr_0100",
|
|
12
|
+
outdoor: "adr_0200",
|
|
13
|
+
};
|
|
14
|
+
/** What the `to` of a request starts with: an adapter resource follows as
|
|
15
|
+
* `.adp_i`, and a unit's as `/adr_0100.dgc_status`. */
|
|
16
|
+
export const DSIOT_EDGE_ROOT = "/dsiot/edge";
|
|
17
|
+
/** What a read fetches, as the `to` of a request: whole trees, never single
|
|
18
|
+
* leaves. The status trees come with `pt`, which `parseDsiotCapabilities`
|
|
19
|
+
* reads. */
|
|
20
|
+
export const DSIOT_TARGETS = {
|
|
21
|
+
adapterInfo: `${DSIOT_EDGE_ROOT}.adp_i?filter=pv`,
|
|
22
|
+
adapterSettings: `${DSIOT_EDGE_ROOT}.adp_d?filter=pv`,
|
|
23
|
+
indoorStatus: `${DSIOT_EDGE_ROOT}/${DSIOT_EDGES.indoor}.dgc_status?filter=pv,pt,md`,
|
|
24
|
+
outdoorStatus: `${DSIOT_EDGE_ROOT}/${DSIOT_EDGES.outdoor}.dgc_status?filter=pv,pt,md`,
|
|
25
|
+
};
|
|
26
|
+
/** `type` in a discovery reply from a DSIOT adapter. */
|
|
27
|
+
export const DSIOT_ADAPTER_TYPE = "GPF";
|
|
28
|
+
/** `cdev` in a discovery reply from a DSIOT adapter whose unit is an air
|
|
29
|
+
* cleaner. */
|
|
30
|
+
export const DSIOT_AIR_CLEANER_DEVICES = ["1D", "CJ"];
|
|
31
|
+
/** Dotted paths into the `adp_i` and `adp_d` trees. The MAC address and the
|
|
32
|
+
* version hold the value a classic adapter sends in `basic_info`, and the
|
|
33
|
+
* name is plain text, where a classic adapter form-encodes it. */
|
|
34
|
+
export const DSIOT_ADAPTER_PATHS = {
|
|
35
|
+
name: "adp_d.name",
|
|
36
|
+
macAddress: "adp_i.mac",
|
|
37
|
+
firmwareVersion: "adp_i.ver",
|
|
38
|
+
region: "adp_i.reg",
|
|
39
|
+
kind: "adp_i.kind",
|
|
40
|
+
energyMonitoring: "adp_i.func.en_ipower",
|
|
41
|
+
demandControl: "adp_i.func.en_demand",
|
|
42
|
+
scheduleTimer: "adp_i.func.en_scdltmr",
|
|
43
|
+
};
|
|
44
|
+
/** Full dotted paths into the `dgc_status` trees. `e_1002` lives on the indoor
|
|
45
|
+
* edge and `e_1003` on the outdoor edge. */
|
|
46
|
+
export const DSIOT_PATHS = {
|
|
47
|
+
power: "dgc_status.e_1002.e_A002.p_01",
|
|
48
|
+
/** Sent with every control. */
|
|
49
|
+
powerTransition: "dgc_status.e_1002.e_3003.p_2D",
|
|
50
|
+
mode: "dgc_status.e_1002.e_3001.p_01",
|
|
51
|
+
indoorTemperature: "dgc_status.e_1002.e_A00B.p_01",
|
|
52
|
+
indoorHumidity: "dgc_status.e_1002.e_A00B.p_02",
|
|
53
|
+
outdoorTemperature: "dgc_status.e_1003.e_A00D.p_01",
|
|
54
|
+
model: "dgc_status.e_1002.e_A001.p_0D",
|
|
55
|
+
modelType: "dgc_status.e_1002.e_A001.p_07",
|
|
56
|
+
energyMonitoring: "dgc_status.e_1002.e_A011.p_01",
|
|
57
|
+
};
|
|
58
|
+
/** What a leaf that is on or off holds, such as the power. */
|
|
59
|
+
export const DSIOT_ON = "01";
|
|
60
|
+
export const DSIOT_OFF = "00";
|
|
61
|
+
/** `DSIOT_PATHS.modelType` on a unit that only cools. */
|
|
62
|
+
export const DSIOT_COOLING_ONLY_MODEL_TYPE = "01";
|
|
63
|
+
/** Each leaf holds `01` while its mode is on. Powerful is on the outdoor
|
|
64
|
+
* edge. */
|
|
65
|
+
export const DSIOT_SPECIAL_MODE_PATHS = {
|
|
66
|
+
powerful: "dgc_status.e_1003.e_3002.p_44",
|
|
67
|
+
econo: "dgc_status.e_1002.e_3003.p_24",
|
|
68
|
+
streamer: "dgc_status.e_1002.e_3003.p_20",
|
|
69
|
+
};
|
|
70
|
+
export const DSIOT_MODE_NODE = "dgc_status.e_1002.e_3001";
|
|
71
|
+
export const DSIOT_MODE_PATHS = {
|
|
72
|
+
auto: {
|
|
73
|
+
setpoint: { path: `${DSIOT_MODE_NODE}.p_1D`, signed: true, writable: true },
|
|
74
|
+
humidity: {
|
|
75
|
+
value: `${DSIOT_MODE_NODE}.p_2E`,
|
|
76
|
+
flag: `${DSIOT_MODE_NODE}.p_2F`,
|
|
77
|
+
},
|
|
78
|
+
fanSpeed: `${DSIOT_MODE_NODE}.p_26`,
|
|
79
|
+
vertical: `${DSIOT_MODE_NODE}.p_20`,
|
|
80
|
+
horizontal: `${DSIOT_MODE_NODE}.p_21`,
|
|
81
|
+
},
|
|
82
|
+
dehumidify: {
|
|
83
|
+
setpoint: {
|
|
84
|
+
path: `${DSIOT_MODE_NODE}.p_1E`,
|
|
85
|
+
signed: true,
|
|
86
|
+
writable: false,
|
|
87
|
+
},
|
|
88
|
+
humidity: {
|
|
89
|
+
value: `${DSIOT_MODE_NODE}.p_30`,
|
|
90
|
+
flag: `${DSIOT_MODE_NODE}.p_31`,
|
|
91
|
+
},
|
|
92
|
+
fanSpeed: `${DSIOT_MODE_NODE}.p_27`,
|
|
93
|
+
vertical: `${DSIOT_MODE_NODE}.p_22`,
|
|
94
|
+
horizontal: `${DSIOT_MODE_NODE}.p_23`,
|
|
95
|
+
},
|
|
96
|
+
cool: {
|
|
97
|
+
setpoint: {
|
|
98
|
+
path: `${DSIOT_MODE_NODE}.p_02`,
|
|
99
|
+
signed: false,
|
|
100
|
+
writable: true,
|
|
101
|
+
},
|
|
102
|
+
humidity: {
|
|
103
|
+
value: `${DSIOT_MODE_NODE}.p_0B`,
|
|
104
|
+
flag: `${DSIOT_MODE_NODE}.p_0C`,
|
|
105
|
+
},
|
|
106
|
+
fanSpeed: `${DSIOT_MODE_NODE}.p_09`,
|
|
107
|
+
vertical: `${DSIOT_MODE_NODE}.p_05`,
|
|
108
|
+
horizontal: `${DSIOT_MODE_NODE}.p_06`,
|
|
109
|
+
},
|
|
110
|
+
heat: {
|
|
111
|
+
setpoint: {
|
|
112
|
+
path: `${DSIOT_MODE_NODE}.p_03`,
|
|
113
|
+
signed: false,
|
|
114
|
+
writable: true,
|
|
115
|
+
},
|
|
116
|
+
humidity: {
|
|
117
|
+
value: `${DSIOT_MODE_NODE}.p_2C`,
|
|
118
|
+
flag: `${DSIOT_MODE_NODE}.p_2D`,
|
|
119
|
+
},
|
|
120
|
+
fanSpeed: `${DSIOT_MODE_NODE}.p_0A`,
|
|
121
|
+
vertical: `${DSIOT_MODE_NODE}.p_07`,
|
|
122
|
+
horizontal: `${DSIOT_MODE_NODE}.p_08`,
|
|
123
|
+
},
|
|
124
|
+
fan: {
|
|
125
|
+
fanSpeed: `${DSIOT_MODE_NODE}.p_28`,
|
|
126
|
+
vertical: `${DSIOT_MODE_NODE}.p_24`,
|
|
127
|
+
horizontal: `${DSIOT_MODE_NODE}.p_25`,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
export const DSIOT_OPERATING_MODE_CODES = {
|
|
131
|
+
fan: "0000",
|
|
132
|
+
heat: "0100",
|
|
133
|
+
cool: "0200",
|
|
134
|
+
auto: "0300",
|
|
135
|
+
dehumidify: "0500",
|
|
136
|
+
};
|
|
137
|
+
export const DSIOT_FAN_SPEED_CODES = {
|
|
138
|
+
auto: "0A00",
|
|
139
|
+
silent: "0B00",
|
|
140
|
+
level1: "0300",
|
|
141
|
+
level2: "0400",
|
|
142
|
+
level3: "0500",
|
|
143
|
+
level4: "0600",
|
|
144
|
+
level5: "0700",
|
|
145
|
+
};
|
|
146
|
+
/** The values a louver leaf holds besides a fixed position, which is 1-14.
|
|
147
|
+
* The leaf is three bytes, little-endian, and bit n of its `md.mx` is set
|
|
148
|
+
* when the unit takes value n. */
|
|
149
|
+
export const DSIOT_LOUVER_VALUES = {
|
|
150
|
+
stop: 0,
|
|
151
|
+
swing: 15,
|
|
152
|
+
auto: 16,
|
|
153
|
+
naturalWind: 19,
|
|
154
|
+
floorWarming: 25,
|
|
155
|
+
};
|
|
156
|
+
/** The values that are fixed positions: 1 to 14. */
|
|
157
|
+
export const DSIOT_FIXED_LOUVER_VALUES = Array.from({ length: 14 }, (_, index) => index + 1);
|
|
158
|
+
export const DSIOT_LOUVER_STOP = "000000";
|
|
159
|
+
export const DSIOT_LOUVER_SWING = "0F0000";
|
|
160
|
+
/** The value each `VerticalPosition` is held as. A fixed position has none: it
|
|
161
|
+
* is held as the value at its rank among the fixed values the unit takes. */
|
|
162
|
+
export const DSIOT_VERTICAL_POSITION_VALUES = {
|
|
163
|
+
stop: DSIOT_LOUVER_VALUES.stop,
|
|
164
|
+
swing: DSIOT_LOUVER_VALUES.swing,
|
|
165
|
+
naturalWind: DSIOT_LOUVER_VALUES.naturalWind,
|
|
166
|
+
auto: DSIOT_LOUVER_VALUES.auto,
|
|
167
|
+
floorWarming: DSIOT_LOUVER_VALUES.floorWarming,
|
|
168
|
+
};
|
|
169
|
+
/** The value each `HorizontalPosition` is held as. `stop` and a fixed position
|
|
170
|
+
* have none: see UNSUPPORTED.md. */
|
|
171
|
+
export const DSIOT_HORIZONTAL_POSITION_VALUES = {
|
|
172
|
+
swing: DSIOT_LOUVER_VALUES.swing,
|
|
173
|
+
auto: DSIOT_LOUVER_VALUES.auto,
|
|
174
|
+
};
|
|
175
|
+
/** What a humidity flag holds while the setting is off. */
|
|
176
|
+
export const DSIOT_HUMIDITY_OFF = "00";
|
|
177
|
+
/** What a humidity flag holds while the setting is a percentage, held in the
|
|
178
|
+
* mode's `value` leaf. */
|
|
179
|
+
export const DSIOT_HUMIDITY_PERCENTAGE = "01";
|
|
180
|
+
/** Also reads as off, and a control that switches humidity off leaves it. */
|
|
181
|
+
export const DSIOT_HUMIDITY_OFF_KEPT = "05";
|
|
182
|
+
export const DSIOT_HUMIDITY_SETTING_FLAGS = {
|
|
183
|
+
auto: "02",
|
|
184
|
+
autoHigh: "03",
|
|
185
|
+
autoLow: "04",
|
|
186
|
+
continuous: "06",
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/tables.ts"],"names":[],"mappings":"AASA,8EAA8E;AAC9E,kEAAkE;AAClE,wBAAwB;AAEx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Defaults to 3000. */
|
|
4
4
|
timeoutInMs?: number;
|
|
5
5
|
}
|
|
6
|
-
/** Finds the adapters on the LAN: broadcasts
|
|
7
|
-
* UDP port 30050 and collects the
|
|
8
|
-
* `key=value` payload as the HTTP
|
|
9
|
-
* adapters both answer, and
|
|
10
|
-
*
|
|
11
|
-
* datagram whose `ret` is not
|
|
6
|
+
/** Finds the air conditioners' adapters on the LAN: broadcasts
|
|
7
|
+
* `DAIKIN_UDP/common/basic_info` to UDP port 30050 and collects the
|
|
8
|
+
* `basic_info` replies, which carry the same `key=value` payload as the HTTP
|
|
9
|
+
* `/common/basic_info`. Classic and DSIOT adapters both answer, and
|
|
10
|
+
* `parseDevice` picks the protocol from the reply. Anything on the LAN can
|
|
11
|
+
* send to the port it listens on, so it ignores a datagram whose `ret` is not
|
|
12
|
+
* `OK`. The adapter of another appliance answers the probe as well, such as an
|
|
13
|
+
* air cleaner's, so it ignores a reply `isAirConditioner` does not pass.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* An Airbase adapter replies as a classic adapter does, so it sends each
|
|
16
|
+
* adapter that replies as one an HTTP request, or two, to tell which it is:
|
|
17
|
+
* an Airbase adapter answers HTTP 404 at `/common/basic_info` and `ret=OK`
|
|
18
|
+
* at `/skyfi/common/basic_info`. An adapter that does not answer in 3000 ms
|
|
19
|
+
* is reported as classic. An Airbase adapter takes no registration and no
|
|
20
|
+
* local password, so its device requires neither, whatever its reply says.
|
|
21
|
+
*
|
|
22
|
+
* It resolves once `timeoutInMs` has passed and each of those requests has
|
|
23
|
+
* finished, never earlier, with one device for each `host` that replied: the
|
|
24
|
+
* address a reply came from, with the port the reply announces. It binds the
|
|
25
|
+
* first free UDP port from 30000 to 30050, and rejects with the socket's
|
|
26
|
+
* error when none is free or the socket fails. */
|
|
16
27
|
export declare function discoverDevices(options?: DiscoverDevicesOptions): Promise<DaikinDevice[]>;
|
|
17
28
|
//# sourceMappingURL=discovery.d.ts.map
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAsBvD,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;kDAoBkD;AAClD,wBAAsB,eAAe,CACnC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,YAAY,EAAE,CAAC,CAgDzB"}
|
package/dist/discovery.js
CHANGED
|
@@ -1,36 +1,65 @@
|
|
|
1
1
|
import { createSocket } from "node:dgram";
|
|
2
|
+
import { once } from "node:events";
|
|
3
|
+
import { isAirbaseAdapter } from "./clients/airbase.js";
|
|
2
4
|
import { isClassicOk, parseClassicKeyValue, } from "./codecs/classic/keyValue.js";
|
|
3
|
-
import { parseDevice } from "./codecs/device.js";
|
|
5
|
+
import { isAirConditioner, parseDevice } from "./codecs/device.js";
|
|
6
|
+
import { DaikinTransport } from "./transport.js";
|
|
4
7
|
// The UDP discovery probe: broadcast this to :30050, listen for `basic_info`
|
|
5
8
|
// replies.
|
|
6
9
|
const DISCOVERY_PROBE = "DAIKIN_UDP/common/basic_info";
|
|
7
|
-
const DISCOVERY_SEND_PORT = 30000;
|
|
8
10
|
const DISCOVERY_LISTEN_PORT = 30050;
|
|
11
|
+
// An adapter answers the port a probe came from. The probe leaves from the
|
|
12
|
+
// first of these ports that is free: see DESIGN.md#discovery.
|
|
13
|
+
const FIRST_DISCOVERY_SEND_PORT = 30000;
|
|
14
|
+
const LAST_DISCOVERY_SEND_PORT = 30050;
|
|
9
15
|
const DEFAULT_DISCOVERY_TIMEOUT_IN_MS = 3_000;
|
|
10
16
|
const BROADCAST_ADDRESS = "255.255.255.255";
|
|
11
17
|
// UDP drops packets, so the probe goes out 10 times, 200 ms apart.
|
|
12
18
|
const PROBE_COUNT = 10;
|
|
13
19
|
const PROBE_INTERVAL_IN_MS = 200;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
+
// How long each of the HTTP requests that tell an Airbase adapter from a
|
|
21
|
+
// classic one may take. An adapter that takes longer is reported as classic,
|
|
22
|
+
// so this only bounds how long after `timeoutInMs` a discovery resolves.
|
|
23
|
+
const IDENTIFY_TIMEOUT_IN_MS = 3_000;
|
|
24
|
+
/** Finds the air conditioners' adapters on the LAN: broadcasts
|
|
25
|
+
* `DAIKIN_UDP/common/basic_info` to UDP port 30050 and collects the
|
|
26
|
+
* `basic_info` replies, which carry the same `key=value` payload as the HTTP
|
|
27
|
+
* `/common/basic_info`. Classic and DSIOT adapters both answer, and
|
|
28
|
+
* `parseDevice` picks the protocol from the reply. Anything on the LAN can
|
|
29
|
+
* send to the port it listens on, so it ignores a datagram whose `ret` is not
|
|
30
|
+
* `OK`. The adapter of another appliance answers the probe as well, such as an
|
|
31
|
+
* air cleaner's, so it ignores a reply `isAirConditioner` does not pass.
|
|
20
32
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
33
|
+
* An Airbase adapter replies as a classic adapter does, so it sends each
|
|
34
|
+
* adapter that replies as one an HTTP request, or two, to tell which it is:
|
|
35
|
+
* an Airbase adapter answers HTTP 404 at `/common/basic_info` and `ret=OK`
|
|
36
|
+
* at `/skyfi/common/basic_info`. An adapter that does not answer in 3000 ms
|
|
37
|
+
* is reported as classic. An Airbase adapter takes no registration and no
|
|
38
|
+
* local password, so its device requires neither, whatever its reply says.
|
|
39
|
+
*
|
|
40
|
+
* It resolves once `timeoutInMs` has passed and each of those requests has
|
|
41
|
+
* finished, never earlier, with one device for each `host` that replied: the
|
|
42
|
+
* address a reply came from, with the port the reply announces. It binds the
|
|
43
|
+
* first free UDP port from 30000 to 30050, and rejects with the socket's
|
|
44
|
+
* error when none is free or the socket fails. */
|
|
24
45
|
export async function discoverDevices(options = {}) {
|
|
25
|
-
const socket =
|
|
46
|
+
const socket = await bindFirstFreePort();
|
|
26
47
|
const devices = new Map();
|
|
27
48
|
return new Promise((resolve, reject) => {
|
|
28
49
|
let probesSent = 0;
|
|
29
|
-
|
|
50
|
+
const probe = Buffer.from(DISCOVERY_PROBE, "utf8");
|
|
51
|
+
const sendProbe = () => {
|
|
52
|
+
socket.send(probe, DISCOVERY_LISTEN_PORT, BROADCAST_ADDRESS);
|
|
53
|
+
probesSent += 1;
|
|
54
|
+
if (probesSent >= PROBE_COUNT) {
|
|
55
|
+
clearInterval(probeTimer);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const probeTimer = setInterval(sendProbe, PROBE_INTERVAL_IN_MS);
|
|
30
59
|
const listenTimer = setTimeout(() => {
|
|
31
60
|
clearInterval(probeTimer);
|
|
32
61
|
socket.close();
|
|
33
|
-
resolve(
|
|
62
|
+
resolve(Promise.all(devices.values()));
|
|
34
63
|
}, options.timeoutInMs ?? DEFAULT_DISCOVERY_TIMEOUT_IN_MS);
|
|
35
64
|
socket.on("error", (error) => {
|
|
36
65
|
clearInterval(probeTimer);
|
|
@@ -40,28 +69,69 @@ export async function discoverDevices(options = {}) {
|
|
|
40
69
|
reject(error);
|
|
41
70
|
});
|
|
42
71
|
socket.on("message", (message, remote) => {
|
|
43
|
-
if (devices.has(remote.address)) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
72
|
const fields = parseClassicKeyValue(message.toString("utf8"));
|
|
47
|
-
if (!isClassicOk(fields)) {
|
|
73
|
+
if (!isClassicOk(fields) || !isAirConditioner(fields)) {
|
|
48
74
|
return;
|
|
49
75
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
probesSent += 1;
|
|
58
|
-
if (probesSent >= PROBE_COUNT) {
|
|
59
|
-
clearInterval(probeTimer);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
sendProbe();
|
|
63
|
-
probeTimer = setInterval(sendProbe, PROBE_INTERVAL_IN_MS);
|
|
76
|
+
// An adapter answers each of the probes, so the first reply from a
|
|
77
|
+
// host is kept. Adapters at one address, as simulators on one machine
|
|
78
|
+
// are, differ by the port they announce.
|
|
79
|
+
const device = parseDevice(remote.address, fields);
|
|
80
|
+
if (!devices.has(device.host)) {
|
|
81
|
+
devices.set(device.host, identifyProtocol(device));
|
|
82
|
+
}
|
|
64
83
|
});
|
|
84
|
+
socket.setBroadcast(true);
|
|
85
|
+
sendProbe();
|
|
65
86
|
});
|
|
66
87
|
}
|
|
88
|
+
// A reply does not say whether a classic adapter is an Airbase adapter, so
|
|
89
|
+
// the adapter is asked over HTTP.
|
|
90
|
+
async function identifyProtocol(device) {
|
|
91
|
+
if (device.protocol !== "classic") {
|
|
92
|
+
return device;
|
|
93
|
+
}
|
|
94
|
+
const transport = new DaikinTransport({
|
|
95
|
+
host: device.host,
|
|
96
|
+
usesHttps: device.usesHttps,
|
|
97
|
+
timeoutInMs: IDENTIFY_TIMEOUT_IN_MS,
|
|
98
|
+
});
|
|
99
|
+
try {
|
|
100
|
+
// `parseDevice` read the reply as a classic adapter's, which may require
|
|
101
|
+
// registration or a local password. An Airbase adapter takes neither.
|
|
102
|
+
// `usesHttps` stays: the adapter has just answered over that scheme.
|
|
103
|
+
return (await isAirbaseAdapter(transport))
|
|
104
|
+
? {
|
|
105
|
+
...device,
|
|
106
|
+
protocol: "airbase",
|
|
107
|
+
requiresRegistration: false,
|
|
108
|
+
requiresLocalPassword: false,
|
|
109
|
+
}
|
|
110
|
+
: device;
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
await transport.close();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Binds without `reuseAddr`: with it, a second socket binds a port that is
|
|
117
|
+
// held, and each reply then reaches one of the two alone.
|
|
118
|
+
async function bindFirstFreePort() {
|
|
119
|
+
for (let port = FIRST_DISCOVERY_SEND_PORT;; port += 1) {
|
|
120
|
+
const socket = createSocket("udp4");
|
|
121
|
+
try {
|
|
122
|
+
socket.bind(port);
|
|
123
|
+
// `once` rejects when the socket emits `error` first, as it does for a
|
|
124
|
+
// port that is held.
|
|
125
|
+
await once(socket, "listening");
|
|
126
|
+
return socket;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
socket.close();
|
|
130
|
+
if (error.code !== "EADDRINUSE" ||
|
|
131
|
+
port === LAST_DISCOVERY_SEND_PORT) {
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
67
137
|
//# sourceMappingURL=discovery.js.map
|
package/dist/discovery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,WAAW,EACX,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,6EAA6E;AAC7E,WAAW;AACX,MAAM,eAAe,GAAG,8BAA8B,CAAC;AACvD,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,2EAA2E;AAC3E,8DAA8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G,IAAI,eAAe,CAAC;QACpC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,sBAAsB;KACpC,CAAC,CAAC;IACH,IAAI,CAAC;QACH,yEAAyE;QACzE,sEAAsE;QACtE,qEAAqE;QACrE,OAAO,CAAC,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACxC,CAAC,CAAC;gBACE,GAAG,MAAM;gBACT,QAAQ,EAAE,SAAS;gBACnB,oBAAoB,EAAE,KAAK;gBAC3B,qBAAqB,EAAE,KAAK;aAC7B;YACH,CAAC,CAAC,MAAM,CAAC;IACb,CAAC;YAAS,CAAC;QACT,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,0DAA0D;AAC1D,KAAK,UAAU,iBAAiB;IAC9B,KAAK,IAAI,IAAI,GAAG,yBAAyB,GAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,uEAAuE;YACvE,qBAAqB;YACrB,MAAM,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAChC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,IACG,KAA+B,CAAC,IAAI,KAAK,YAAY;gBACtD,IAAI,KAAK,wBAAwB,EACjC,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/factory.d.ts
CHANGED
|
@@ -2,10 +2,13 @@ import type { DaikinClient } from "./clients/client.js";
|
|
|
2
2
|
import type { DaikinDevice } from "./models/device.js";
|
|
3
3
|
import { type DaikinRetryOptions, type DaikinTlsOptions } from "./transport.js";
|
|
4
4
|
export interface CreateDaikinClientOptions {
|
|
5
|
-
/** The terminal uuid, sent as `X-Daikin-uuid
|
|
6
|
-
*
|
|
5
|
+
/** The terminal uuid, sent as `X-Daikin-uuid`: 32 lowercase hexadecimal
|
|
6
|
+
* digits, a UUID without its dashes. Generate one and reuse it: an adapter
|
|
7
|
+
* that requires registration remembers it. An Airbase adapter takes none,
|
|
8
|
+
* so it is neither checked nor sent to one. */
|
|
7
9
|
terminalUuid: string;
|
|
8
|
-
/** The child lock code, for a device whose `requiresLocalPassword` is true.
|
|
10
|
+
/** The child lock code, for a device whose `requiresLocalPassword` is true.
|
|
11
|
+
* It is not sent to an Airbase adapter, which takes none. */
|
|
9
12
|
localPassword?: string;
|
|
10
13
|
/** How long, in milliseconds, a request waits for the adapter. Defaults to
|
|
11
14
|
* 10000: see `DaikinTransportOptions.timeoutInMs`. */
|
|
@@ -25,9 +28,12 @@ export interface CreateDaikinClientOptions {
|
|
|
25
28
|
tls?: DaikinTlsOptions;
|
|
26
29
|
}
|
|
27
30
|
/** Builds the client for a device: a `DsiotDaikinClient` when
|
|
28
|
-
* `device.protocol` is `dsiot`,
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
31
|
+
* `device.protocol` is `dsiot`, an `AirbaseDaikinClient` when it is
|
|
32
|
+
* `airbase`, and a `ClassicDaikinClient` otherwise. The client sends over
|
|
33
|
+
* HTTPS when `device.usesHttps` is set, and sends the local password when
|
|
34
|
+
* `options.localPassword` is given. It throws an `Error` when
|
|
35
|
+
* `options.terminalUuid` is not in the form
|
|
36
|
+
* `CreateDaikinClientOptions.terminalUuid` describes. Call `close` on the
|
|
37
|
+
* client when done with the unit. */
|
|
32
38
|
export declare function createDaikinClient(device: DaikinDevice, options: CreateDaikinClientOptions): DaikinClient;
|
|
33
39
|
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAEtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,yBAAyB;IACxC;;;mDAG+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB;iEAC6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;0DACsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;0CAEsC;IACtC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B;;;;;4CAKwC;IACxC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,kFAAkF;IAClF,GAAG,CAAC,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;;;;qCAOqC;AACrC,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,yBAAyB,GACjC,YAAY,CAiCd"}
|
package/dist/factory.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { ClassicLocalPasswordAuthentication, DsiotLocalPasswordAuthentication, } from "./authentication.js";
|
|
2
|
+
import { AirbaseDaikinClient } from "./clients/airbase.js";
|
|
2
3
|
import { ClassicDaikinClient } from "./clients/classic.js";
|
|
3
4
|
import { DsiotDaikinClient } from "./clients/dsiot.js";
|
|
4
5
|
import { DaikinTransport, } from "./transport.js";
|
|
5
6
|
/** Builds the client for a device: a `DsiotDaikinClient` when
|
|
6
|
-
* `device.protocol` is `dsiot`,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `device.protocol` is `dsiot`, an `AirbaseDaikinClient` when it is
|
|
8
|
+
* `airbase`, and a `ClassicDaikinClient` otherwise. The client sends over
|
|
9
|
+
* HTTPS when `device.usesHttps` is set, and sends the local password when
|
|
10
|
+
* `options.localPassword` is given. It throws an `Error` when
|
|
11
|
+
* `options.terminalUuid` is not in the form
|
|
12
|
+
* `CreateDaikinClientOptions.terminalUuid` describes. Call `close` on the
|
|
13
|
+
* client when done with the unit. */
|
|
10
14
|
export function createDaikinClient(device, options) {
|
|
15
|
+
if (device.protocol === "airbase") {
|
|
16
|
+
return new AirbaseDaikinClient(new DaikinTransport({
|
|
17
|
+
host: device.host,
|
|
18
|
+
usesHttps: device.usesHttps,
|
|
19
|
+
timeoutInMs: options.timeoutInMs,
|
|
20
|
+
tls: options.tls,
|
|
21
|
+
}), options.retry, options.maxStateAgeForSetStateInMs);
|
|
22
|
+
}
|
|
11
23
|
const transport = new DaikinTransport({
|
|
12
24
|
host: device.host,
|
|
13
25
|
usesHttps: device.usesHttps,
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAElC,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAGL,eAAe,GAChB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAElC,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAA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