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
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { FAN_SPEEDS, FIXED_LOUVER_POSITIONS, HORIZONTAL_POSITIONS, HUMIDITY_SETTINGS, OPERATING_MODES, SPECIAL_MODES, SWING_MODES, VERTICAL_POSITIONS, } from "../../models/state.js";
|
|
2
|
-
import {
|
|
2
|
+
import { decodeDsiotLittleEndian } from "./state.js";
|
|
3
|
+
import { DSIOT_ADAPTER_PATHS, DSIOT_COOLING_ONLY_MODEL_TYPE, DSIOT_HORIZONTAL_POSITION_VALUES, DSIOT_MODE_PATHS, DSIOT_PATHS, DSIOT_SPECIAL_MODE_PATHS, DSIOT_VERTICAL_POSITION_VALUES, } from "./tables.js";
|
|
3
4
|
const MODE_PATHS = Object.values(DSIOT_MODE_PATHS);
|
|
4
|
-
const ADAPTER_PATHS = {
|
|
5
|
-
region: "adp_i.reg",
|
|
6
|
-
kind: "adp_i.kind",
|
|
7
|
-
energyMonitoring: "adp_i.func.en_ipower",
|
|
8
|
-
demandControl: "adp_i.func.en_demand",
|
|
9
|
-
scheduleTimer: "adp_i.func.en_scdltmr",
|
|
10
|
-
};
|
|
11
5
|
// The `pt` of a special mode's leaf on a unit that takes the mode.
|
|
12
6
|
const SPECIAL_MODE_OFFERED_TYPE = "2";
|
|
13
|
-
const COOLING_ONLY_MODEL_TYPE = "01";
|
|
14
7
|
const COOLING_ONLY_MODES = [
|
|
15
8
|
"dehumidify",
|
|
16
9
|
"cool",
|
|
@@ -24,7 +17,7 @@ const FIXED_POSITIONS = FIXED_LOUVER_POSITIONS;
|
|
|
24
17
|
* degrees. Without the outdoor tree, `specialModes` lists no `powerful`. It
|
|
25
18
|
* lists econo in every mode but fan: see UNSUPPORTED.md. */
|
|
26
19
|
export function parseDsiotCapabilities(values) {
|
|
27
|
-
const modes = values[DSIOT_PATHS.modelType] ===
|
|
20
|
+
const modes = values[DSIOT_PATHS.modelType] === DSIOT_COOLING_ONLY_MODEL_TYPE
|
|
28
21
|
? [...COOLING_ONLY_MODES]
|
|
29
22
|
: [...OPERATING_MODES];
|
|
30
23
|
const offered = (mode, range) => modes.includes(mode) ? range : null;
|
|
@@ -42,7 +35,7 @@ export function parseDsiotCapabilities(values) {
|
|
|
42
35
|
: [];
|
|
43
36
|
const vertical = hasLouver(values, "vertical");
|
|
44
37
|
const horizontal = hasLouver(values, "horizontal");
|
|
45
|
-
const energyMonitoring = values[
|
|
38
|
+
const energyMonitoring = values[DSIOT_ADAPTER_PATHS.energyMonitoring] === "1" &&
|
|
46
39
|
values[DSIOT_PATHS.energyMonitoring] === "01";
|
|
47
40
|
return {
|
|
48
41
|
modes,
|
|
@@ -81,9 +74,9 @@ export function parseDsiotCapabilities(values) {
|
|
|
81
74
|
specialOutlet: false,
|
|
82
75
|
energyMonitoring,
|
|
83
76
|
demandControl: energyMonitoring &&
|
|
84
|
-
values[
|
|
85
|
-
values[
|
|
86
|
-
scheduleTimer: ["1", "2"].includes(values[
|
|
77
|
+
values[DSIOT_ADAPTER_PATHS.kind] === "4" &&
|
|
78
|
+
values[DSIOT_ADAPTER_PATHS.demandControl] === "1",
|
|
79
|
+
scheduleTimer: ["1", "2"].includes(values[DSIOT_ADAPTER_PATHS.scheduleTimer] ?? ""),
|
|
87
80
|
model: values[DSIOT_PATHS.model],
|
|
88
81
|
};
|
|
89
82
|
}
|
|
@@ -99,7 +92,7 @@ function takes(mask, value) {
|
|
|
99
92
|
}
|
|
100
93
|
// Japanese units (`jp`) follow other rules: see UNSUPPORTED.md.
|
|
101
94
|
function fanSpeeds(values) {
|
|
102
|
-
const region = values[
|
|
95
|
+
const region = values[DSIOT_ADAPTER_PATHS.region];
|
|
103
96
|
if (!region || region === "jp") {
|
|
104
97
|
return [];
|
|
105
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/capabilities.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EAEV,sBAAsB,EACtB,oBAAoB,EAEpB,iBAAiB,EACjB,eAAe,EAEf,aAAa,EACb,WAAW,EAEX,kBAAkB,GAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gCAAgC,EAChC,gBAAgB,EAChB,WAAW,EACX,wBAAwB,EACxB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/capabilities.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EAEV,sBAAsB,EACtB,oBAAoB,EAEpB,iBAAiB,EACjB,eAAe,EAEf,aAAa,EACb,WAAW,EAEX,kBAAkB,GAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,gCAAgC,EAChC,gBAAgB,EAChB,WAAW,EACX,wBAAwB,EACxB,8BAA8B,GAE/B,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,gBAA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AAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9D,OAAO;QACL,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW;QACjC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;QAChD,IAAI,EAAE,GAAG;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D;;;8BAG8B;AAC9B,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,gBAAgB,CAQlB"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { decodeFirmwareVersion, decodeMacAddress } from "../device.js";
|
|
2
|
-
|
|
3
|
-
name: "adp_d.name",
|
|
4
|
-
macAddress: "adp_i.mac",
|
|
5
|
-
firmwareVersion: "adp_i.ver",
|
|
6
|
-
};
|
|
2
|
+
import { DSIOT_ADAPTER_PATHS } from "./tables.js";
|
|
7
3
|
/** Reads what the flattened `adp_i` and `adp_d` trees say to identify the
|
|
8
4
|
* adapter. Both `adp_i` leaves hold the value a classic adapter sends in
|
|
9
5
|
* `basic_info`. `adp_d.name` holds the name as plain text, where a classic
|
|
10
6
|
* adapter form-encodes it. */
|
|
11
7
|
export function parseDsiotDeviceInfo(values) {
|
|
12
8
|
return {
|
|
13
|
-
name: values[
|
|
14
|
-
macAddress: decodeMacAddress(values[
|
|
15
|
-
firmwareVersion: decodeFirmwareVersion(values[
|
|
9
|
+
name: values[DSIOT_ADAPTER_PATHS.name],
|
|
10
|
+
macAddress: decodeMacAddress(values[DSIOT_ADAPTER_PATHS.macAddress]),
|
|
11
|
+
firmwareVersion: decodeFirmwareVersion(values[DSIOT_ADAPTER_PATHS.firmwareVersion]),
|
|
16
12
|
};
|
|
17
13
|
}
|
|
18
14
|
//# sourceMappingURL=device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/device.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/device.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;;8BAG8B;AAC9B,MAAM,UAAU,oBAAoB,CAClC,MAA8B;IAE9B,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC;QACtC,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACpE,eAAe,EAAE,qBAAqB,CACpC,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAC5C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
export declare const DSIOT_OPERATIONS: {
|
|
2
|
-
readonly get: 2;
|
|
3
|
-
readonly update: 3;
|
|
4
|
-
readonly delete: 4;
|
|
5
|
-
};
|
|
6
|
-
/** The indoor and the outdoor unit are separate edges on the adapter. */
|
|
7
|
-
export declare const DSIOT_EDGES: {
|
|
8
|
-
readonly indoor: "adr_0100";
|
|
9
|
-
readonly outdoor: "adr_0200";
|
|
10
|
-
};
|
|
11
|
-
/** What a read fetches, as the `to` of a request: whole trees, never single
|
|
12
|
-
* leaves. The status trees come with `pt`, which `parseDsiotCapabilities`
|
|
13
|
-
* reads. */
|
|
14
|
-
export declare const DSIOT_TARGETS: {
|
|
15
|
-
readonly adapterInfo: "/dsiot/edge.adp_i?filter=pv";
|
|
16
|
-
readonly adapterSettings: "/dsiot/edge.adp_d?filter=pv";
|
|
17
|
-
readonly indoorStatus: "/dsiot/edge/adr_0100.dgc_status?filter=pv,pt,md";
|
|
18
|
-
readonly outdoorStatus: "/dsiot/edge/adr_0200.dgc_status?filter=pv,pt,md";
|
|
19
|
-
};
|
|
20
1
|
/** One leaf to write: `path` is dotted from its resource, such as
|
|
21
2
|
* `dgc_status.e_1002.e_A002.p_01`, and `value` is the leaf's hex string. */
|
|
22
3
|
export interface DsiotUpdate {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multireq.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/multireq.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multireq.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/multireq.ts"],"names":[],"mappings":"AAqBA;4EAC4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAIxE;AAED;;8BAE8B;AAC9B,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,WAAW,EAAE,EACtB,IAAI,GAAE,MAA2B,GAChC,MAAM,CAqBR;AAWD;;;;;;;uDAOuD;AACvD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoB5E"}
|
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
import { DaikinError } from "../../error.js";
|
|
2
|
-
|
|
3
|
-
// carrying operations on property trees. A request addresses a resource (`to`);
|
|
4
|
-
// a tree node has pn (name) / pt (type) / pch (children) / pv (value) / md
|
|
5
|
-
// (metadata: mi min, mx max, st step).
|
|
6
|
-
export const DSIOT_OPERATIONS = {
|
|
7
|
-
get: 2,
|
|
8
|
-
update: 3,
|
|
9
|
-
delete: 4,
|
|
10
|
-
};
|
|
11
|
-
/** The indoor and the outdoor unit are separate edges on the adapter. */
|
|
12
|
-
export const DSIOT_EDGES = {
|
|
13
|
-
indoor: "adr_0100",
|
|
14
|
-
outdoor: "adr_0200",
|
|
15
|
-
};
|
|
16
|
-
const 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: `${EDGE_ROOT}.adp_i?filter=pv`,
|
|
22
|
-
adapterSettings: `${EDGE_ROOT}.adp_d?filter=pv`,
|
|
23
|
-
indoorStatus: `${EDGE_ROOT}/${DSIOT_EDGES.indoor}.dgc_status?filter=pv,pt,md`,
|
|
24
|
-
outdoorStatus: `${EDGE_ROOT}/${DSIOT_EDGES.outdoor}.dgc_status?filter=pv,pt,md`,
|
|
25
|
-
};
|
|
2
|
+
import { DSIOT_EDGE_ROOT, DSIOT_EDGES, DSIOT_OPERATIONS } from "./tables.js";
|
|
26
3
|
export function buildDsiotMultireqGet(targets) {
|
|
27
4
|
return {
|
|
28
5
|
requests: targets.map((to) => ({ op: DSIOT_OPERATIONS.get, to })),
|
|
@@ -48,7 +25,7 @@ export function buildDsiotMultireqUpdate(updates, edge = DSIOT_EDGES.indoor) {
|
|
|
48
25
|
return {
|
|
49
26
|
requests: roots.map((pc) => ({
|
|
50
27
|
op: DSIOT_OPERATIONS.update,
|
|
51
|
-
to: `${
|
|
28
|
+
to: `${DSIOT_EDGE_ROOT}/${edge}.${pc.pn}`,
|
|
52
29
|
pc,
|
|
53
30
|
})),
|
|
54
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multireq.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/multireq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"multireq.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/multireq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2B7E,MAAM,UAAU,qBAAqB,CAAC,OAA0B;IAC9D,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,gBAAgB,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;KAClE,CAAC;AACJ,CAAC;AAED;;8BAE8B;AAC9B,MAAM,UAAU,wBAAwB,CACtC,OAAsB,EACtB,IAAI,GAAW,WAAW,CAAC,MAAM;IAEjC,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC;QACtC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,GAAG,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,IAAI,GAAG,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACvC,KAAK,MAAM,IAAI,IAAI,IAA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ACD,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAChD,MAAM,CAAC,GAAG,IAAI,OAAO,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,47 +1,9 @@
|
|
|
1
|
-
import { type DaikinControl, type DaikinSensors, type DaikinState, type FanSpeed, type
|
|
2
|
-
import type
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** Sent with every control. */
|
|
8
|
-
readonly powerTransition: "dgc_status.e_1002.e_3003.p_2D";
|
|
9
|
-
readonly mode: "dgc_status.e_1002.e_3001.p_01";
|
|
10
|
-
readonly indoorTemperature: "dgc_status.e_1002.e_A00B.p_01";
|
|
11
|
-
readonly indoorHumidity: "dgc_status.e_1002.e_A00B.p_02";
|
|
12
|
-
readonly outdoorTemperature: "dgc_status.e_1003.e_A00D.p_01";
|
|
13
|
-
readonly model: "dgc_status.e_1002.e_A001.p_0D";
|
|
14
|
-
readonly modelType: "dgc_status.e_1002.e_A001.p_07";
|
|
15
|
-
readonly energyMonitoring: "dgc_status.e_1002.e_A011.p_01";
|
|
16
|
-
};
|
|
17
|
-
/** Each leaf holds `01` while its mode is on. Powerful is on the outdoor
|
|
18
|
-
* edge. */
|
|
19
|
-
export declare const DSIOT_SPECIAL_MODE_PATHS: Record<SpecialMode, string>;
|
|
20
|
-
export interface DsiotSetpoint {
|
|
21
|
-
path: string;
|
|
22
|
-
/** Auto and dehumidify are a signed byte; cool and heat are little-endian. */
|
|
23
|
-
signed: boolean;
|
|
24
|
-
/** The dehumidify setpoint is read-only. */
|
|
25
|
-
writable: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface DsiotHumidity {
|
|
28
|
-
/** Counted in steps of the leaf's `md.st`. */
|
|
29
|
-
value: string;
|
|
30
|
-
/** The setting: `00` or `05` off, `01` the percentage in `value`, and one
|
|
31
|
-
* value for each `HumiditySetting`. */
|
|
32
|
-
flag: string;
|
|
33
|
-
}
|
|
34
|
-
export interface DsiotModePaths {
|
|
35
|
-
/** Absent in fan mode. */
|
|
36
|
-
setpoint?: DsiotSetpoint;
|
|
37
|
-
/** Absent in fan mode. */
|
|
38
|
-
humidity?: DsiotHumidity;
|
|
39
|
-
fanSpeed: string;
|
|
40
|
-
vertical: string;
|
|
41
|
-
horizontal: string;
|
|
42
|
-
}
|
|
43
|
-
export declare const DSIOT_MODE_NODE = "dgc_status.e_1002.e_3001";
|
|
44
|
-
export declare const DSIOT_MODE_PATHS: Record<OperatingMode, DsiotModePaths>;
|
|
1
|
+
import { type DaikinControl, type DaikinSensors, type DaikinState, type FanSpeed, type OperatingMode, type SpecialMode } from "../../models/state.js";
|
|
2
|
+
import { type DsiotUpdate } from "./multireq.js";
|
|
3
|
+
/** Builds the body of the multireq write that turns a special mode on or off:
|
|
4
|
+
* its one leaf, on the outdoor edge for powerful and on the indoor edge for
|
|
5
|
+
* the rest. */
|
|
6
|
+
export declare function buildDsiotSpecialModeUpdate(mode: SpecialMode, enabled: boolean): object;
|
|
45
7
|
export declare function encodeDsiotBoolean(on: boolean): string;
|
|
46
8
|
export declare function decodeDsiotBoolean(pv: string | undefined): boolean;
|
|
47
9
|
export declare function decodeDsiotLittleEndian(pv: string): number;
|
|
@@ -57,25 +19,7 @@ export declare function encodeDsiotMode(mode: OperatingMode): string;
|
|
|
57
19
|
export declare function decodeDsiotMode(pv: string | undefined): OperatingMode | undefined;
|
|
58
20
|
export declare function encodeDsiotFanSpeed(speed: FanSpeed): string;
|
|
59
21
|
export declare function decodeDsiotFanSpeed(pv: string | undefined): FanSpeed | undefined;
|
|
60
|
-
/** The values a louver leaf holds besides a fixed position, which is 1-14.
|
|
61
|
-
* The leaf is three bytes, little-endian, and bit n of its `md.mx` is set
|
|
62
|
-
* when the unit takes value n. */
|
|
63
|
-
export declare const DSIOT_LOUVER_VALUES: {
|
|
64
|
-
readonly stop: 0;
|
|
65
|
-
readonly swing: 15;
|
|
66
|
-
readonly auto: 16;
|
|
67
|
-
readonly naturalWind: 19;
|
|
68
|
-
readonly floorWarming: 25;
|
|
69
|
-
};
|
|
70
|
-
export declare const DSIOT_LOUVER_STOP = "000000";
|
|
71
|
-
export declare const DSIOT_LOUVER_SWING = "0F0000";
|
|
72
22
|
export declare function isDsiotLouverSwinging(pv: string | undefined): boolean;
|
|
73
|
-
/** The value each `VerticalPosition` is held as. A fixed position has none: it
|
|
74
|
-
* is held as the value at its rank among the fixed values the unit takes. */
|
|
75
|
-
export declare const DSIOT_VERTICAL_POSITION_VALUES: Partial<Record<VerticalPosition, number>>;
|
|
76
|
-
/** The value each `HorizontalPosition` is held as. `stop` and a fixed position
|
|
77
|
-
* have none: see UNSUPPORTED.md. */
|
|
78
|
-
export declare const DSIOT_HORIZONTAL_POSITION_VALUES: Partial<Record<HorizontalPosition, number>>;
|
|
79
23
|
/** Turns the flattened indoor `dgc_status` tree, read with `md`, into a
|
|
80
24
|
* `DaikinState`. Every value is per mode: the setpoint, humidity, fan speed and
|
|
81
25
|
* louvers each have a leaf for each mode, and the state reads the current
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,QAAQ,EAKb,KAAK,aAAa,EAElB,KAAK,WAAW,EAKjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAuB3E;;eAEe;AACf,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,GACf,MAAM,CAUR;AAMD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAEtD;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,MAAM,EAAE,OAAO,GACd,MAAM,GAAG,IAAI,CAMf;AAED,qDAAqD;AACrD,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,MAAM,GAAG,SAAS,GACrB,MAAM,GAAG,IAAI,CAEf;AAED,8CAA8C;AAC9C,wBAAgB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dgc_status.e_1002.e_A001.p_07",
|
|
14
|
-
energyMonitoring: "dgc_status.e_1002.e_A011.p_01",
|
|
15
|
-
};
|
|
16
|
-
/** Each leaf holds `01` while its mode is on. Powerful is on the outdoor
|
|
17
|
-
* edge. */
|
|
18
|
-
export const DSIOT_SPECIAL_MODE_PATHS = {
|
|
19
|
-
powerful: "dgc_status.e_1003.e_3002.p_44",
|
|
20
|
-
econo: "dgc_status.e_1002.e_3003.p_24",
|
|
21
|
-
streamer: "dgc_status.e_1002.e_3003.p_20",
|
|
22
|
-
};
|
|
23
|
-
const SPECIAL_MODE_ON = "01";
|
|
24
|
-
export const DSIOT_MODE_NODE = "dgc_status.e_1002.e_3001";
|
|
25
|
-
export const DSIOT_MODE_PATHS = {
|
|
26
|
-
auto: {
|
|
27
|
-
setpoint: { path: `${DSIOT_MODE_NODE}.p_1D`, signed: true, writable: true },
|
|
28
|
-
humidity: {
|
|
29
|
-
value: `${DSIOT_MODE_NODE}.p_2E`,
|
|
30
|
-
flag: `${DSIOT_MODE_NODE}.p_2F`,
|
|
31
|
-
},
|
|
32
|
-
fanSpeed: `${DSIOT_MODE_NODE}.p_26`,
|
|
33
|
-
vertical: `${DSIOT_MODE_NODE}.p_20`,
|
|
34
|
-
horizontal: `${DSIOT_MODE_NODE}.p_21`,
|
|
35
|
-
},
|
|
36
|
-
dehumidify: {
|
|
37
|
-
setpoint: {
|
|
38
|
-
path: `${DSIOT_MODE_NODE}.p_1E`,
|
|
39
|
-
signed: true,
|
|
40
|
-
writable: false,
|
|
41
|
-
},
|
|
42
|
-
humidity: {
|
|
43
|
-
value: `${DSIOT_MODE_NODE}.p_30`,
|
|
44
|
-
flag: `${DSIOT_MODE_NODE}.p_31`,
|
|
45
|
-
},
|
|
46
|
-
fanSpeed: `${DSIOT_MODE_NODE}.p_27`,
|
|
47
|
-
vertical: `${DSIOT_MODE_NODE}.p_22`,
|
|
48
|
-
horizontal: `${DSIOT_MODE_NODE}.p_23`,
|
|
49
|
-
},
|
|
50
|
-
cool: {
|
|
51
|
-
setpoint: {
|
|
52
|
-
path: `${DSIOT_MODE_NODE}.p_02`,
|
|
53
|
-
signed: false,
|
|
54
|
-
writable: true,
|
|
55
|
-
},
|
|
56
|
-
humidity: {
|
|
57
|
-
value: `${DSIOT_MODE_NODE}.p_0B`,
|
|
58
|
-
flag: `${DSIOT_MODE_NODE}.p_0C`,
|
|
59
|
-
},
|
|
60
|
-
fanSpeed: `${DSIOT_MODE_NODE}.p_09`,
|
|
61
|
-
vertical: `${DSIOT_MODE_NODE}.p_05`,
|
|
62
|
-
horizontal: `${DSIOT_MODE_NODE}.p_06`,
|
|
63
|
-
},
|
|
64
|
-
heat: {
|
|
65
|
-
setpoint: {
|
|
66
|
-
path: `${DSIOT_MODE_NODE}.p_03`,
|
|
67
|
-
signed: false,
|
|
68
|
-
writable: true,
|
|
69
|
-
},
|
|
70
|
-
humidity: {
|
|
71
|
-
value: `${DSIOT_MODE_NODE}.p_2C`,
|
|
72
|
-
flag: `${DSIOT_MODE_NODE}.p_2D`,
|
|
2
|
+
import { buildDsiotMultireqUpdate } from "./multireq.js";
|
|
3
|
+
import { DSIOT_EDGES, DSIOT_FAN_SPEED_CODES, DSIOT_FIXED_LOUVER_VALUES, DSIOT_HORIZONTAL_POSITION_VALUES, DSIOT_HUMIDITY_OFF, DSIOT_HUMIDITY_OFF_KEPT, DSIOT_HUMIDITY_PERCENTAGE, DSIOT_HUMIDITY_SETTING_FLAGS, DSIOT_LOUVER_STOP, DSIOT_LOUVER_SWING, DSIOT_LOUVER_VALUES, DSIOT_MODE_PATHS, DSIOT_OFF, DSIOT_ON, DSIOT_OPERATING_MODE_CODES, DSIOT_PATHS, DSIOT_SPECIAL_MODE_PATHS, DSIOT_VERTICAL_POSITION_VALUES, } from "./tables.js";
|
|
4
|
+
/** Builds the body of the multireq write that turns a special mode on or off:
|
|
5
|
+
* its one leaf, on the outdoor edge for powerful and on the indoor edge for
|
|
6
|
+
* the rest. */
|
|
7
|
+
export function buildDsiotSpecialModeUpdate(mode, enabled) {
|
|
8
|
+
return buildDsiotMultireqUpdate([
|
|
9
|
+
{
|
|
10
|
+
path: DSIOT_SPECIAL_MODE_PATHS[mode],
|
|
11
|
+
value: encodeDsiotBoolean(enabled),
|
|
73
12
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
horizontal: `${DSIOT_MODE_NODE}.p_08`,
|
|
77
|
-
},
|
|
78
|
-
fan: {
|
|
79
|
-
fanSpeed: `${DSIOT_MODE_NODE}.p_28`,
|
|
80
|
-
vertical: `${DSIOT_MODE_NODE}.p_24`,
|
|
81
|
-
horizontal: `${DSIOT_MODE_NODE}.p_25`,
|
|
82
|
-
},
|
|
83
|
-
};
|
|
13
|
+
], mode === "powerful" ? DSIOT_EDGES.outdoor : DSIOT_EDGES.indoor);
|
|
14
|
+
}
|
|
84
15
|
// --- value encodings -------------------------------------------------------
|
|
85
16
|
// Leaf values are hex strings. Multi-byte values are little-endian, and
|
|
86
17
|
// temperatures count half degrees.
|
|
87
18
|
export function encodeDsiotBoolean(on) {
|
|
88
|
-
return on ?
|
|
19
|
+
return on ? DSIOT_ON : DSIOT_OFF;
|
|
89
20
|
}
|
|
90
21
|
export function decodeDsiotBoolean(pv) {
|
|
91
22
|
return pv !== undefined && Number.parseInt(pv, 16) > 0;
|
|
@@ -128,13 +59,6 @@ function signedByte(pv) {
|
|
|
128
59
|
function nullIfNaN(value) {
|
|
129
60
|
return Number.isFinite(value) ? value : null;
|
|
130
61
|
}
|
|
131
|
-
const OPERATING_MODE_CODES = {
|
|
132
|
-
fan: "0000",
|
|
133
|
-
heat: "0100",
|
|
134
|
-
cool: "0200",
|
|
135
|
-
auto: "0300",
|
|
136
|
-
dehumidify: "0500",
|
|
137
|
-
};
|
|
138
62
|
const OPERATING_MODES_BY_CODE = {
|
|
139
63
|
"0000": "fan",
|
|
140
64
|
"0100": "heat",
|
|
@@ -145,62 +69,25 @@ const OPERATING_MODES_BY_CODE = {
|
|
|
145
69
|
"0A00": "heat",
|
|
146
70
|
};
|
|
147
71
|
export function encodeDsiotMode(mode) {
|
|
148
|
-
return
|
|
72
|
+
return DSIOT_OPERATING_MODE_CODES[mode];
|
|
149
73
|
}
|
|
150
74
|
export function decodeDsiotMode(pv) {
|
|
151
75
|
return OPERATING_MODES_BY_CODE[(pv ?? "").toUpperCase()];
|
|
152
76
|
}
|
|
153
|
-
const
|
|
154
|
-
auto: "0A00",
|
|
155
|
-
silent: "0B00",
|
|
156
|
-
level1: "0300",
|
|
157
|
-
level2: "0400",
|
|
158
|
-
level3: "0500",
|
|
159
|
-
level4: "0600",
|
|
160
|
-
level5: "0700",
|
|
161
|
-
};
|
|
162
|
-
const FAN_SPEEDS_BY_CODE = Object.fromEntries(Object.entries(FAN_SPEED_CODES).map(([speed, code]) => [
|
|
77
|
+
const FAN_SPEEDS_BY_CODE = Object.fromEntries(Object.entries(DSIOT_FAN_SPEED_CODES).map(([speed, code]) => [
|
|
163
78
|
code,
|
|
164
79
|
speed,
|
|
165
80
|
]));
|
|
166
81
|
export function encodeDsiotFanSpeed(speed) {
|
|
167
|
-
return
|
|
82
|
+
return DSIOT_FAN_SPEED_CODES[speed];
|
|
168
83
|
}
|
|
169
84
|
export function decodeDsiotFanSpeed(pv) {
|
|
170
85
|
return FAN_SPEEDS_BY_CODE[(pv ?? "").toUpperCase()];
|
|
171
86
|
}
|
|
172
|
-
/** The values a louver leaf holds besides a fixed position, which is 1-14.
|
|
173
|
-
* The leaf is three bytes, little-endian, and bit n of its `md.mx` is set
|
|
174
|
-
* when the unit takes value n. */
|
|
175
|
-
export const DSIOT_LOUVER_VALUES = {
|
|
176
|
-
stop: 0,
|
|
177
|
-
swing: 15,
|
|
178
|
-
auto: 16,
|
|
179
|
-
naturalWind: 19,
|
|
180
|
-
floorWarming: 25,
|
|
181
|
-
};
|
|
182
|
-
const FIXED_LOUVER_VALUES = Array.from({ length: 14 }, (_, index) => index + 1);
|
|
183
|
-
export const DSIOT_LOUVER_STOP = "000000";
|
|
184
|
-
export const DSIOT_LOUVER_SWING = "0F0000";
|
|
185
87
|
export function isDsiotLouverSwinging(pv) {
|
|
186
88
|
return (pv ?? "").toUpperCase() === DSIOT_LOUVER_SWING;
|
|
187
89
|
}
|
|
188
|
-
/** The value each `VerticalPosition` is held as. A fixed position has none: it
|
|
189
|
-
* is held as the value at its rank among the fixed values the unit takes. */
|
|
190
|
-
export const DSIOT_VERTICAL_POSITION_VALUES = {
|
|
191
|
-
stop: DSIOT_LOUVER_VALUES.stop,
|
|
192
|
-
swing: DSIOT_LOUVER_VALUES.swing,
|
|
193
|
-
naturalWind: DSIOT_LOUVER_VALUES.naturalWind,
|
|
194
|
-
auto: DSIOT_LOUVER_VALUES.auto,
|
|
195
|
-
floorWarming: DSIOT_LOUVER_VALUES.floorWarming,
|
|
196
|
-
};
|
|
197
90
|
const FIXED_VERTICAL_POSITIONS = FIXED_LOUVER_POSITIONS;
|
|
198
|
-
/** The value each `HorizontalPosition` is held as. `stop` and a fixed position
|
|
199
|
-
* have none: see UNSUPPORTED.md. */
|
|
200
|
-
export const DSIOT_HORIZONTAL_POSITION_VALUES = {
|
|
201
|
-
swing: DSIOT_LOUVER_VALUES.swing,
|
|
202
|
-
auto: DSIOT_LOUVER_VALUES.auto,
|
|
203
|
-
};
|
|
204
91
|
function positionOf(positions, held, value) {
|
|
205
92
|
return positions.find((position) => held[position] === value) ?? null;
|
|
206
93
|
}
|
|
@@ -209,7 +96,7 @@ function isFixedLouverValue(value) {
|
|
|
209
96
|
}
|
|
210
97
|
function fixedLouverValues(values, path) {
|
|
211
98
|
const mask = decodeDsiotLittleEndian(values[`${path}.md.mx`] ?? "");
|
|
212
|
-
return
|
|
99
|
+
return DSIOT_FIXED_LOUVER_VALUES.filter((value) => mask & (1 << value));
|
|
213
100
|
}
|
|
214
101
|
function encodeLouver(value) {
|
|
215
102
|
return `${value.toString(16).toUpperCase().padStart(2, "0")}0000`;
|
|
@@ -259,17 +146,7 @@ function encodeHorizontalPosition(position, current) {
|
|
|
259
146
|
const value = DSIOT_HORIZONTAL_POSITION_VALUES[position];
|
|
260
147
|
return value === undefined ? undefined : encodeLouver(value);
|
|
261
148
|
}
|
|
262
|
-
const
|
|
263
|
-
const HUMIDITY_ON = "01";
|
|
264
|
-
// Also reads as off, and a control that switches humidity off leaves it.
|
|
265
|
-
const HUMIDITY_OFF_KEPT = "05";
|
|
266
|
-
const HUMIDITY_SETTING_FLAGS = {
|
|
267
|
-
auto: "02",
|
|
268
|
-
autoHigh: "03",
|
|
269
|
-
autoLow: "04",
|
|
270
|
-
continuous: "06",
|
|
271
|
-
};
|
|
272
|
-
const HUMIDITY_SETTINGS_BY_FLAG = Object.fromEntries(Object.entries(HUMIDITY_SETTING_FLAGS).map(([setting, flag]) => [
|
|
149
|
+
const HUMIDITY_SETTINGS_BY_FLAG = Object.fromEntries(Object.entries(DSIOT_HUMIDITY_SETTING_FLAGS).map(([setting, flag]) => [
|
|
273
150
|
flag,
|
|
274
151
|
setting,
|
|
275
152
|
]));
|
|
@@ -286,10 +163,10 @@ function decodeStep(st) {
|
|
|
286
163
|
}
|
|
287
164
|
function parseTargetHumidity(values, humidity) {
|
|
288
165
|
const flag = humidity && values[humidity.flag];
|
|
289
|
-
if (flag ===
|
|
166
|
+
if (flag === DSIOT_HUMIDITY_OFF || flag === DSIOT_HUMIDITY_OFF_KEPT) {
|
|
290
167
|
return "off";
|
|
291
168
|
}
|
|
292
|
-
if (humidity === undefined || flag !==
|
|
169
|
+
if (humidity === undefined || flag !== DSIOT_HUMIDITY_PERCENTAGE) {
|
|
293
170
|
return HUMIDITY_SETTINGS_BY_FLAG[flag ?? ""] ?? null;
|
|
294
171
|
}
|
|
295
172
|
const count = Number.parseInt(values[humidity.value] ?? "", 16);
|
|
@@ -304,16 +181,20 @@ function applyTargetHumidity(values, { value, flag }, targetHumidity) {
|
|
|
304
181
|
return [
|
|
305
182
|
{
|
|
306
183
|
path: flag,
|
|
307
|
-
value: values[flag] ===
|
|
184
|
+
value: values[flag] === DSIOT_HUMIDITY_OFF_KEPT
|
|
185
|
+
? DSIOT_HUMIDITY_OFF_KEPT
|
|
186
|
+
: DSIOT_HUMIDITY_OFF,
|
|
308
187
|
},
|
|
309
188
|
];
|
|
310
189
|
}
|
|
311
190
|
if (typeof targetHumidity === "string") {
|
|
312
|
-
return [
|
|
191
|
+
return [
|
|
192
|
+
{ path: flag, value: DSIOT_HUMIDITY_SETTING_FLAGS[targetHumidity] },
|
|
193
|
+
];
|
|
313
194
|
}
|
|
314
195
|
const count = Math.trunc(targetHumidity.percent / decodeStep(values[`${value}.md.st`]));
|
|
315
196
|
return [
|
|
316
|
-
{ path: flag, value:
|
|
197
|
+
{ path: flag, value: DSIOT_HUMIDITY_PERCENTAGE },
|
|
317
198
|
{ path: value, value: count.toString(16).toUpperCase().padStart(2, "0") },
|
|
318
199
|
];
|
|
319
200
|
}
|
|
@@ -324,7 +205,7 @@ function isHumidityOn(values, humidity, targetHumidity) {
|
|
|
324
205
|
return false;
|
|
325
206
|
}
|
|
326
207
|
return targetHumidity == null
|
|
327
|
-
? flag !==
|
|
208
|
+
? flag !== DSIOT_HUMIDITY_OFF && flag !== DSIOT_HUMIDITY_OFF_KEPT
|
|
328
209
|
: targetHumidity !== "off";
|
|
329
210
|
}
|
|
330
211
|
const POWER_TRANSITIONS = {
|
|
@@ -351,7 +232,7 @@ export function parseDsiotState(values) {
|
|
|
351
232
|
swingMode: decodeSwing(values[paths.vertical], values[paths.horizontal]),
|
|
352
233
|
verticalPosition: parseVerticalPosition(values, paths.vertical),
|
|
353
234
|
horizontalPosition: parseHorizontalPosition(values[paths.horizontal]),
|
|
354
|
-
specialModes: SPECIAL_MODES.filter((mode) => values[DSIOT_SPECIAL_MODE_PATHS[mode]] ===
|
|
235
|
+
specialModes: SPECIAL_MODES.filter((mode) => values[DSIOT_SPECIAL_MODE_PATHS[mode]] === DSIOT_ON),
|
|
355
236
|
};
|
|
356
237
|
}
|
|
357
238
|
/** Turns `values`, the flattened indoor `dgc_status` tree read with `md`, and
|