homebridge-midea-platform 1.1.2-beta.9 → 1.2.0-beta.2
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/.husky/pre-commit +0 -0
- package/CHANGELOG.md +4 -2
- package/config.schema.json +46 -1
- package/dist/accessory/AccessoryFactory.d.ts +12 -12
- package/dist/accessory/AccessoryFactory.js +31 -31
- package/dist/accessory/AirConditionerAccessory.d.ts +92 -89
- package/dist/accessory/AirConditionerAccessory.d.ts.map +1 -1
- package/dist/accessory/AirConditionerAccessory.js +607 -584
- package/dist/accessory/AirConditionerAccessory.js.map +1 -1
- package/dist/accessory/BaseAccessory.d.ts +11 -11
- package/dist/accessory/BaseAccessory.js +21 -21
- package/dist/accessory/DehumidifierAccessory.d.ts +45 -45
- package/dist/accessory/DehumidifierAccessory.js +344 -344
- package/dist/accessory/DishwasherAccessory.d.ts +31 -0
- package/dist/accessory/DishwasherAccessory.d.ts.map +1 -0
- package/dist/accessory/DishwasherAccessory.js +64 -0
- package/dist/accessory/DishwasherAccessory.js.map +1 -0
- package/dist/accessory/ElectricWaterHeaterAccessory.d.ts +44 -44
- package/dist/accessory/ElectricWaterHeaterAccessory.js +176 -176
- package/dist/accessory/FanAccessory.d.ts +39 -39
- package/dist/accessory/FanAccessory.js +123 -123
- package/dist/accessory/FrontLoadWasherAccessory.d.ts +30 -30
- package/dist/accessory/FrontLoadWasherAccessory.d.ts.map +1 -1
- package/dist/accessory/FrontLoadWasherAccessory.js +66 -60
- package/dist/accessory/FrontLoadWasherAccessory.js.map +1 -1
- package/dist/accessory/GasWaterHeaterAccessory.d.ts +51 -51
- package/dist/accessory/GasWaterHeaterAccessory.js +216 -216
- package/dist/core/MideaCloud.d.ts +35 -35
- package/dist/core/MideaCloud.js +350 -350
- package/dist/core/MideaConstants.d.ts +50 -49
- package/dist/core/MideaConstants.d.ts.map +1 -1
- package/dist/core/MideaConstants.js +58 -57
- package/dist/core/MideaConstants.js.map +1 -1
- package/dist/core/MideaDevice.d.ts +76 -76
- package/dist/core/MideaDevice.js +409 -409
- package/dist/core/MideaDiscover.d.ts +35 -35
- package/dist/core/MideaDiscover.js +212 -212
- package/dist/core/MideaMessage.d.ts +75 -75
- package/dist/core/MideaMessage.js +184 -184
- package/dist/core/MideaPacketBuilder.d.ts +10 -10
- package/dist/core/MideaPacketBuilder.js +60 -60
- package/dist/core/MideaSecurity.d.ts +63 -63
- package/dist/core/MideaSecurity.js +251 -251
- package/dist/core/MideaUtils.d.ts +32 -32
- package/dist/core/MideaUtils.js +181 -181
- package/dist/devices/DeviceFactory.d.ts +13 -12
- package/dist/devices/DeviceFactory.d.ts.map +1 -1
- package/dist/devices/DeviceFactory.js +36 -33
- package/dist/devices/DeviceFactory.js.map +1 -1
- package/dist/devices/a1/MideaA1Device.d.ts +76 -76
- package/dist/devices/a1/MideaA1Device.d.ts.map +1 -1
- package/dist/devices/a1/MideaA1Device.js +145 -136
- package/dist/devices/a1/MideaA1Device.js.map +1 -1
- package/dist/devices/a1/MideaA1Message.d.ts +40 -40
- package/dist/devices/a1/MideaA1Message.js +198 -198
- package/dist/devices/ac/MideaACDevice.d.ts +104 -100
- package/dist/devices/ac/MideaACDevice.d.ts.map +1 -1
- package/dist/devices/ac/MideaACDevice.js +384 -381
- package/dist/devices/ac/MideaACDevice.js.map +1 -1
- package/dist/devices/ac/MideaACMessage.d.ts +94 -92
- package/dist/devices/ac/MideaACMessage.d.ts.map +1 -1
- package/dist/devices/ac/MideaACMessage.js +611 -589
- package/dist/devices/ac/MideaACMessage.js.map +1 -1
- package/dist/devices/db/MideaDBDevice.d.ts +29 -29
- package/dist/devices/db/MideaDBDevice.d.ts.map +1 -1
- package/dist/devices/db/MideaDBDevice.js +100 -88
- package/dist/devices/db/MideaDBDevice.js.map +1 -1
- package/dist/devices/db/MideaDBMessage.d.ts +32 -32
- package/dist/devices/db/MideaDBMessage.d.ts.map +1 -1
- package/dist/devices/db/MideaDBMessage.js +101 -101
- package/dist/devices/db/MideaDBMessage.js.map +1 -1
- package/dist/devices/e1/MideaE1Device.d.ts +57 -0
- package/dist/devices/e1/MideaE1Device.d.ts.map +1 -0
- package/dist/devices/e1/MideaE1Device.js +129 -0
- package/dist/devices/e1/MideaE1Device.js.map +1 -0
- package/dist/devices/e1/MideaE1Message.d.ts +29 -0
- package/dist/devices/e1/MideaE1Message.d.ts.map +1 -0
- package/dist/devices/e1/MideaE1Message.js +108 -0
- package/dist/devices/e1/MideaE1Message.js.map +1 -0
- package/dist/devices/e2/MideaE2Device.d.ts +44 -44
- package/dist/devices/e2/MideaE2Device.d.ts.map +1 -1
- package/dist/devices/e2/MideaE2Device.js +129 -119
- package/dist/devices/e2/MideaE2Device.js.map +1 -1
- package/dist/devices/e2/MideaE2Message.d.ts +33 -33
- package/dist/devices/e2/MideaE2Message.js +132 -132
- package/dist/devices/e3/MideaE3Device.d.ts +43 -43
- package/dist/devices/e3/MideaE3Device.d.ts.map +1 -1
- package/dist/devices/e3/MideaE3Device.js +137 -125
- package/dist/devices/e3/MideaE3Device.js.map +1 -1
- package/dist/devices/e3/MideaE3Message.d.ts +51 -51
- package/dist/devices/e3/MideaE3Message.js +136 -136
- package/dist/devices/fa/MideaFADevice.d.ts +36 -36
- package/dist/devices/fa/MideaFADevice.d.ts.map +1 -1
- package/dist/devices/fa/MideaFADevice.js +106 -92
- package/dist/devices/fa/MideaFADevice.js.map +1 -1
- package/dist/devices/fa/MideaFAMessage.d.ts +38 -38
- package/dist/devices/fa/MideaFAMessage.js +98 -98
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/platform.d.ts +60 -60
- package/dist/platform.js +212 -212
- package/dist/platformUtils.d.ts +106 -99
- package/dist/platformUtils.d.ts.map +1 -1
- package/dist/platformUtils.js +101 -97
- package/dist/platformUtils.js.map +1 -1
- package/dist/settings.d.ts +8 -8
- package/dist/settings.js +11 -11
- package/docs/e1.md +3 -0
- package/homebridge-ui/server.js +3 -0
- package/package.json +1 -1
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
/***********************************************************************
|
|
2
|
-
* Midea Electric Water Heater Device class
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
-
*
|
|
6
|
-
* With thanks to https://github.com/georgezhao2010/midea_ac_lan
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
/// <reference types="node" />
|
|
10
|
-
import { Logger } from 'homebridge';
|
|
11
|
-
import MideaDevice, { DeviceAttributeBase } from '../../core/MideaDevice';
|
|
12
|
-
import { DeviceInfo } from '../../core/MideaConstants';
|
|
13
|
-
import { Config, DeviceConfig } from '../../platformUtils';
|
|
14
|
-
import { MessageQuery, MessageSet } from './MideaE2Message';
|
|
15
|
-
export interface E2Attributes extends DeviceAttributeBase {
|
|
16
|
-
POWER: boolean;
|
|
17
|
-
HEATING: boolean;
|
|
18
|
-
KEEP_WARM: boolean;
|
|
19
|
-
PROTECTION: boolean;
|
|
20
|
-
CURRENT_TEMPERATURE?: number;
|
|
21
|
-
TARGET_TEMPERATURE: number;
|
|
22
|
-
WHOLE_TANK_HEATING: boolean;
|
|
23
|
-
VARIABLE_HEATING: boolean;
|
|
24
|
-
HEATING_TIME_REMAINING: number;
|
|
25
|
-
WATER_CONSUMPTION?: number;
|
|
26
|
-
HEATING_POWER?: number;
|
|
27
|
-
}
|
|
28
|
-
export default class MideaE2Device extends MideaDevice {
|
|
29
|
-
attributes: E2Attributes;
|
|
30
|
-
private _old_protocol;
|
|
31
|
-
/*********************************************************************
|
|
32
|
-
* Constructor initializes all the attributes. We set some to invalid
|
|
33
|
-
* values so that they are detected as "changed" on the first status
|
|
34
|
-
* refresh... and passed back to the Homebridge/HomeKit accessory callback
|
|
35
|
-
* function to set their initial values.
|
|
36
|
-
*/
|
|
37
|
-
constructor(logger: Logger, device_info: DeviceInfo, config: Config, deviceConfig: DeviceConfig);
|
|
38
|
-
get old_protocol(): boolean;
|
|
39
|
-
build_query(): MessageQuery[];
|
|
40
|
-
process_message(msg: Buffer): void;
|
|
41
|
-
make_message_set(): MessageSet;
|
|
42
|
-
set_attribute(attributes: Partial<E2Attributes>): Promise<void>;
|
|
43
|
-
protected set_subtype(): void;
|
|
44
|
-
}
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* Midea Electric Water Heater Device class
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
+
*
|
|
6
|
+
* With thanks to https://github.com/georgezhao2010/midea_ac_lan
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
/// <reference types="node" />
|
|
10
|
+
import { Logger } from 'homebridge';
|
|
11
|
+
import MideaDevice, { DeviceAttributeBase } from '../../core/MideaDevice';
|
|
12
|
+
import { DeviceInfo } from '../../core/MideaConstants';
|
|
13
|
+
import { Config, DeviceConfig } from '../../platformUtils';
|
|
14
|
+
import { MessageQuery, MessageSet } from './MideaE2Message';
|
|
15
|
+
export interface E2Attributes extends DeviceAttributeBase {
|
|
16
|
+
POWER: boolean;
|
|
17
|
+
HEATING: boolean;
|
|
18
|
+
KEEP_WARM: boolean;
|
|
19
|
+
PROTECTION: boolean;
|
|
20
|
+
CURRENT_TEMPERATURE?: number;
|
|
21
|
+
TARGET_TEMPERATURE: number;
|
|
22
|
+
WHOLE_TANK_HEATING: boolean;
|
|
23
|
+
VARIABLE_HEATING: boolean;
|
|
24
|
+
HEATING_TIME_REMAINING: number;
|
|
25
|
+
WATER_CONSUMPTION?: number;
|
|
26
|
+
HEATING_POWER?: number;
|
|
27
|
+
}
|
|
28
|
+
export default class MideaE2Device extends MideaDevice {
|
|
29
|
+
attributes: E2Attributes;
|
|
30
|
+
private _old_protocol;
|
|
31
|
+
/*********************************************************************
|
|
32
|
+
* Constructor initializes all the attributes. We set some to invalid
|
|
33
|
+
* values so that they are detected as "changed" on the first status
|
|
34
|
+
* refresh... and passed back to the Homebridge/HomeKit accessory callback
|
|
35
|
+
* function to set their initial values.
|
|
36
|
+
*/
|
|
37
|
+
constructor(logger: Logger, device_info: DeviceInfo, config: Config, deviceConfig: DeviceConfig);
|
|
38
|
+
get old_protocol(): boolean;
|
|
39
|
+
build_query(): MessageQuery[];
|
|
40
|
+
process_message(msg: Buffer): void;
|
|
41
|
+
make_message_set(): MessageSet;
|
|
42
|
+
set_attribute(attributes: Partial<E2Attributes>): Promise<void>;
|
|
43
|
+
protected set_subtype(): void;
|
|
44
|
+
}
|
|
45
45
|
//# sourceMappingURL=MideaE2Device.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MideaE2Device.d.ts","sourceRoot":"","sources":["../../../src/devices/e2/MideaE2Device.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,WAAW,EAAE,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"MideaE2Device.d.ts","sourceRoot":"","sources":["../../../src/devices/e2/MideaE2Device.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,WAAW,EAAE,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAA0D,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAIpH,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IAC7C,UAAU,EAAE,YAAY,CAAC;IAEhC,OAAO,CAAC,aAAa,CAAS;IAE9B;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;IAkB/F,IAAI,YAAY,YAEf;IAED,WAAW;IAIX,eAAe,CAAC,GAAG,EAAE,MAAM;IA4B3B,gBAAgB;IASV,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC;IAgDrD,SAAS,CAAC,WAAW,IAAI,IAAI;CAG9B"}
|
|
@@ -1,120 +1,130 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/***********************************************************************
|
|
3
|
-
* Midea Electric Water Heater Device class
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
6
|
-
*
|
|
7
|
-
* With thanks to https://github.com/georgezhao2010/midea_ac_lan
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const MideaDevice_1 = __importDefault(require("../../core/MideaDevice"));
|
|
15
|
-
const MideaE2Message_1 = require("./MideaE2Message");
|
|
16
|
-
class MideaE2Device extends MideaDevice_1.default {
|
|
17
|
-
/*********************************************************************
|
|
18
|
-
* Constructor initializes all the attributes. We set some to invalid
|
|
19
|
-
* values so that they are detected as "changed" on the first status
|
|
20
|
-
* refresh... and passed back to the Homebridge/HomeKit accessory callback
|
|
21
|
-
* function to set their initial values.
|
|
22
|
-
*/
|
|
23
|
-
constructor(logger, device_info, config, deviceConfig) {
|
|
24
|
-
super(logger, device_info, config, deviceConfig);
|
|
25
|
-
this.attributes = {
|
|
26
|
-
POWER: false,
|
|
27
|
-
HEATING: false,
|
|
28
|
-
KEEP_WARM: false,
|
|
29
|
-
PROTECTION: false,
|
|
30
|
-
CURRENT_TEMPERATURE: undefined,
|
|
31
|
-
TARGET_TEMPERATURE: 40,
|
|
32
|
-
WHOLE_TANK_HEATING: false,
|
|
33
|
-
VARIABLE_HEATING: false,
|
|
34
|
-
HEATING_TIME_REMAINING: 0,
|
|
35
|
-
WATER_CONSUMPTION: undefined,
|
|
36
|
-
HEATING_POWER: undefined,
|
|
37
|
-
};
|
|
38
|
-
this._old_protocol = deviceConfig.E2_options.protocol;
|
|
39
|
-
}
|
|
40
|
-
get old_protocol() {
|
|
41
|
-
return this.sub_type <= 82 || this.sub_type === 85 || this.sub_type === 36353;
|
|
42
|
-
}
|
|
43
|
-
build_query() {
|
|
44
|
-
return [new MideaE2Message_1.MessageQuery(this.device_protocol_version)];
|
|
45
|
-
}
|
|
46
|
-
process_message(msg) {
|
|
47
|
-
const message = new MideaE2Message_1.MessageE2Response(msg);
|
|
48
|
-
if (this.verbose) {
|
|
49
|
-
this.logger.debug(`[${this.name}] Body:\n${JSON.stringify(message.body)}`);
|
|
50
|
-
}
|
|
51
|
-
const changed = {};
|
|
52
|
-
for (const status of Object.keys(this.attributes)) {
|
|
53
|
-
const value = message.get_body_attribute(status.toLowerCase());
|
|
54
|
-
if (value !== undefined) {
|
|
55
|
-
if (this.attributes[status] !== value) {
|
|
56
|
-
// Track only those attributes that change value. So when we send to the Homebridge /
|
|
57
|
-
// HomeKit accessory we only update values that change. First time through this
|
|
58
|
-
// should be most/all attributes having initialized them to invalid values.
|
|
59
|
-
this.logger.debug(`[${this.name}] Value for ${status} changed from '${this.attributes[status]}' to '${value}'`);
|
|
60
|
-
changed[status] = value;
|
|
61
|
-
}
|
|
62
|
-
this.attributes[status] = value;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Now we update Homebridge / Homekit accessory
|
|
66
|
-
if (Object.keys(changed).length > 0) {
|
|
67
|
-
this.update(changed);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
this.logger.debug(`[${this.name}] Status unchanged`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
make_message_set() {
|
|
74
|
-
const message = new MideaE2Message_1.MessageSet(this.device_protocol_version);
|
|
75
|
-
message.protection = this.attributes.PROTECTION;
|
|
76
|
-
message.whole_tank_heating = this.attributes.WHOLE_TANK_HEATING;
|
|
77
|
-
message.target_temperature = this.attributes.TARGET_TEMPERATURE;
|
|
78
|
-
message.variable_heating = this.attributes.VARIABLE_HEATING;
|
|
79
|
-
return message;
|
|
80
|
-
}
|
|
81
|
-
async set_attribute(attributes) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/***********************************************************************
|
|
3
|
+
* Midea Electric Water Heater Device class
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
6
|
+
*
|
|
7
|
+
* With thanks to https://github.com/georgezhao2010/midea_ac_lan
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const MideaDevice_1 = __importDefault(require("../../core/MideaDevice"));
|
|
15
|
+
const MideaE2Message_1 = require("./MideaE2Message");
|
|
16
|
+
class MideaE2Device extends MideaDevice_1.default {
|
|
17
|
+
/*********************************************************************
|
|
18
|
+
* Constructor initializes all the attributes. We set some to invalid
|
|
19
|
+
* values so that they are detected as "changed" on the first status
|
|
20
|
+
* refresh... and passed back to the Homebridge/HomeKit accessory callback
|
|
21
|
+
* function to set their initial values.
|
|
22
|
+
*/
|
|
23
|
+
constructor(logger, device_info, config, deviceConfig) {
|
|
24
|
+
super(logger, device_info, config, deviceConfig);
|
|
25
|
+
this.attributes = {
|
|
26
|
+
POWER: false,
|
|
27
|
+
HEATING: false,
|
|
28
|
+
KEEP_WARM: false,
|
|
29
|
+
PROTECTION: false,
|
|
30
|
+
CURRENT_TEMPERATURE: undefined,
|
|
31
|
+
TARGET_TEMPERATURE: 40,
|
|
32
|
+
WHOLE_TANK_HEATING: false,
|
|
33
|
+
VARIABLE_HEATING: false,
|
|
34
|
+
HEATING_TIME_REMAINING: 0,
|
|
35
|
+
WATER_CONSUMPTION: undefined,
|
|
36
|
+
HEATING_POWER: undefined,
|
|
37
|
+
};
|
|
38
|
+
this._old_protocol = deviceConfig.E2_options.protocol;
|
|
39
|
+
}
|
|
40
|
+
get old_protocol() {
|
|
41
|
+
return this.sub_type <= 82 || this.sub_type === 85 || this.sub_type === 36353;
|
|
42
|
+
}
|
|
43
|
+
build_query() {
|
|
44
|
+
return [new MideaE2Message_1.MessageQuery(this.device_protocol_version)];
|
|
45
|
+
}
|
|
46
|
+
process_message(msg) {
|
|
47
|
+
const message = new MideaE2Message_1.MessageE2Response(msg);
|
|
48
|
+
if (this.verbose) {
|
|
49
|
+
this.logger.debug(`[${this.name}] Body:\n${JSON.stringify(message.body)}`);
|
|
50
|
+
}
|
|
51
|
+
const changed = {};
|
|
52
|
+
for (const status of Object.keys(this.attributes)) {
|
|
53
|
+
const value = message.get_body_attribute(status.toLowerCase());
|
|
54
|
+
if (value !== undefined) {
|
|
55
|
+
if (this.attributes[status] !== value) {
|
|
56
|
+
// Track only those attributes that change value. So when we send to the Homebridge /
|
|
57
|
+
// HomeKit accessory we only update values that change. First time through this
|
|
58
|
+
// should be most/all attributes having initialized them to invalid values.
|
|
59
|
+
this.logger.debug(`[${this.name}] Value for ${status} changed from '${this.attributes[status]}' to '${value}'`);
|
|
60
|
+
changed[status] = value;
|
|
61
|
+
}
|
|
62
|
+
this.attributes[status] = value;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Now we update Homebridge / Homekit accessory
|
|
66
|
+
if (Object.keys(changed).length > 0) {
|
|
67
|
+
this.update(changed);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.logger.debug(`[${this.name}] Status unchanged`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
make_message_set() {
|
|
74
|
+
const message = new MideaE2Message_1.MessageSet(this.device_protocol_version);
|
|
75
|
+
message.protection = this.attributes.PROTECTION;
|
|
76
|
+
message.whole_tank_heating = this.attributes.WHOLE_TANK_HEATING;
|
|
77
|
+
message.target_temperature = this.attributes.TARGET_TEMPERATURE;
|
|
78
|
+
message.variable_heating = this.attributes.VARIABLE_HEATING;
|
|
79
|
+
return message;
|
|
80
|
+
}
|
|
81
|
+
async set_attribute(attributes) {
|
|
82
|
+
var _a, _b, _c;
|
|
83
|
+
const messageToSend = {
|
|
84
|
+
POWER: undefined,
|
|
85
|
+
SET: undefined,
|
|
86
|
+
NEW_PROTOCOL_SET: undefined,
|
|
87
|
+
};
|
|
88
|
+
try {
|
|
89
|
+
for (const [k, v] of Object.entries(attributes)) {
|
|
90
|
+
if (v === this.attributes[k]) {
|
|
91
|
+
this.logger.info(`[${this.name}] Attribute ${k} already set to ${v}`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
this.logger.info(`[${this.name}] Set device attribute ${k} to: ${v}`);
|
|
95
|
+
this.attributes[k] = v;
|
|
96
|
+
// not sensor data
|
|
97
|
+
if (!['HEATING', 'KEEP_WARM', 'CURRENT_TEMPERATURE'].includes(k)) {
|
|
98
|
+
const old_protocol = this._old_protocol !== 'auto' ? this._old_protocol === 'old' : this.old_protocol;
|
|
99
|
+
if (k === 'POWER') {
|
|
100
|
+
(_a = messageToSend.POWER) !== null && _a !== void 0 ? _a : (messageToSend.POWER = new MideaE2Message_1.MessagePower(this.device_protocol_version));
|
|
101
|
+
messageToSend.POWER.power = v;
|
|
102
|
+
}
|
|
103
|
+
else if (old_protocol) {
|
|
104
|
+
(_b = messageToSend.SET) !== null && _b !== void 0 ? _b : (messageToSend.SET = this.make_message_set());
|
|
105
|
+
messageToSend.SET[k.toLowerCase()] = v;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
(_c = messageToSend.NEW_PROTOCOL_SET) !== null && _c !== void 0 ? _c : (messageToSend.NEW_PROTOCOL_SET = new MideaE2Message_1.MessageNewProtocolSet(this.device_protocol_version));
|
|
109
|
+
messageToSend.NEW_PROTOCOL_SET[k.toLowerCase()] = v;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const [k, v] of Object.entries(messageToSend)) {
|
|
114
|
+
if (v !== undefined) {
|
|
115
|
+
this.logger.debug(`[${this.name}] Set message ${k}:\n${JSON.stringify(v)}`);
|
|
116
|
+
await this.build_send(v);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
const msg = err instanceof Error ? err.stack : err;
|
|
122
|
+
this.logger.debug(`[${this.name}] Error in set_attribute (${this.ip}:${this.port}):\n${msg}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
set_subtype() {
|
|
126
|
+
this.logger.debug('No subtype for E2 device');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.default = MideaE2Device;
|
|
120
130
|
//# sourceMappingURL=MideaE2Device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MideaE2Device.js","sourceRoot":"","sources":["../../../src/devices/e2/MideaE2Device.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAGH,yEAA0E;
|
|
1
|
+
{"version":3,"file":"MideaE2Device.js","sourceRoot":"","sources":["../../../src/devices/e2/MideaE2Device.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAGH,yEAA0E;AAG1E,qDAAoH;AAkBpH,MAAqB,aAAc,SAAQ,qBAAW;IAKpD;;;;;OAKG;IACH,YAAY,MAAc,EAAE,WAAuB,EAAE,MAAc,EAAE,YAA0B;QAC7F,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG;YAChB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,KAAK;YACjB,mBAAmB,EAAE,SAAS;YAC9B,kBAAkB,EAAE,EAAE;YACtB,kBAAkB,EAAE,KAAK;YACzB,gBAAgB,EAAE,KAAK;YACvB,sBAAsB,EAAE,CAAC;YACzB,iBAAiB,EAAE,SAAS;YAC5B,aAAa,EAAE,SAAS;SACzB,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC;IACxD,CAAC;IAED,IAAI,YAAY;Q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;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;YACnD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,6BAA6B,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI,OAAO,GAAG,EAAE,CAAC,CAAC;SAC/F;IACH,CAAC;IAES,WAAW;QACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAChD,CAAC;CACF;AA7HD,gCA6HC"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage';
|
|
3
|
-
declare abstract class MessageE2Base extends MessageRequest {
|
|
4
|
-
constructor(device_protocol_version: number, message_type: MessageType, body_type: number);
|
|
5
|
-
}
|
|
6
|
-
export declare class MessageQuery extends MessageE2Base {
|
|
7
|
-
constructor(device_protocol_version: number);
|
|
8
|
-
get _body(): Buffer;
|
|
9
|
-
}
|
|
10
|
-
export declare class MessagePower extends MessageE2Base {
|
|
11
|
-
power: boolean;
|
|
12
|
-
constructor(device_protocol_version: number);
|
|
13
|
-
get _body(): Buffer;
|
|
14
|
-
}
|
|
15
|
-
export declare class MessageNewProtocolSet extends MessageE2Base {
|
|
16
|
-
target_temperature?: number;
|
|
17
|
-
variable_heating?: boolean;
|
|
18
|
-
whole_tank_heating?: boolean;
|
|
19
|
-
constructor(device_protocol_version: number);
|
|
20
|
-
get _body(): Buffer;
|
|
21
|
-
}
|
|
22
|
-
export declare class MessageSet extends MessageE2Base {
|
|
23
|
-
target_temperature: number;
|
|
24
|
-
variable_heating: boolean;
|
|
25
|
-
whole_tank_heating: boolean;
|
|
26
|
-
protection: boolean;
|
|
27
|
-
constructor(device_protocol_version: number);
|
|
28
|
-
get _body(): Buffer;
|
|
29
|
-
}
|
|
30
|
-
export declare class MessageE2Response extends MessageResponse {
|
|
31
|
-
constructor(message: Buffer);
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage';
|
|
3
|
+
declare abstract class MessageE2Base extends MessageRequest {
|
|
4
|
+
constructor(device_protocol_version: number, message_type: MessageType, body_type: number);
|
|
5
|
+
}
|
|
6
|
+
export declare class MessageQuery extends MessageE2Base {
|
|
7
|
+
constructor(device_protocol_version: number);
|
|
8
|
+
get _body(): Buffer;
|
|
9
|
+
}
|
|
10
|
+
export declare class MessagePower extends MessageE2Base {
|
|
11
|
+
power: boolean;
|
|
12
|
+
constructor(device_protocol_version: number);
|
|
13
|
+
get _body(): Buffer;
|
|
14
|
+
}
|
|
15
|
+
export declare class MessageNewProtocolSet extends MessageE2Base {
|
|
16
|
+
target_temperature?: number;
|
|
17
|
+
variable_heating?: boolean;
|
|
18
|
+
whole_tank_heating?: boolean;
|
|
19
|
+
constructor(device_protocol_version: number);
|
|
20
|
+
get _body(): Buffer;
|
|
21
|
+
}
|
|
22
|
+
export declare class MessageSet extends MessageE2Base {
|
|
23
|
+
target_temperature: number;
|
|
24
|
+
variable_heating: boolean;
|
|
25
|
+
whole_tank_heating: boolean;
|
|
26
|
+
protection: boolean;
|
|
27
|
+
constructor(device_protocol_version: number);
|
|
28
|
+
get _body(): Buffer;
|
|
29
|
+
}
|
|
30
|
+
export declare class MessageE2Response extends MessageResponse {
|
|
31
|
+
constructor(message: Buffer);
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
34
|
//# sourceMappingURL=MideaE2Message.d.ts.map
|