homebridge-midea-platform 1.1.1 → 1.1.2-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.
Files changed (31) hide show
  1. package/dist/accessory/AccessoryFactory.d.ts +2 -1
  2. package/dist/accessory/AccessoryFactory.d.ts.map +1 -1
  3. package/dist/accessory/AccessoryFactory.js +3 -0
  4. package/dist/accessory/AccessoryFactory.js.map +1 -1
  5. package/dist/accessory/FrontLoadWasherAccessory.d.ts +31 -0
  6. package/dist/accessory/FrontLoadWasherAccessory.d.ts.map +1 -0
  7. package/dist/accessory/FrontLoadWasherAccessory.js +61 -0
  8. package/dist/accessory/FrontLoadWasherAccessory.js.map +1 -0
  9. package/dist/core/MideaConstants.d.ts +1 -0
  10. package/dist/core/MideaConstants.d.ts.map +1 -1
  11. package/dist/core/MideaConstants.js +1 -0
  12. package/dist/core/MideaConstants.js.map +1 -1
  13. package/dist/core/MideaDevice.d.ts +1 -1
  14. package/dist/core/MideaDevice.d.ts.map +1 -1
  15. package/dist/core/MideaDevice.js +2 -2
  16. package/dist/devices/DeviceFactory.d.ts +2 -1
  17. package/dist/devices/DeviceFactory.d.ts.map +1 -1
  18. package/dist/devices/DeviceFactory.js +3 -0
  19. package/dist/devices/DeviceFactory.js.map +1 -1
  20. package/dist/devices/db/MideaDBDevice.d.ts +30 -0
  21. package/dist/devices/db/MideaDBDevice.d.ts.map +1 -0
  22. package/dist/devices/db/MideaDBDevice.js +89 -0
  23. package/dist/devices/db/MideaDBDevice.js.map +1 -0
  24. package/dist/devices/db/MideaDBMessage.d.ts +33 -0
  25. package/dist/devices/db/MideaDBMessage.d.ts.map +1 -0
  26. package/dist/devices/db/MideaDBMessage.js +102 -0
  27. package/dist/devices/db/MideaDBMessage.js.map +1 -0
  28. package/dist/devices/fa/MideaFADevice.d.ts +1 -1
  29. package/dist/devices/fa/MideaFADevice.js +1 -1
  30. package/homebridge-ui/server.js +30 -26
  31. package/package.json +1 -1
@@ -1,12 +1,13 @@
1
1
  import { MideaAccessory, MideaPlatform } from '../platform';
2
2
  import AirConditionerAccessory from './AirConditionerAccessory';
3
3
  import DehumidifierAccessory from './DehumidifierAccessory';
4
+ import FrontLoadWasherAccessory from './FrontLoadWasherAccessory';
4
5
  import ElectricWaterHeaterAccessory from './ElectricWaterHeaterAccessory';
5
6
  import GasWaterHeaterAccessory from './GasWaterHeaterAccessory';
6
7
  import FanAccessory from './FanAccessory';
7
8
  import MideaDevice from '../core/MideaDevice';
8
9
  import { DeviceConfig } from '../platformUtils';
9
10
  export default class AccessoryFactory {
10
- static createAccessory<T extends MideaDevice>(platform: MideaPlatform, accessory: MideaAccessory, device: T, configDev: DeviceConfig): AirConditionerAccessory | DehumidifierAccessory | ElectricWaterHeaterAccessory | GasWaterHeaterAccessory | FanAccessory | undefined;
11
+ static createAccessory<T extends MideaDevice>(platform: MideaPlatform, accessory: MideaAccessory, device: T, configDev: DeviceConfig): AirConditionerAccessory | DehumidifierAccessory | FrontLoadWasherAccessory | ElectricWaterHeaterAccessory | GasWaterHeaterAccessory | FanAccessory | undefined;
11
12
  }
12
13
  //# sourceMappingURL=AccessoryFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccessoryFactory.d.ts","sourceRoot":"","sources":["../../src/accessory/AccessoryFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQhD,MAAM,CAAC,OAAO,OAAO,gBAAgB;WACrB,eAAe,CAAC,CAAC,SAAS,WAAW,EACjD,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,YAAY;CAe1B"}
1
+ {"version":3,"file":"AccessoryFactory.d.ts","sourceRoot":"","sources":["../../src/accessory/AccessoryFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAShD,MAAM,CAAC,OAAO,OAAO,gBAAgB;WACrB,eAAe,CAAC,CAAC,SAAS,WAAW,EACjD,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,YAAY;CAiB1B"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const MideaConstants_1 = require("../core/MideaConstants");
7
7
  const AirConditionerAccessory_1 = __importDefault(require("./AirConditionerAccessory"));
8
8
  const DehumidifierAccessory_1 = __importDefault(require("./DehumidifierAccessory"));
9
+ const FrontLoadWasherAccessory_1 = __importDefault(require("./FrontLoadWasherAccessory"));
9
10
  const ElectricWaterHeaterAccessory_1 = __importDefault(require("./ElectricWaterHeaterAccessory"));
10
11
  const GasWaterHeaterAccessory_1 = __importDefault(require("./GasWaterHeaterAccessory"));
11
12
  const FanAccessory_1 = __importDefault(require("./FanAccessory"));
@@ -16,6 +17,8 @@ class AccessoryFactory {
16
17
  return new AirConditionerAccessory_1.default(platform, accessory, device, configDev);
17
18
  case MideaConstants_1.DeviceType.DEHUMIDIFIER:
18
19
  return new DehumidifierAccessory_1.default(platform, accessory, device, configDev);
20
+ case MideaConstants_1.DeviceType.FRONT_LOAD_WASHER:
21
+ return new FrontLoadWasherAccessory_1.default(platform, accessory, device, configDev);
19
22
  case MideaConstants_1.DeviceType.ELECTRIC_WATER_HEATER:
20
23
  return new ElectricWaterHeaterAccessory_1.default(platform, accessory, device, configDev);
21
24
  case MideaConstants_1.DeviceType.GAS_WATER_HEATER:
@@ -1 +1 @@
1
- {"version":3,"file":"AccessoryFactory.js","sourceRoot":"","sources":["../../src/accessory/AccessoryFactory.ts"],"names":[],"mappings":";;;;;AAAA,2DAAoD;AAEpD,wFAAgE;AAChE,oFAA4D;AAC5D,kGAA0E;AAC1E,wFAAgE;AAChE,kEAA0C;AAW1C,MAAqB,gBAAgB;IAC5B,MAAM,CAAC,eAAe,CAC3B,QAAuB,EACvB,SAAyB,EACzB,MAAS,EACT,SAAuB;QAEvB,QAAQ,MAAM,CAAC,IAAI,EAAE;YACnB,KAAK,2BAAU,CAAC,eAAe;gBAC7B,OAAO,IAAI,iCAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACzG,KAAK,2BAAU,CAAC,YAAY;gBAC1B,OAAO,IAAI,+BAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACvG,KAAK,2BAAU,CAAC,qBAAqB;gBACnC,OAAO,IAAI,sCAA4B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC9G,KAAK,2BAAU,CAAC,gBAAgB;gBAC9B,OAAO,IAAI,iCAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACzG,KAAK,2BAAU,CAAC,GAAG;gBACjB,OAAO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@@ -0,0 +1,31 @@
1
+ /***********************************************************************
2
+ * Midea Platform Front Load Washer Accessory class
3
+ *
4
+ * Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
5
+ *
6
+ * Based on https://github.com/homebridge/homebridge-plugin-template
7
+ *
8
+ * An instance of this class is created for each accessory the platform registers.
9
+ *
10
+ */
11
+ import { CharacteristicValue } from 'homebridge';
12
+ import { MideaAccessory, MideaPlatform } from '../platform';
13
+ import BaseAccessory from './BaseAccessory';
14
+ import { DeviceConfig } from '../platformUtils';
15
+ import MideaDBDevice, { DBAttributes } from '../devices/db/MideaDBDevice';
16
+ export default class FanAccessory extends BaseAccessory<MideaDBDevice> {
17
+ protected readonly device: MideaDBDevice;
18
+ protected readonly configDev: DeviceConfig;
19
+ private service;
20
+ /*********************************************************************
21
+ * Constructor registers all the service types with Homebridge, registers
22
+ * a callback function with the MideaDevice class, and requests device status.
23
+ */
24
+ constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaDBDevice, configDev: DeviceConfig);
25
+ updateCharacteristics(attributes: Partial<DBAttributes>): Promise<void>;
26
+ getActive(): CharacteristicValue;
27
+ setActive(value: CharacteristicValue): Promise<void>;
28
+ getInUse(): CharacteristicValue;
29
+ getRemainingDuration(): CharacteristicValue;
30
+ }
31
+ //# sourceMappingURL=FrontLoadWasherAccessory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrontLoadWasherAccessory.d.ts","sourceRoot":"","sources":["../../src/accessory/FrontLoadWasherAccessory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,mBAAmB,EAAW,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,aAAa,EAAE,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,aAAa,CAAC,aAAa,CAAC;IAUlE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa;IACxC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY;IAV5C,OAAO,CAAC,OAAO,CAAU;IAEzB;;;OAGG;gBAED,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,cAAc,EACN,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,YAAY;IAWtC,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC;IA2B7D,SAAS,IAAI,mBAAmB;IAI1B,SAAS,CAAC,KAAK,EAAE,mBAAmB;IAI1C,QAAQ,IAAI,mBAAmB;IAI/B,oBAAoB,IAAI,mBAAmB;CAG5C"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseAccessory_1 = __importDefault(require("./BaseAccessory"));
7
+ class FanAccessory extends BaseAccessory_1.default {
8
+ /*********************************************************************
9
+ * Constructor registers all the service types with Homebridge, registers
10
+ * a callback function with the MideaDevice class, and requests device status.
11
+ */
12
+ constructor(platform, accessory, device, configDev) {
13
+ super(platform, accessory, device, configDev);
14
+ this.device = device;
15
+ this.configDev = configDev;
16
+ this.service = this.accessory.getService(this.platform.Service.Valve) || this.accessory.addService(this.platform.Service.Valve);
17
+ this.service.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
18
+ this.service.getCharacteristic(this.platform.Characteristic.InUse).onGet(this.getInUse.bind(this));
19
+ this.service.getCharacteristic(this.platform.Characteristic.RemainingDuration).onGet(this.getRemainingDuration.bind(this));
20
+ }
21
+ async updateCharacteristics(attributes) {
22
+ let updateState = false;
23
+ for (const [k, v] of Object.entries(attributes)) {
24
+ this.platform.log.debug(`[${this.device.name}] Set attribute ${k} to: ${v}`);
25
+ switch (k) {
26
+ case 'power':
27
+ updateState = true;
28
+ break;
29
+ case 'start':
30
+ updateState = true;
31
+ break;
32
+ case 'time_remaining':
33
+ case 'progress':
34
+ updateState = true;
35
+ break;
36
+ default:
37
+ this.platform.log.debug(`[${this.device.name}] Attempt to set unsupported attribute ${k} to ${v}`);
38
+ break;
39
+ }
40
+ }
41
+ if (updateState) {
42
+ this.service.updateCharacteristic(this.platform.Characteristic.Active, this.getActive());
43
+ this.service.updateCharacteristic(this.platform.Characteristic.InUse, this.getInUse());
44
+ this.service.updateCharacteristic(this.platform.Characteristic.RemainingDuration, this.getRemainingDuration());
45
+ }
46
+ }
47
+ getActive() {
48
+ return this.device.attributes.POWER ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
49
+ }
50
+ async setActive(value) {
51
+ await this.device.set_attribute({ POWER: value === this.platform.Characteristic.Active.ACTIVE });
52
+ }
53
+ getInUse() {
54
+ return this.device.attributes.START ? this.platform.Characteristic.InUse.IN_USE : this.platform.Characteristic.InUse.NOT_IN_USE;
55
+ }
56
+ getRemainingDuration() {
57
+ return this.device.attributes.TIME_REMAINING;
58
+ }
59
+ }
60
+ exports.default = FanAccessory;
61
+ //# sourceMappingURL=FrontLoadWasherAccessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrontLoadWasherAccessory.js","sourceRoot":"","sources":["../../src/accessory/FrontLoadWasherAccessory.ts"],"names":[],"mappings":";;;;;AAYA,oEAA4C;AAI5C,MAAqB,YAAa,SAAQ,uBAA4B;IAGpE;;;OAGG;IACH,YACE,QAAuB,EACvB,SAAyB,EACN,MAAqB,EACrB,SAAuB;QAE1C,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAH3B,WAAM,GAAN,MAAM,CAAe;QACrB,cAAS,GAAT,SAAS,CAAc;QAI1C,I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AAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC;IAClI,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC;IAC/C,CAAC;CACF;AAhED,+BAgEC"}
@@ -4,6 +4,7 @@ export declare enum DeviceType {
4
4
  UNKNOWN = 0,
5
5
  AIR_CONDITIONER = 172,
6
6
  DEHUMIDIFIER = 161,
7
+ FRONT_LOAD_WASHER = 219,
7
8
  ELECTRIC_WATER_HEATER = 226,
8
9
  GAS_WATER_HEATER = 227,
9
10
  FAN = 250
@@ -1 +1 @@
1
- {"version":3,"file":"MideaConstants.d.ts","sourceRoot":"","sources":["../../src/core/MideaConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,WAK5B,CAAC;AAEH,eAAO,MAAM,mBAAmB,WAI9B,CAAC;AAEH,oBAAY,UAAU;IACpB,OAAO,IAAO;IACd,eAAe,MAAO;IACtB,YAAY,MAAO;IACnB,qBAAqB,MAAO;IAC5B,gBAAgB,MAAO;IACvB,GAAG,MAAO;CACX;AAED,oBAAY,kBAAkB;IAC5B,OAAO,IAAI;IACX,OAAO,IAAI;IACX,KAAK,KAAK;CACX;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,SAAS;IACnB,OAAO,IAAI;IACX,GAAG,IAAO;IACV,OAAO,IAAO;IACd,QAAQ,IAAO;IACf,eAAe,IAAO;CACvB;AAED,oBAAY,cAAc;IACxB,iBAAiB,IAAM;IACvB,kBAAkB,IAAM;IACxB,kBAAkB,IAAM;IACxB,iBAAiB,IAAM;CACxB;AAED,oBAAY,eAAe;IACzB,OAAO,IAAI;IACX,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AAED,oBAAY,UAAU;IACpB,MAAM,IAAA;IACN,GAAG,IAAA;CACJ"}
1
+ {"version":3,"file":"MideaConstants.d.ts","sourceRoot":"","sources":["../../src/core/MideaConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,WAK5B,CAAC;AAEH,eAAO,MAAM,mBAAmB,WAI9B,CAAC;AAEH,oBAAY,UAAU;IACpB,OAAO,IAAO;IACd,eAAe,MAAO;IACtB,YAAY,MAAO;IACnB,iBAAiB,MAAO;IACxB,qBAAqB,MAAO;IAC5B,gBAAgB,MAAO;IACvB,GAAG,MAAO;CACX;AAED,oBAAY,kBAAkB;IAC5B,OAAO,IAAI;IACX,OAAO,IAAI;IACX,KAAK,KAAK;CACX;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,SAAS;IACnB,OAAO,IAAI;IACX,GAAG,IAAO;IACV,OAAO,IAAO;IACd,QAAQ,IAAO;IACf,eAAe,IAAO;CACvB;AAED,oBAAY,cAAc;IACxB,iBAAiB,IAAM;IACvB,kBAAkB,IAAM;IACxB,kBAAkB,IAAM;IACxB,iBAAiB,IAAM;CACxB;AAED,oBAAY,eAAe;IACzB,OAAO,IAAI;IACX,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AAED,oBAAY,UAAU;IACpB,MAAM,IAAA;IACN,GAAG,IAAA;CACJ"}
@@ -17,6 +17,7 @@ var DeviceType;
17
17
  DeviceType[DeviceType["UNKNOWN"] = 0] = "UNKNOWN";
18
18
  DeviceType[DeviceType["AIR_CONDITIONER"] = 172] = "AIR_CONDITIONER";
19
19
  DeviceType[DeviceType["DEHUMIDIFIER"] = 161] = "DEHUMIDIFIER";
20
+ DeviceType[DeviceType["FRONT_LOAD_WASHER"] = 219] = "FRONT_LOAD_WASHER";
20
21
  DeviceType[DeviceType["ELECTRIC_WATER_HEATER"] = 226] = "ELECTRIC_WATER_HEATER";
21
22
  DeviceType[DeviceType["GAS_WATER_HEATER"] = 227] = "GAS_WATER_HEATER";
22
23
  DeviceType[DeviceType["FAN"] = 250] = "FAN";
@@ -1 +1 @@
1
- {"version":3,"file":"MideaConstants.js","sourceRoot":"","sources":["../../src/core/MideaConstants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,IAAI,SAAS,CAAC;IAC7C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACxI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAA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@@ import { MessageRequest, MessageType } from './MideaMessage';
16
16
  import { Config, DeviceConfig } from '../platformUtils';
17
17
  import EventEmitter from 'events';
18
18
  export type DeviceAttributeBase = {
19
- [key: string]: number | string | boolean | undefined;
19
+ [key: string]: number | string | boolean | Buffer | undefined;
20
20
  };
21
21
  export default abstract class MideaDevice extends EventEmitter {
22
22
  protected readonly logger: Logger;
@@ -1 +1 @@
1
- {"version":3,"file":"MideaDevice.d.ts","sourceRoot":"","sources":["../../src/core/MideaDevice.ts"],"names":[],"mappings":";;AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAkB,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAA2C,cAAc,EAA0B,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG9H,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD,CAAC;AAEF,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,WAAY,SAAQ,YAAY;IA0C1D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAzCnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IAEvC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEhC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAg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E,UAAU,EACvB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY;IA6BzB,IAAI,QAAQ,IAAI,MAAM,CAErB;IAEM,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ;IAK7C,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC;IAkB/C,OAAO,CAAC,cAAc,UAAO;YA+B5B,YAAY;IAqBb,YAAY,CAAC,IAAI,EAAE,MAAM;YAWxB,eAAe;YAmBf,eAAe;IAKhB,UAAU,CAAC,OAAO,EAAE,cAAc;IAMlC,cAAc,CAAC,aAAa,UAAQ,EAAE,kBAAkB,UAAQ;IA4DtE,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAY5C,aAAa,CAAC,OAAO,EAAE,MAAM;IAwDvB,YAAY,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM;IAc5D,cAAc;cAKX,MAAM,CAAC,MAAM,EAAE,mBAAmB;IAO3C,IAAI;IAOJ,KAAK;IAOZ,OAAO,CAAC,YAAY;IAQpB;;;;OAIG;YACW,GAAG;CAqElB"}
@@ -292,8 +292,8 @@ class MideaDevice extends events_1.default {
292
292
  await this.build_send(cmd);
293
293
  }
294
294
  catch (e) {
295
- this.logger.debug(`[${this.name}] Interface send_command failure: ${e},
296
- cmd_type: ${command_type},
295
+ this.logger.debug(`[${this.name}] Interface send_command failure: ${e},
296
+ cmd_type: ${command_type},
297
297
  cmd_body: ${command_body.toString('hex')}`);
298
298
  }
299
299
  }
@@ -6,7 +6,8 @@ import MideaA1Device from './a1/MideaA1Device';
6
6
  import MideaE2Device from './e2/MideaE2Device';
7
7
  import MideaE3Device from './e3/MideaE3Device';
8
8
  import MideaFADevice from './fa/MideaFADevice';
9
+ import MideaDBDevice from './db/MideaDBDevice';
9
10
  export default class DeviceFactory {
10
- static createDevice(logger: Logger, device_info: DeviceInfo, config: Config, deviceConfig: DeviceConfig): MideaACDevice | MideaA1Device | MideaE2Device | MideaE3Device | MideaFADevice | null;
11
+ static createDevice(logger: Logger, device_info: DeviceInfo, config: Config, deviceConfig: DeviceConfig): MideaACDevice | MideaA1Device | MideaDBDevice | MideaE2Device | MideaE3Device | MideaFADevice | null;
11
12
  }
12
13
  //# sourceMappingURL=DeviceFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceFactory.d.ts","sourceRoot":"","sources":["../../src/devices/DeviceFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAc,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,aAAa;WAClB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;CAgB/G"}
1
+ {"version":3,"file":"DeviceFactory.d.ts","sourceRoot":"","sources":["../../src/devices/DeviceFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAc,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,aAAa;WAClB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;CAkB/G"}
@@ -9,6 +9,7 @@ const MideaA1Device_1 = __importDefault(require("./a1/MideaA1Device"));
9
9
  const MideaE2Device_1 = __importDefault(require("./e2/MideaE2Device"));
10
10
  const MideaE3Device_1 = __importDefault(require("./e3/MideaE3Device"));
11
11
  const MideaFADevice_1 = __importDefault(require("./fa/MideaFADevice"));
12
+ const MideaDBDevice_1 = __importDefault(require("./db/MideaDBDevice"));
12
13
  class DeviceFactory {
13
14
  static createDevice(logger, device_info, config, deviceConfig) {
14
15
  switch (device_info.type) {
@@ -16,6 +17,8 @@ class DeviceFactory {
16
17
  return new MideaACDevice_1.default(logger, device_info, config, deviceConfig);
17
18
  case MideaConstants_1.DeviceType.DEHUMIDIFIER:
18
19
  return new MideaA1Device_1.default(logger, device_info, config, deviceConfig);
20
+ case MideaConstants_1.DeviceType.FRONT_LOAD_WASHER:
21
+ return new MideaDBDevice_1.default(logger, device_info, config, deviceConfig);
19
22
  case MideaConstants_1.DeviceType.ELECTRIC_WATER_HEATER:
20
23
  return new MideaE2Device_1.default(logger, device_info, config, deviceConfig);
21
24
  case MideaConstants_1.DeviceType.GAS_WATER_HEATER:
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceFactory.js","sourceRoot":"","sources":["../../src/devices/DeviceFactory.ts"],"names":[],"mappings":";;;;;AACA,2DAAgE;AAEhE,uEAA+C;AAC/C,uEAA+C;AAC/C,uEAA+C;AAC/C,uEAA+C;AAC/C,uEAA+C;AAE/C,MAAqB,aAAa;IACzB,MAAM,CAAC,YAAY,CAAC,MAAc,EAAE,WAAuB,EAAE,MAAc,EAAE,YAA0B;QA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AAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACtE,KAAK,2BAAU,CAAC,iBAAiB;gBAC/B,OAAO,IAAI,uBAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACtE,KAAK,2BAAU,CAAC,qBAAqB;gBACnC,OAAO,IAAI,uBAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACtE,KAAK,2BAAU,CAAC,gBAAgB;gBAC9B,OAAO,IAAI,uBAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACtE,KAAK,2BAAU,CAAC,GAAG;gBACjB,OAAO,IAAI,uBAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACtE;gBACE,OAAO,IAAI,CAAC;SACf;IACH,CAAC;CACF;AAnBD,gCAmBC"}
@@ -0,0 +1,30 @@
1
+ /***********************************************************************
2
+ * Midea Front Load Washer 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 { MessageRequest } from '../../core/MideaMessage';
15
+ export interface DBAttributes extends DeviceAttributeBase {
16
+ POWER: boolean;
17
+ START: boolean;
18
+ WASHING_DATA: Buffer;
19
+ PROGRESS: number;
20
+ TIME_REMAINING: number;
21
+ }
22
+ export default class MideaDBDevice extends MideaDevice {
23
+ attributes: DBAttributes;
24
+ constructor(logger: Logger, device_info: DeviceInfo, config: Config, deviceConfig: DeviceConfig);
25
+ build_query(): MessageRequest[];
26
+ process_message(msg: Buffer): void;
27
+ set_subtype(): void;
28
+ set_attribute(attributes: Partial<DBAttributes>): Promise<void>;
29
+ }
30
+ //# sourceMappingURL=MideaDBDevice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MideaDBDevice.d.ts","sourceRoot":"","sources":["../../../src/devices/db/MideaDBDevice.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,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IAC7C,UAAU,EAAE,YAAY,CAAC;gBAEpB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;IAY/F,WAAW,IAAI,cAAc,EAAE;IAI/B,eAAe,CAAC,GAAG,EAAE,MAAM;IA4B3B,WAAW,IAAI,IAAI;IAIb,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC;CAwBtD"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /***********************************************************************
3
+ * Midea Front Load Washer 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 MideaDBMessage_1 = require("./MideaDBMessage");
16
+ class MideaDBDevice extends MideaDevice_1.default {
17
+ constructor(logger, device_info, config, deviceConfig) {
18
+ super(logger, device_info, config, deviceConfig);
19
+ this.attributes = {
20
+ POWER: false,
21
+ START: false,
22
+ WASHING_DATA: Buffer.alloc(0),
23
+ PROGRESS: 0,
24
+ TIME_REMAINING: 0,
25
+ };
26
+ }
27
+ build_query() {
28
+ return [new MideaDBMessage_1.MessageQuery(this.device_protocol_version)];
29
+ }
30
+ process_message(msg) {
31
+ const message = new MideaDBMessage_1.MessageDBResponse(msg);
32
+ if (this.verbose) {
33
+ this.logger.debug(`[${this.name}] Body:\n${JSON.stringify(message.body)}`);
34
+ }
35
+ const changed = {};
36
+ for (const status of Object.keys(this.attributes)) {
37
+ const value = message.get_body_attribute(status.toLowerCase());
38
+ if (value !== undefined) {
39
+ if (this.attributes[status] !== value) {
40
+ // Track only those attributes that change value. So when we send to the Homebridge /
41
+ // HomeKit accessory we only update values that change. First time through this
42
+ // should be most/all attributes having initialized them to invalid values.
43
+ this.logger.debug(`[${this.name}] Value for ${status} changed from '${this.attributes[status]}' to '${value}'`);
44
+ changed[status] = value;
45
+ }
46
+ this.attributes[status] = value;
47
+ }
48
+ }
49
+ // Now we update Homebridge / Homekit accessory
50
+ if (Object.keys(changed).length > 0) {
51
+ this.update(changed);
52
+ }
53
+ else {
54
+ this.logger.debug(`[${this.name}] Status unchanged`);
55
+ }
56
+ }
57
+ set_subtype() {
58
+ this.logger.debug('No subtype for FA device');
59
+ }
60
+ async set_attribute(attributes) {
61
+ try {
62
+ for (const [k, v] of Object.entries(attributes)) {
63
+ if (k === 'POWER') {
64
+ const message = new MideaDBMessage_1.MessagePower(this.device_protocol_version);
65
+ message.power = v;
66
+ this.logger.debug(`[${this.name}] Set message:\n${JSON.stringify(message)}`);
67
+ await this.build_send(message);
68
+ continue;
69
+ }
70
+ else if (k === 'START') {
71
+ const message = new MideaDBMessage_1.MessageStart(this.device_protocol_version);
72
+ message.start = v;
73
+ this.logger.debug(`[${this.name}] Set message:\n${JSON.stringify(message)}`);
74
+ await this.build_send(message);
75
+ continue;
76
+ }
77
+ else {
78
+ this.logger.debug(`[${this.name}] Attribute '${k}' not supported`);
79
+ }
80
+ }
81
+ }
82
+ catch (err) {
83
+ const msg = err instanceof Error ? err.stack : err;
84
+ this.logger.debug(`[${this.name}] Error in set_attribute (${this.ip}:${this.port}):\n${msg}`);
85
+ }
86
+ }
87
+ }
88
+ exports.default = MideaDBDevice;
89
+ //# sourceMappingURL=MideaDBDevice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MideaDBDevice.js","sourceRoot":"","sources":["../../../src/devices/db/MideaDBDevice.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAGH,yEAA0E;AAI1E,qDAA+F;AAY/F,MAAqB,aAAc,SAAQ,qBAAW;IAGpD,YAAY,MAAc,EAAE,WAAuB,EAAE,MAAc,EAAE,YAA0B;QAC7F,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QAEjD,IAAI,CAAC,UAAU,GAAG;YAChB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK;YACZ,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7B,QAAQ,EAAE,CAAC;YACX,cAAc,EAAE,CAAC;SAClB,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,6BAAY,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,eAAe,CAAC,GAAW;QACzB,MAAM,OAAO,GAAG,IAAI,kCAAiB,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,IAAI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C"}
@@ -0,0 +1,33 @@
1
+ /// <reference types="node" />
2
+ import { MessageBody, MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage';
3
+ declare abstract class MessageDBBase extends MessageRequest {
4
+ constructor(device_protocol_version: number, message_type: MessageType, body_type: number);
5
+ }
6
+ export declare class MessageQuery extends MessageDBBase {
7
+ constructor(device_protocol_version: number);
8
+ get _body(): Buffer;
9
+ }
10
+ export declare class MessagePower extends MessageDBBase {
11
+ power: boolean;
12
+ constructor(device_protocol_version: number);
13
+ get _body(): Buffer;
14
+ }
15
+ export declare class MessageStart extends MessageDBBase {
16
+ start: boolean;
17
+ washingData: Buffer;
18
+ constructor(device_protocol_version: number);
19
+ get _body(): Buffer;
20
+ }
21
+ export declare class DBGeneralMessageBody extends MessageBody {
22
+ power: boolean;
23
+ start: boolean;
24
+ washingData: Buffer;
25
+ progress: number;
26
+ timeRemaining?: number;
27
+ constructor(body: Buffer);
28
+ }
29
+ export declare class MessageDBResponse extends MessageResponse {
30
+ constructor(message: Buffer);
31
+ }
32
+ export {};
33
+ //# sourceMappingURL=MideaDBMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MideaDBMessage.d.ts","sourceRoot":"","sources":["../../../src/devices/db/MideaDBMessage.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEpG,uBAAe,aAAc,SAAQ,cAAc;gBACrC,uBAAuB,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM;CAG1F;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,uBAAuB,EAAE,MAAM;IAI3C,IAAI,KAAK,WAER;CACF;AAED,qBAAa,YAAa,SAAQ,aAAa;IAC7C,KAAK,EAAE,OAAO,CAAC;gBAEH,uBAAuB,EAAE,MAAM;IAK3C,IAAI,KAAK,WAyBR;CACF;AAED,qBAAa,YAAa,SAAQ,aAAa;IAC7C,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;gBAER,uBAAuB,EAAE,MAAM;IAO3C,IAAI,KAAK,WAMR;CACF;AAED,qBAAa,oBAAqB,SAAQ,WAAW;IACnD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;CAsBzB;AAED,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,OAAO,EAAE,MAAM;CAU5B"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageDBResponse = exports.DBGeneralMessageBody = exports.MessageStart = exports.MessagePower = exports.MessageQuery = void 0;
4
+ const MideaConstants_1 = require("../../core/MideaConstants");
5
+ const MideaMessage_1 = require("../../core/MideaMessage");
6
+ class MessageDBBase extends MideaMessage_1.MessageRequest {
7
+ constructor(device_protocol_version, message_type, body_type) {
8
+ super(MideaConstants_1.DeviceType.FRONT_LOAD_WASHER, message_type, body_type, device_protocol_version);
9
+ }
10
+ }
11
+ class MessageQuery extends MessageDBBase {
12
+ constructor(device_protocol_version) {
13
+ super(device_protocol_version, MideaMessage_1.MessageType.QUERY, 0x03);
14
+ }
15
+ get _body() {
16
+ return Buffer.alloc(0);
17
+ }
18
+ }
19
+ exports.MessageQuery = MessageQuery;
20
+ class MessagePower extends MessageDBBase {
21
+ constructor(device_protocol_version) {
22
+ super(device_protocol_version, MideaMessage_1.MessageType.SET, 0x02);
23
+ this.power = false;
24
+ }
25
+ get _body() {
26
+ const power = this.power ? 0x01 : 0x00;
27
+ return Buffer.from([
28
+ power,
29
+ 0xff,
30
+ 0xff,
31
+ 0xff,
32
+ 0xff,
33
+ 0xff,
34
+ 0xff,
35
+ 0xff,
36
+ 0xff,
37
+ 0xff,
38
+ 0xff,
39
+ 0xff,
40
+ 0xff,
41
+ 0xff,
42
+ 0xff,
43
+ 0xff,
44
+ 0xff,
45
+ 0xff,
46
+ 0xff,
47
+ 0xff,
48
+ 0xff,
49
+ ]);
50
+ }
51
+ }
52
+ exports.MessagePower = MessagePower;
53
+ class MessageStart extends MessageDBBase {
54
+ constructor(device_protocol_version) {
55
+ super(device_protocol_version, MideaMessage_1.MessageType.SET, 0x02);
56
+ this.start = false;
57
+ this.washingData = Buffer.alloc(0);
58
+ }
59
+ get _body() {
60
+ if (this.start) {
61
+ return Buffer.concat([Buffer.from([0xff, 0x01]), this.washingData]);
62
+ }
63
+ else {
64
+ return Buffer.from([0xff, 0x00]);
65
+ }
66
+ }
67
+ }
68
+ exports.MessageStart = MessageStart;
69
+ class DBGeneralMessageBody extends MideaMessage_1.MessageBody {
70
+ constructor(body) {
71
+ super(body);
72
+ this.power = body[1] > 0;
73
+ this.start = [0x2, 0x6].includes(body[2]);
74
+ this.washingData = body.subarray(3, 16);
75
+ this.progress = 0;
76
+ this.timeRemaining = 0;
77
+ for (let i = 0; i < 7; i++) {
78
+ if ((body[16] & (1 << i)) > 0) {
79
+ this.progress = i + 1;
80
+ break;
81
+ }
82
+ }
83
+ if (this.power) {
84
+ this.timeRemaining = body[17] + (body[18] << 8);
85
+ }
86
+ else {
87
+ this.timeRemaining = undefined;
88
+ }
89
+ }
90
+ }
91
+ exports.DBGeneralMessageBody = DBGeneralMessageBody;
92
+ class MessageDBResponse extends MideaMessage_1.MessageResponse {
93
+ constructor(message) {
94
+ super(message);
95
+ if ([MideaMessage_1.MessageType.QUERY, MideaMessage_1.MessageType.SET].includes(this.message_type) ||
96
+ (this.message_type === MideaMessage_1.MessageType.NOTIFY1 && this.body_type === 0x04)) {
97
+ this.set_body(new DBGeneralMessageBody(this.body));
98
+ }
99
+ }
100
+ }
101
+ exports.MessageDBResponse = MessageDBResponse;
102
+ //# sourceMappingURL=MideaDBMessage.js.map
@@ -0,0 +1 @@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P;SACF;QAED,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;SACjD;aAAM;YACL,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;SAChC;IACH,CAAC;CACF;AA7BD,oDA6BC;AAED,MAAa,iBAAkB,SAAQ,8BAAe;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IACE,CAAC,0BAAW,CAAC,KAAK,EAAE,0BAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;YAChE,CAAC,IAAI,CAAC,YAAY,KAAK,0BAAW,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,EACtE;YACA,IAAI,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SACpD;IACH,CAAC;CACF;AAXD,8CAWC"}
@@ -1,5 +1,5 @@
1
1
  /***********************************************************************
2
- * Midea Gas Fan class
2
+ * Midea Fan class
3
3
  *
4
4
  * Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
5
5
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /***********************************************************************
3
- * Midea Gas Fan class
3
+ * Midea Fan class
4
4
  *
5
5
  * Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
6
6
  *
@@ -10,16 +10,16 @@
10
10
  const { HomebridgePluginUiServer, RequestError } = require('@homebridge/plugin-ui-utils');
11
11
  const Discover = require('../dist/core/MideaDiscover.js').default;
12
12
  const CloudFactory = require('../dist/core/MideaCloud.js').default;
13
- const { DeviceType, TCPMessageType, ProtocolVersion, Endianness } = require("../dist/core/MideaConstants.js");
14
- const { LocalSecurity } = require("../dist/core/MideaSecurity.js");
15
- const { PromiseSocket } = require("../dist/core/MideaUtils.js");
13
+ const { DeviceType, TCPMessageType, ProtocolVersion, Endianness } = require('../dist/core/MideaConstants.js');
14
+ const { LocalSecurity } = require('../dist/core/MideaSecurity.js');
15
+ const { PromiseSocket } = require('../dist/core/MideaUtils.js');
16
16
  const { defaultConfig, defaultDeviceConfig } = require('../dist/platformUtils.js');
17
17
 
18
18
  const DEFAULT_ACCOUNT = [
19
- BigInt("39182118275972017797890111985649342047468653967530949796945843010512"),
20
- BigInt("29406100301096535908214728322278519471982973450672552249652548883645"),
21
- BigInt("39182118275972017797890111985649342050088014265865102175083010656997")
22
- ]
19
+ BigInt('39182118275972017797890111985649342047468653967530949796945843010512'),
20
+ BigInt('29406100301096535908214728322278519471982973450672552249652548883645'),
21
+ BigInt('39182118275972017797890111985649342050088014265865102175083010656997'),
22
+ ];
23
23
 
24
24
  var _ = require('lodash');
25
25
 
@@ -29,19 +29,19 @@ var _ = require('lodash');
29
29
  */
30
30
  class Logger {
31
31
  _debug;
32
- _Reset = "\x1b[0m";
33
- _Bright = "\x1b[1m";
34
- _Dim = "\x1b[2m";
32
+ _Reset = '\x1b[0m';
33
+ _Bright = '\x1b[1m';
34
+ _Dim = '\x1b[2m';
35
35
 
36
- _FgBlack = "\x1b[30m";
37
- _FgRed = "\x1b[31m";
38
- _FgGreen = "\x1b[32m";
39
- _FgYellow = "\x1b[33m";
40
- _FgBlue = "\x1b[34m";
41
- _FgMagenta = "\x1b[35m";
42
- _FgCyan = "\x1b[36m";
43
- _FgWhite = "\x1b[37m";
44
- _FgGray = "\x1b[90m";
36
+ _FgBlack = '\x1b[30m';
37
+ _FgRed = '\x1b[31m';
38
+ _FgGreen = '\x1b[32m';
39
+ _FgYellow = '\x1b[33m';
40
+ _FgBlue = '\x1b[34m';
41
+ _FgMagenta = '\x1b[35m';
42
+ _FgCyan = '\x1b[36m';
43
+ _FgWhite = '\x1b[37m';
44
+ _FgGray = '\x1b[90m';
45
45
 
46
46
  constructor(uiDebug = false) {
47
47
  this._debug = uiDebug;
@@ -70,7 +70,6 @@ class Logger {
70
70
  * Main server-side script called when Custom UI client sends requests
71
71
  */
72
72
  class UiServer extends HomebridgePluginUiServer {
73
-
74
73
  cloud;
75
74
  promiseSocket;
76
75
  security;
@@ -92,8 +91,8 @@ class UiServer extends HomebridgePluginUiServer {
92
91
  if (useDefaultProfile) {
93
92
  this.logger.debug(`Using default profile.`);
94
93
  registeredApp = 'Midea SmartHome (MSmartHome)';
95
- username = Buffer.from((DEFAULT_ACCOUNT[0] ^ DEFAULT_ACCOUNT[1]).toString(16), 'hex').toString('ascii')
96
- password = Buffer.from((DEFAULT_ACCOUNT[0] ^ DEFAULT_ACCOUNT[2]).toString(16), 'hex').toString('ascii')
94
+ username = Buffer.from((DEFAULT_ACCOUNT[0] ^ DEFAULT_ACCOUNT[1]).toString(16), 'hex').toString('ascii');
95
+ password = Buffer.from((DEFAULT_ACCOUNT[0] ^ DEFAULT_ACCOUNT[2]).toString(16), 'hex').toString('ascii');
97
96
  }
98
97
  this.cloud = CloudFactory.createCloud(username, password, registeredApp);
99
98
  if (username && password && registeredApp) {
@@ -136,9 +135,7 @@ class UiServer extends HomebridgePluginUiServer {
136
135
  }
137
136
  }
138
137
  this.logger.debug(`All devices:\n${JSON.stringify(devices, null, 2)}`);
139
- return devices
140
- .filter((a) => Object.keys(a).length > 0)
141
- .sort((a, b) => a.ip.localeCompare(b.ip));
138
+ return devices.filter((a) => Object.keys(a).length > 0).sort((a, b) => a.ip.localeCompare(b.ip));
142
139
  } catch (e) {
143
140
  const msg = e instanceof Error ? e.stack : e;
144
141
  throw new RequestError(`Device discovery failed:\n${msg}`);
@@ -199,7 +196,11 @@ class UiServer extends HomebridgePluginUiServer {
199
196
  const response = await this.promiseSocket.read();
200
197
  if (response) {
201
198
  if (response.length < 20) {
202
- this.logger.debug(`[${device.name}] Authenticate error when receiving data from ${device.ip}:${device.port}. (Data length: ${response.length})\n${JSON.stringify(response)}`);
199
+ this.logger.debug(
200
+ `[${device.name}] Authenticate error when receiving data from ${device.ip}:${device.port}. (Data length: ${
201
+ response.length
202
+ })\n${JSON.stringify(response)}`,
203
+ );
203
204
  throw Error(`[${device.name}] Authenticate error when receiving data from ${device.ip}:${device.port}. (Data length mismatch)`);
204
205
  }
205
206
  const resp = response.subarray(8, 72);
@@ -239,6 +240,9 @@ class UiServer extends HomebridgePluginUiServer {
239
240
  case DeviceType.DEHUMIDIFIER:
240
241
  device['displayName'] = 'Dehumidifier';
241
242
  break;
243
+ case DeviceType.FRONT_LOAD_WASHER:
244
+ device['displayName'] = 'Front Load Washer';
245
+ break;
242
246
  case DeviceType.ELECTRIC_WATER_HEATER:
243
247
  device['displayName'] = 'Electric Water Heater';
244
248
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Homebridge Midea Platform",
3
3
  "name": "homebridge-midea-platform",
4
- "version": "1.1.1",
4
+ "version": "1.1.2-beta.2",
5
5
  "description": "Homebridge plugin for Midea devices",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {