homebridge-midea-platform 1.2.6-beta.8 → 1.2.6

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 (61) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/README.md +1 -1
  3. package/config.schema.json +82 -5
  4. package/dist/accessory/AccessoryFactory.d.ts +4 -3
  5. package/dist/accessory/AccessoryFactory.js +3 -0
  6. package/dist/accessory/AccessoryFactory.js.map +1 -1
  7. package/dist/accessory/AirConditionerAccessory.d.ts +3 -0
  8. package/dist/accessory/AirConditionerAccessory.js +91 -64
  9. package/dist/accessory/AirConditionerAccessory.js.map +1 -1
  10. package/dist/accessory/BaseAccessory.d.ts +2 -0
  11. package/dist/accessory/BaseAccessory.js +14 -0
  12. package/dist/accessory/BaseAccessory.js.map +1 -1
  13. package/dist/accessory/DehumidifierAccessory.js +23 -18
  14. package/dist/accessory/DehumidifierAccessory.js.map +1 -1
  15. package/dist/accessory/ElectricWaterHeaterAccessory.js +9 -8
  16. package/dist/accessory/ElectricWaterHeaterAccessory.js.map +1 -1
  17. package/dist/accessory/GasWaterHeaterAccessory.js +20 -20
  18. package/dist/accessory/GasWaterHeaterAccessory.js.map +1 -1
  19. package/dist/accessory/HeatPumpWaterHeaterAccessory.d.ts +45 -0
  20. package/dist/accessory/HeatPumpWaterHeaterAccessory.js +186 -0
  21. package/dist/accessory/HeatPumpWaterHeaterAccessory.js.map +1 -0
  22. package/dist/core/MideaConstants.d.ts +1 -0
  23. package/dist/core/MideaConstants.js +2 -0
  24. package/dist/core/MideaConstants.js.map +1 -1
  25. package/dist/core/MideaPacketBuilder.js +2 -2
  26. package/dist/core/MideaPacketBuilder.js.map +1 -1
  27. package/dist/devices/DeviceFactory.d.ts +2 -1
  28. package/dist/devices/DeviceFactory.js +5 -2
  29. package/dist/devices/DeviceFactory.js.map +1 -1
  30. package/dist/devices/a1/MideaA1Device.d.ts +1 -1
  31. package/dist/devices/a1/MideaA1Device.js +1 -1
  32. package/dist/devices/a1/MideaA1Device.js.map +1 -1
  33. package/dist/devices/ac/MideaACMessage.d.ts +6 -0
  34. package/dist/devices/ac/MideaACMessage.js +37 -10
  35. package/dist/devices/ac/MideaACMessage.js.map +1 -1
  36. package/dist/devices/c3/MideaC3Device.d.ts +3 -2
  37. package/dist/devices/c3/MideaC3Device.js +20 -7
  38. package/dist/devices/c3/MideaC3Device.js.map +1 -1
  39. package/dist/devices/c3/MideaC3Message.d.ts +128 -12
  40. package/dist/devices/c3/MideaC3Message.js +283 -35
  41. package/dist/devices/c3/MideaC3Message.js.map +1 -1
  42. package/dist/devices/cd/MideaCDDevice.d.ts +43 -0
  43. package/dist/devices/cd/MideaCDDevice.js +115 -0
  44. package/dist/devices/cd/MideaCDDevice.js.map +1 -0
  45. package/dist/devices/cd/MideaCDMessage.d.ts +100 -0
  46. package/dist/devices/cd/MideaCDMessage.js +235 -0
  47. package/dist/devices/cd/MideaCDMessage.js.map +1 -0
  48. package/dist/devices/ce/MideaCEDevice.js +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/platform.d.ts +3 -0
  51. package/dist/platform.js +0 -11
  52. package/dist/platform.js.map +1 -1
  53. package/dist/platformUtils.d.ts +12 -0
  54. package/dist/platformUtils.js +11 -0
  55. package/dist/platformUtils.js.map +1 -1
  56. package/docs/download_lua.md +3 -2
  57. package/homebridge-ui/public/index.html +17 -14
  58. package/homebridge-ui/server.js +6 -2
  59. package/package.json +7 -8
  60. package/.zed/settings.json +0 -12
  61. package/ac.lua +0 -5150
package/CHANGELOG.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # Changelog
2
2
 
3
3
  # v1.2.6
4
- - feat: added support for `Fresh Air Appliance` (fixes #118)
4
+ - feat: added partial support for `Fresh Air Appliance` (issue #118)
5
5
  - feat: added sleep mode switch for `Air Conditioner` (fixes #128)
6
+ - feat: added comfort mode switch for `Air Conditioner` (fixes #132)
7
+ - feat: added support for `Heat Pump Water Heater` (fixes #125)
8
+ - fix: store and display name of sub-service if it's changed from the Home app (fixed #120)
9
+ - you might have duplicated accessories because of this, please delete the cached accessories for this plugin to remove them
10
+ - you can do this from the Homebridge UI: three dots in the top right side -> Settings -> scroll down to the bottom and there will be a `Remove Single Accessory` button -> use that and remove everything which is connected to the plugin `homebridge-midea-platform`
6
11
 
7
12
  # v1.2.5
8
13
  - fix: getting tokens/key for devices
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![npm](https://badgen.net/npm/v/homebridge-midea-platform)](https://www.npmjs.com/package/homebridge-midea-platform)
9
9
  [![npm](https://badgen.net/npm/dt/homebridge-midea-platform?label=downloads)](https://www.npmjs.com/package/homebridge-midea-platform)
10
10
 
11
- *Verified* plugin for Midea devices. This is implemented by building on the Homebridge platform plugin template and the work done by [@georgezhao2010](https://github.com/georgezhao2010) in the [midea_ac_lan](https://github.com/georgezhao2010/midea_ac_lan) project for Home Assistant. Also thanks to the work done by [@mill1000](https://github.com/mill1000) in the [midea-msmart (msmart-ng)](https://github.com/mill1000/midea-msmart) project.
11
+ *Verified* plugin for Midea devices. This is implemented by building on the Homebridge platform plugin template and the work done by [@georgezhao2010](https://github.com/georgezhao2010) in the [midea_ac_lan](https://github.com/georgezhao2010/midea_ac_lan) project for Home Assistant and the project [midea-local](https://github.com/midea-lan/midea-local). Also thanks to the work done by [@mill1000](https://github.com/mill1000) in the [midea-msmart (msmart-ng)](https://github.com/mill1000/midea-msmart) project.
12
12
 
13
13
  Pull requests and/or other offers of development assistance gratefully received.
14
14
 
@@ -45,6 +45,7 @@
45
45
  "Fresh Air Appliance",
46
46
  "Front Load Washer",
47
47
  "Gas Water Heater",
48
+ "Heat Pump Water Heater",
48
49
  "Heat Pump WiFi Controller",
49
50
  "Humidifier"
50
51
  ],
@@ -300,6 +301,11 @@
300
301
  "title": "Sleep Mode Switch",
301
302
  "description": "Toggles if the sleep mode switch is created with the accessory.",
302
303
  "type": "boolean"
304
+ },
305
+ "comfortModeSwitch": {
306
+ "title": "Comfort Mode Switch",
307
+ "description": "Toggles if the comfort mode switch is created with the accessory.",
308
+ "type": "boolean"
303
309
  }
304
310
  }
305
311
  },
@@ -347,11 +353,59 @@
347
353
  }
348
354
  }
349
355
  },
356
+ "CD_options": {
357
+ "title": "Heat Pump Water Heater Options",
358
+ "type": "object",
359
+ "condition": {
360
+ "functionBody": "return model.devices && model.devices[arrayIndices].type === 'Heat Pump Water Heater';"
361
+ },
362
+ "properties": {
363
+ "minTemp": {
364
+ "title": "Minimum Temperature (°C)",
365
+ "type": "number"
366
+ },
367
+ "maxTemp": {
368
+ "title": "Maximum Temperature (°C)",
369
+ "type": "number"
370
+ },
371
+ "tempStep": {
372
+ "title": "Temperature Step (°C)",
373
+ "type": "number",
374
+ "required": true,
375
+ "enum": [0.5, 1]
376
+ },
377
+ "energySaveModeSwitch": {
378
+ "title": "Energy Save Mode Switch",
379
+ "description": "Toggles if the energy save mode switch is created with the accessory.",
380
+ "type": "boolean"
381
+ },
382
+ "standardModeSwitch": {
383
+ "title": "Standard Mode Switch",
384
+ "description": "Toggles if the standard mode switch is created with the accessory.",
385
+ "type": "boolean"
386
+ },
387
+ "eHeaterModeSwitch": {
388
+ "title": "E-Heater Mode Switch",
389
+ "description": "Toggles if the e-heater mode switch is created with the accessory.",
390
+ "type": "boolean"
391
+ },
392
+ "smartModeSwitch": {
393
+ "title": "Smart Mode Switch",
394
+ "description": "Toggles if the smart mode switch is created with the accessory.",
395
+ "type": "boolean"
396
+ },
397
+ "disinfectionSwitch": {
398
+ "title": "Disinfection Mode Switch",
399
+ "description": "Toggles if the disinfection mode switch is created with the accessory.",
400
+ "type": "boolean"
401
+ }
402
+ }
403
+ },
350
404
  "CE_options": {
351
- "title": "Top Load Washer Options",
405
+ "title": "Fresh Air Appliance Options",
352
406
  "type": "object",
353
407
  "condition": {
354
- "functionBody": "return model.devices && model.devices[arrayIndices].type === 'Top Load Washer';"
408
+ "functionBody": "return model.devices && model.devices[arrayIndices].type === 'Fresh Air Appliance';"
355
409
  },
356
410
  "properties": {
357
411
  "silentMode": {
@@ -566,7 +620,11 @@
566
620
  "items": [
567
621
  {
568
622
  "key": "devices[].AC_options.swing",
569
- "items": ["devices[].AC_options.swing.mode", "devices[].AC_options.swing.angleAccessory", "devices[].AC_options.swing.angleMainControl"]
623
+ "items": [
624
+ "devices[].AC_options.swing.mode",
625
+ "devices[].AC_options.swing.angleAccessory",
626
+ "devices[].AC_options.swing.angleMainControl"
627
+ ]
570
628
  },
571
629
  "devices[].AC_options.heatingCapable",
572
630
  "devices[].AC_options.outDoorTemp",
@@ -582,7 +640,10 @@
582
640
  "devices[].AC_options.rateSelector",
583
641
  {
584
642
  "key": "devices[].AC_options.displaySwitch",
585
- "items": ["devices[].AC_options.displaySwitch.flag", "devices[].AC_options.displaySwitch.command"]
643
+ "items": [
644
+ "devices[].AC_options.displaySwitch.flag",
645
+ "devices[].AC_options.displaySwitch.command"
646
+ ]
586
647
  },
587
648
  "devices[].AC_options.minTemp",
588
649
  "devices[].AC_options.maxTemp",
@@ -590,7 +651,8 @@
590
651
  "devices[].AC_options.fahrenheit",
591
652
  "devices[].AC_options.fanOnlyModeSwitch",
592
653
  "devices[].AC_options.fanAccessory",
593
- "devices[].AC_options.sleepModeSwitch"
654
+ "devices[].AC_options.sleepModeSwitch",
655
+ "devices[].AC_options.comfortModeSwitch"
594
656
  ]
595
657
  },
596
658
  {
@@ -607,6 +669,21 @@
607
669
  "devices[].C3_options.disinfectSwitch"
608
670
  ]
609
671
  },
672
+ {
673
+ "key": "devices[].CD_options",
674
+ "expandable": true,
675
+ "expanded": false,
676
+ "items": [
677
+ "devices[].CD_options.minTemp",
678
+ "devices[].CD_options.maxTemp",
679
+ "devices[].CD_options.tempStep",
680
+ "devices[].CD_options.energySaveModeSwitch",
681
+ "devices[].CD_options.standardModeSwitch",
682
+ "devices[].CD_options.eHeaterModeSwitch",
683
+ "devices[].CD_options.smartModeSwitch",
684
+ "devices[].CD_options.disinfectionSwitch"
685
+ ]
686
+ },
610
687
  {
611
688
  "key": "devices[].CE_options",
612
689
  "expandable": true,
@@ -1,4 +1,6 @@
1
+ import type MideaDevice from '../core/MideaDevice.js';
1
2
  import type { MideaAccessory, MideaPlatform } from '../platform.js';
3
+ import type { DeviceConfig } from '../platformUtils.js';
2
4
  import AirConditionerAccessory from './AirConditionerAccessory.js';
3
5
  import DehumidifierAccessory from './DehumidifierAccessory.js';
4
6
  import FrontLoadWasherAccessory from './FrontLoadWasherAccessory.js';
@@ -9,8 +11,7 @@ import DishwasherAccessory from './DishwasherAccessory.js';
9
11
  import HeatPumpWiFiControllerAccessory from './HeatPumpWiFiControllerAccessory.js';
10
12
  import HumidifierAccessory from './HumidifierAccessory.js';
11
13
  import FreshAirApplianceAccessory from './FreshAirApplianceAccessory.js';
12
- import type MideaDevice from '../core/MideaDevice.js';
13
- import type { DeviceConfig } from '../platformUtils.js';
14
+ import HeatPumpWaterHeaterAccessory from './HeatPumpWaterHeaterAccessory.js';
14
15
  export default class AccessoryFactory {
15
- static createAccessory<T extends MideaDevice>(platform: MideaPlatform, accessory: MideaAccessory, device: T, configDev: DeviceConfig): AirConditionerAccessory | DehumidifierAccessory | FrontLoadWasherAccessory | ElectricWaterHeaterAccessory | GasWaterHeaterAccessory | FanAccessory | DishwasherAccessory | HeatPumpWiFiControllerAccessory | HumidifierAccessory | FreshAirApplianceAccessory;
16
+ static createAccessory<T extends MideaDevice>(platform: MideaPlatform, accessory: MideaAccessory, device: T, configDev: DeviceConfig): AirConditionerAccessory | DehumidifierAccessory | FrontLoadWasherAccessory | ElectricWaterHeaterAccessory | GasWaterHeaterAccessory | FanAccessory | DishwasherAccessory | HeatPumpWiFiControllerAccessory | HumidifierAccessory | FreshAirApplianceAccessory | HeatPumpWaterHeaterAccessory;
16
17
  }
@@ -9,6 +9,7 @@ import DishwasherAccessory from './DishwasherAccessory.js';
9
9
  import HeatPumpWiFiControllerAccessory from './HeatPumpWiFiControllerAccessory.js';
10
10
  import HumidifierAccessory from './HumidifierAccessory.js';
11
11
  import FreshAirApplianceAccessory from './FreshAirApplianceAccessory.js';
12
+ import HeatPumpWaterHeaterAccessory from './HeatPumpWaterHeaterAccessory.js';
12
13
  // biome-ignore lint/complexity/noStaticOnlyClass: static class is used for factory
13
14
  export default class AccessoryFactory {
14
15
  static createAccessory(platform, accessory, device, configDev) {
@@ -33,6 +34,8 @@ export default class AccessoryFactory {
33
34
  return new HumidifierAccessory(platform, accessory, device, configDev);
34
35
  case DeviceType.FRESH_AIR_APPLIANCE:
35
36
  return new FreshAirApplianceAccessory(platform, accessory, device, configDev);
37
+ case DeviceType.HEAT_PUMP_WATER_HEATER:
38
+ return new HeatPumpWaterHeaterAccessory(platform, accessory, device, configDev);
36
39
  default:
37
40
  throw new Error(`Unsupported device type: ${device.type}`);
38
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AccessoryFactory.js","sourceRoot":"","sources":["../../src/accessory/AccessoryFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAIvD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAG/D,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAGrE,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAG7E,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAG7C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAG3D,OAAO,+BAA+B,MAAM,sCAAsC,CAAC;AAGnF,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAG3D,OAAO,0BAA0B,MAAM,iCAAiC,CAAC;AAKzE,mFAAmF;AACnF,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAC5B,MAAM,CAAC,eAAe,CAAwB,QAAuB,EAAE,SAAyB,EAAE,MAAS,EAAE,SAAuB;QACzI,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,UAAU,CAAC,YAAY;gBAC1B,OAAO,IAAI,qBAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACvG,KAAK,UAAU,CAAC,eAAe;gBAC7B,OAAO,IAAI,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACzG,KAAK,UAAU,CAAC,yBAAyB;gBACvC,OAAO,IAAI,+BAA+B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACjH,KAAK,UAAU,CAAC,iBAAiB;gBAC/B,OAAO,IAAI,wBAAwB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC1G,KAAK,UAAU,CAAC,UAAU;gBACxB,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACrG,KAAK,UAAU,CAAC,qBAAqB;gBACnC,OAAO,IAAI,4BAA4B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC9G,KAAK,UAAU,CAAC,gBAAgB;gBAC9B,OAAO,IAAI,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACzG,KAAK,UAAU,CAAC,GAAG;gBACjB,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC9F,KAAK,UAAU,CAAC,UAAU;gBACxB,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACrG,KAAK,UAAU,CAAC,mBAAmB;gBACjC,OAAO,IAAI,0BAA0B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC5G;gBACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"AccessoryFactory.js","sourceRoot":"","sources":["../../src/accessory/AccessoryFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAMvD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAG/D,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAGrE,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAG7E,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAGnE,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAG7C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAG3D,OAAO,+BAA+B,MAAM,sCAAsC,CAAC;AAGnF,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAG3D,OAAO,0BAA0B,MAAM,iCAAiC,CAAC;AAGzE,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAE7E,mFAAmF;AACnF,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAC5B,MAAM,CAAC,eAAe,CAAwB,QAAuB,EAAE,SAAyB,EAAE,MAAS,EAAE,SAAuB;QACzI,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,UAAU,CAAC,YAAY;gBAC1B,OAAO,IAAI,qBAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACvG,KAAK,UAAU,CAAC,eAAe;gBAC7B,OAAO,IAAI,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACzG,KAAK,UAAU,CAAC,yBAAyB;gBACvC,OAAO,IAAI,+BAA+B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACjH,KAAK,UAAU,CAAC,iBAAiB;gBAC/B,OAAO,IAAI,wBAAwB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC1G,KAAK,UAAU,CAAC,UAAU;gBACxB,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACrG,KAAK,UAAU,CAAC,qBAAqB;gBACnC,OAAO,IAAI,4BAA4B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC9G,KAAK,UAAU,CAAC,gBAAgB;gBAC9B,OAAO,IAAI,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACzG,KAAK,UAAU,CAAC,GAAG;gBACjB,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC9F,KAAK,UAAU,CAAC,UAAU;gBACxB,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YACrG,KAAK,UAAU,CAAC,mBAAmB;gBACjC,OAAO,IAAI,0BAA0B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC5G,KAAK,UAAU,CAAC,sBAAsB;gBACpC,OAAO,IAAI,4BAA4B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAkC,EAAE,SAAS,CAAC,CAAC;YAC9G;gBACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF"}
@@ -33,6 +33,7 @@ export default class AirConditionerAccessory extends BaseAccessory<MideaACDevice
33
33
  private rateSelectService?;
34
34
  private sleepModeService?;
35
35
  private swingAngleService?;
36
+ private comfortModeService?;
36
37
  private swingAngleMainControl;
37
38
  /*********************************************************************
38
39
  * Constructor registers all the service types with Homebridge, registers
@@ -99,4 +100,6 @@ export default class AirConditionerAccessory extends BaseAccessory<MideaACDevice
99
100
  setSwingAngleTargetVerticalTiltAngle(value: CharacteristicValue): Promise<void>;
100
101
  getSleepMode(): CharacteristicValue;
101
102
  setSleepMode(value: CharacteristicValue): Promise<void>;
103
+ getComfortMode(): CharacteristicValue;
104
+ setComfortMode(value: CharacteristicValue): Promise<void>;
102
105
  }
@@ -1,5 +1,21 @@
1
1
  import { SwingAngle, SwingMode } from '../platformUtils.js';
2
- import BaseAccessory from './BaseAccessory.js';
2
+ import BaseAccessory, { limitValue } from './BaseAccessory.js';
3
+ const outDoorTemperatureSubtype = 'outdoor';
4
+ const displaySubtype = 'display';
5
+ const fanOnlySubtype = 'fanOnly';
6
+ const fanSubtype = 'fan';
7
+ const ecoModeSubtype = 'ecoMode';
8
+ const breezeAwaySubtype = 'breezeAway';
9
+ const dryModeSubtype = 'dryMode';
10
+ const boostModeSubtype = 'boostMode';
11
+ const auxSubtype = 'aux';
12
+ const auxHeatingSubtype = 'auxHeating';
13
+ const selfCleanSubtype = 'selfClean';
14
+ const ionSubtype = 'ion';
15
+ const rateSelectSubtype = 'rateSelect';
16
+ const sleepModeSubtype = 'sleepMode';
17
+ const swingAngleSubtype = 'swingAngle';
18
+ const comfortModeSubtype = 'comfortMode';
3
19
  export default class AirConditionerAccessory extends BaseAccessory {
4
20
  device;
5
21
  configDev;
@@ -19,6 +35,7 @@ export default class AirConditionerAccessory extends BaseAccessory {
19
35
  rateSelectService;
20
36
  sleepModeService;
21
37
  swingAngleService;
38
+ comfortModeService;
22
39
  swingAngleMainControl;
23
40
  /*********************************************************************
24
41
  * Constructor registers all the service types with Homebridge, registers
@@ -74,11 +91,10 @@ export default class AirConditionerAccessory extends BaseAccessory {
74
91
  this.service.getCharacteristic(this.platform.Characteristic.SwingMode).onGet(this.getSwingMode.bind(this)).onSet(this.setSwingMode.bind(this));
75
92
  }
76
93
  // Outdoor temperature sensor
77
- this.outDoorTemperatureService = this.accessory.getServiceById(this.platform.Service.TemperatureSensor, 'Outdoor');
94
+ this.outDoorTemperatureService = this.accessory.getServiceById(this.platform.Service.TemperatureSensor, outDoorTemperatureSubtype);
78
95
  if (this.configDev.AC_options.outDoorTemp) {
79
- this.outDoorTemperatureService ??= this.accessory.addService(this.platform.Service.TemperatureSensor, `${this.device.name} Outdoor`, 'Outdoor');
80
- this.outDoorTemperatureService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Outdoor`);
81
- this.outDoorTemperatureService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Outdoor`);
96
+ this.outDoorTemperatureService ??= this.accessory.addService(this.platform.Service.TemperatureSensor, undefined, outDoorTemperatureSubtype);
97
+ this.handleConfiguredName(this.outDoorTemperatureService, outDoorTemperatureSubtype, 'Outdoor');
82
98
  this.outDoorTemperatureService.getCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(this.getOutdoorTemperature.bind(this));
83
99
  this.outDoorTemperatureService
84
100
  .getCharacteristic(this.platform.Characteristic.StatusFault)
@@ -90,22 +106,20 @@ export default class AirConditionerAccessory extends BaseAccessory {
90
106
  this.accessory.removeService(this.outDoorTemperatureService);
91
107
  }
92
108
  // Fan-only mode switch
93
- this.fanOnlyService = this.accessory.getServiceById(this.platform.Service.Switch, 'FanOnly');
109
+ this.fanOnlyService = this.accessory.getServiceById(this.platform.Service.Switch, fanOnlySubtype);
94
110
  if (this.configDev.AC_options.fanOnlyModeSwitch) {
95
- this.fanOnlyService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} FanOnly`, 'FanOnly');
96
- this.fanOnlyService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Fan-only Mode`);
97
- this.fanOnlyService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Fan-only Mode`);
111
+ this.fanOnlyService ??= this.accessory.addService(this.platform.Service.Switch, undefined, fanOnlySubtype);
112
+ this.handleConfiguredName(this.fanOnlyService, fanOnlySubtype, 'Fan-only Mode');
98
113
  this.fanOnlyService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getFanOnlyMode.bind(this)).onSet(this.setFanOnlyMode.bind(this));
99
114
  }
100
115
  else if (this.fanOnlyService) {
101
116
  this.accessory.removeService(this.fanOnlyService);
102
117
  }
103
118
  // Fan accessory
104
- this.fanService = this.accessory.getServiceById(this.platform.Service.Fanv2, 'Fan');
119
+ this.fanService = this.accessory.getServiceById(this.platform.Service.Fanv2, fanSubtype);
105
120
  if (this.configDev.AC_options.fanAccessory) {
106
- this.fanService ??= this.accessory.addService(this.platform.Service.Fanv2, `${this.device.name} Fan`, 'Fan');
107
- this.fanService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Fan`);
108
- this.fanService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Fan`);
121
+ this.fanService ??= this.accessory.addService(this.platform.Service.Fanv2, undefined, fanSubtype);
122
+ this.handleConfiguredName(this.fanService, fanSubtype, 'Fan');
109
123
  this.fanService.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
110
124
  this.fanService
111
125
  .getCharacteristic(this.platform.Characteristic.RotationSpeed)
@@ -118,88 +132,81 @@ export default class AirConditionerAccessory extends BaseAccessory {
118
132
  this.accessory.removeService(this.fanService);
119
133
  }
120
134
  // Display switch
121
- this.displayService = this.accessory.getServiceById(this.platform.Service.Switch, 'Display');
135
+ this.displayService = this.accessory.getServiceById(this.platform.Service.Switch, displaySubtype);
122
136
  if (this.configDev.AC_options.displaySwitch.flag) {
123
137
  this.device.set_alternate_switch_display(this.configDev.AC_options.displaySwitch.command);
124
- this.displayService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Display`, 'Display');
125
- this.displayService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Display`);
126
- this.displayService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Display`);
138
+ this.displayService ??= this.accessory.addService(this.platform.Service.Switch, undefined, displaySubtype);
139
+ this.handleConfiguredName(this.displayService, displaySubtype, 'Display');
127
140
  this.displayService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getDisplayActive.bind(this)).onSet(this.setDisplayActive.bind(this));
128
141
  }
129
142
  else if (this.displayService) {
130
143
  this.accessory.removeService(this.displayService);
131
144
  }
132
145
  // Eco mode switch
133
- this.ecoModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'EcoMode');
146
+ this.ecoModeService = this.accessory.getServiceById(this.platform.Service.Switch, ecoModeSubtype);
134
147
  if (this.configDev.AC_options.ecoSwitch) {
135
- this.ecoModeService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Eco`, 'EcoMode');
136
- this.ecoModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Eco`);
137
- this.ecoModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Eco`);
148
+ this.ecoModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, ecoModeSubtype);
149
+ this.handleConfiguredName(this.ecoModeService, ecoModeSubtype, 'Eco');
138
150
  this.ecoModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getEcoMode.bind(this)).onSet(this.setEcoMode.bind(this));
139
151
  }
140
152
  else if (this.ecoModeService) {
141
153
  this.accessory.removeService(this.ecoModeService);
142
154
  }
143
155
  // Breeze away switch
144
- this.breezeAwayService = this.accessory.getServiceById(this.platform.Service.Switch, 'BreezeAway');
156
+ this.breezeAwayService = this.accessory.getServiceById(this.platform.Service.Switch, breezeAwaySubtype);
145
157
  if (this.configDev.AC_options.breezeAwaySwitch) {
146
- this.breezeAwayService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Breeze`, 'BreezeAway');
147
- this.breezeAwayService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Breeze`);
148
- this.breezeAwayService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Breeze`);
158
+ this.breezeAwayService ??= this.accessory.addService(this.platform.Service.Switch, undefined, breezeAwaySubtype);
159
+ this.handleConfiguredName(this.breezeAwayService, breezeAwaySubtype, 'Breeze');
149
160
  this.breezeAwayService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getBreezeAway.bind(this)).onSet(this.setBreezeAway.bind(this));
150
161
  }
151
162
  else if (this.breezeAwayService) {
152
163
  this.accessory.removeService(this.breezeAwayService);
153
164
  }
154
165
  // Dry mode switch
155
- this.dryModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'DryMode');
166
+ this.dryModeService = this.accessory.getServiceById(this.platform.Service.Switch, dryModeSubtype);
156
167
  if (this.configDev.AC_options.dryModeSwitch) {
157
- this.dryModeService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Dry`, 'DryMode');
158
- this.dryModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Dry`);
159
- this.dryModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Dry`);
168
+ this.dryModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, dryModeSubtype);
169
+ this.handleConfiguredName(this.dryModeService, dryModeSubtype, 'Dry');
160
170
  this.dryModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getDryMode.bind(this)).onSet(this.setDryMode.bind(this));
161
171
  }
162
172
  else if (this.dryModeService) {
163
173
  this.accessory.removeService(this.dryModeService);
164
174
  }
165
- this.boostModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'BoostMode');
175
+ // Boost mode switch
176
+ this.boostModeService = this.accessory.getServiceById(this.platform.Service.Switch, boostModeSubtype);
166
177
  if (this.configDev.AC_options.boostModeSwitch) {
167
- this.boostModeService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Boost`, 'BoostMode');
168
- this.boostModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Boost`);
169
- this.boostModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Boost`);
178
+ this.boostModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, boostModeSubtype);
179
+ this.handleConfiguredName(this.boostModeService, boostModeSubtype, 'Boost');
170
180
  this.boostModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getBoostMode.bind(this)).onSet(this.setBoostMode.bind(this));
171
181
  }
172
182
  else if (this.boostModeService) {
173
183
  this.accessory.removeService(this.boostModeService);
174
184
  }
175
185
  // Aux switch
176
- this.auxService = this.accessory.getServiceById(this.platform.Service.Switch, 'Aux');
186
+ this.auxService = this.accessory.getServiceById(this.platform.Service.Switch, auxSubtype);
177
187
  if (this.configDev.AC_options.auxHeatingSwitches) {
178
- this.auxService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Aux`, 'Aux');
179
- this.auxService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Aux`);
180
- this.auxService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Aux`);
188
+ this.auxService ??= this.accessory.addService(this.platform.Service.Switch, undefined, auxSubtype);
189
+ this.handleConfiguredName(this.auxService, auxSubtype, 'Aux');
181
190
  this.auxService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getAux.bind(this)).onSet(this.setAux.bind(this));
182
191
  }
183
192
  else if (this.auxService) {
184
193
  this.accessory.removeService(this.auxService);
185
194
  }
186
195
  // Aux+Heat switch
187
- this.auxHeatingService = this.accessory.getServiceById(this.platform.Service.Switch, 'AuxHeating');
196
+ this.auxHeatingService = this.accessory.getServiceById(this.platform.Service.Switch, auxHeatingSubtype);
188
197
  if (this.configDev.AC_options.auxHeatingSwitches) {
189
- this.auxHeatingService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Aux+Heat`, 'AuxHeating');
190
- this.auxHeatingService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Aux+Heat`);
191
- this.auxHeatingService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Aux+Heat`);
198
+ this.auxHeatingService ??= this.accessory.addService(this.platform.Service.Switch, undefined, auxHeatingSubtype);
199
+ this.handleConfiguredName(this.auxHeatingService, auxHeatingSubtype, 'Aux+Heat');
192
200
  this.auxHeatingService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getAuxHeating.bind(this)).onSet(this.setAuxHeating.bind(this));
193
201
  }
194
202
  else if (this.auxHeatingService) {
195
203
  this.accessory.removeService(this.auxHeatingService);
196
204
  }
197
205
  // Self-cleaning switch
198
- this.selfCleanService = this.accessory.getServiceById(this.platform.Service.Switch, 'SelfClean');
206
+ this.selfCleanService = this.accessory.getServiceById(this.platform.Service.Switch, selfCleanSubtype);
199
207
  if (this.configDev.AC_options.selfCleanSwitch) {
200
- this.selfCleanService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Self-cleaning`, 'SelfClean');
201
- this.selfCleanService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Self-cleaning`);
202
- this.selfCleanService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Self-cleaning`);
208
+ this.selfCleanService ??= this.accessory.addService(this.platform.Service.Switch, undefined, selfCleanSubtype);
209
+ this.handleConfiguredName(this.selfCleanService, selfCleanSubtype, 'Self-cleaning');
203
210
  this.selfCleanService
204
211
  .getCharacteristic(this.platform.Characteristic.On)
205
212
  .onGet(this.getSelfCleanState.bind(this))
@@ -209,22 +216,20 @@ export default class AirConditionerAccessory extends BaseAccessory {
209
216
  this.accessory.removeService(this.selfCleanService);
210
217
  }
211
218
  // ION switch
212
- this.ionService = this.accessory.getServiceById(this.platform.Service.Switch, 'ION');
219
+ this.ionService = this.accessory.getServiceById(this.platform.Service.Switch, ionSubtype);
213
220
  if (this.configDev.AC_options.ionSwitch) {
214
- this.ionService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} ION`, 'ION');
215
- this.ionService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} ION`);
216
- this.ionService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} ION`);
221
+ this.ionService ??= this.accessory.addService(this.platform.Service.Switch, undefined, ionSubtype);
222
+ this.handleConfiguredName(this.ionService, ionSubtype, 'ION');
217
223
  this.ionService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getIonState.bind(this)).onSet(this.setIonState.bind(this));
218
224
  }
219
225
  else if (this.ionService) {
220
226
  this.accessory.removeService(this.ionService);
221
227
  }
222
228
  // Rate select slider
223
- this.rateSelectService = this.accessory.getServiceById(this.platform.Service.Lightbulb, 'Gear');
229
+ this.rateSelectService = this.accessory.getServiceById(this.platform.Service.Lightbulb, rateSelectSubtype);
224
230
  if (this.configDev.AC_options.rateSelector) {
225
- this.rateSelectService ??= this.accessory.addService(this.platform.Service.Lightbulb, `${this.device.name} Gear`, 'Gear');
226
- this.rateSelectService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Gear`);
227
- this.rateSelectService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Gear`);
231
+ this.rateSelectService ??= this.accessory.addService(this.platform.Service.Lightbulb, undefined, rateSelectSubtype);
232
+ this.handleConfiguredName(this.rateSelectService, rateSelectSubtype, 'Gear');
228
233
  this.rateSelectService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
229
234
  this.rateSelectService
230
235
  .getCharacteristic(this.platform.Characteristic.Brightness)
@@ -238,26 +243,34 @@ export default class AirConditionerAccessory extends BaseAccessory {
238
243
  this.accessory.removeService(this.rateSelectService);
239
244
  }
240
245
  // Sleep mode accessory
241
- this.sleepModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'SleepMode');
246
+ this.sleepModeService = this.accessory.getServiceById(this.platform.Service.Switch, sleepModeSubtype);
242
247
  if (this.configDev.AC_options.sleepModeSwitch) {
243
- this.sleepModeService ??= this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Sleep`, 'SleepMode');
244
- this.sleepModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Sleep`);
248
+ this.sleepModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, sleepModeSubtype);
249
+ this.handleConfiguredName(this.sleepModeService, sleepModeSubtype, 'Sleep');
245
250
  this.sleepModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getSleepMode.bind(this)).onSet(this.setSleepMode.bind(this));
246
251
  }
247
252
  else if (this.sleepModeService) {
248
253
  this.accessory.removeService(this.sleepModeService);
249
254
  }
255
+ this.comfortModeService = this.accessory.getServiceById(this.platform.Service.Switch, comfortModeSubtype);
256
+ if (this.configDev.AC_options.comfortModeSwitch) {
257
+ this.comfortModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, comfortModeSubtype);
258
+ this.handleConfiguredName(this.comfortModeService, comfortModeSubtype, 'Comfort');
259
+ this.comfortModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getComfortMode.bind(this)).onSet(this.setComfortMode.bind(this));
260
+ }
261
+ else if (this.comfortModeService) {
262
+ this.accessory.removeService(this.comfortModeService);
263
+ }
250
264
  const swingProps = this.configDev.AC_options.swing;
251
265
  this.swingAngleMainControl =
252
266
  swingProps.mode === SwingMode.VERTICAL || (swingProps.mode === SwingMode.BOTH && swingProps.angleMainControl === SwingAngle.VERTICAL)
253
267
  ? SwingAngle.VERTICAL
254
268
  : SwingAngle.HORIZONTAL;
255
269
  // Swing angle accessory
256
- this.swingAngleService = this.accessory.getServiceById(this.platform.Service.WindowCovering, 'SwingAngle');
270
+ this.swingAngleService = this.accessory.getServiceById(this.platform.Service.WindowCovering, swingAngleSubtype);
257
271
  if (swingProps.mode !== SwingMode.NONE && swingProps.angleAccessory) {
258
- this.swingAngleService ??= this.accessory.addService(this.platform.Service.WindowCovering, `${this.device.name} Swing`, 'SwingAngle');
259
- this.swingAngleService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Swing`);
260
- this.swingAngleService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Swing`);
272
+ this.swingAngleService ??= this.accessory.addService(this.platform.Service.WindowCovering, undefined, swingAngleSubtype);
273
+ this.handleConfiguredName(this.swingAngleService, swingAngleSubtype, 'Swing');
261
274
  this.swingAngleService.getCharacteristic(this.platform.Characteristic.CurrentPosition).onGet(this.getSwingAngleCurrentPosition.bind(this));
262
275
  this.swingAngleService
263
276
  .getCharacteristic(this.platform.Characteristic.TargetPosition)
@@ -405,7 +418,9 @@ export default class AirConditionerAccessory extends BaseAccessory {
405
418
  : this.platform.Characteristic.TemperatureDisplayUnits.CELSIUS;
406
419
  }
407
420
  async setTemperatureDisplayUnits(value) {
408
- await this.device.set_attribute({ TEMP_FAHRENHEIT: value === this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT });
421
+ await this.device.set_attribute({
422
+ TEMP_FAHRENHEIT: value === this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT,
423
+ });
409
424
  }
410
425
  getCurrentHeaterCoolerState() {
411
426
  if (this.device.attributes.POWER && this.device.attributes.MODE > 0 && this.device.attributes.MODE < 5) {
@@ -451,7 +466,7 @@ export default class AirConditionerAccessory extends BaseAccessory {
451
466
  return this.device.attributes.INDOOR_TEMPERATURE ?? this.configDev.AC_options.minTemp;
452
467
  }
453
468
  getTargetTemperature() {
454
- return Math.max(this.configDev.AC_options.minTemp, Math.min(this.configDev.AC_options.maxTemp, this.device.attributes.TARGET_TEMPERATURE));
469
+ return limitValue(this.device.attributes.TARGET_TEMPERATURE, this.configDev.AC_options.minTemp, this.configDev.AC_options.maxTemp);
455
470
  }
456
471
  getFanOnlyMode() {
457
472
  return this.device.attributes.POWER === true && this.device.attributes.MODE === 5;
@@ -471,8 +486,7 @@ export default class AirConditionerAccessory extends BaseAccessory {
471
486
  await this.device.set_fan_auto(value === this.platform.Characteristic.TargetFanState.AUTO);
472
487
  }
473
488
  async setTargetTemperature(value) {
474
- const limitedValue = Math.max(this.configDev.AC_options.minTemp, Math.min(this.configDev.AC_options.maxTemp, value));
475
- await this.device.set_target_temperature(limitedValue);
489
+ await this.device.set_target_temperature(limitValue(value, this.configDev.AC_options.minTemp, this.configDev.AC_options.maxTemp));
476
490
  }
477
491
  getSwingMode() {
478
492
  return this.device.attributes.SWING_HORIZONTAL || this.device.attributes.SWING_VERTICAL
@@ -624,5 +638,18 @@ export default class AirConditionerAccessory extends BaseAccessory {
624
638
  await this.device.set_attribute({ SLEEP_MODE: false });
625
639
  }
626
640
  }
641
+ getComfortMode() {
642
+ return this.device.attributes.POWER === true && this.device.attributes.COMFORT_MODE
643
+ ? this.platform.Characteristic.Active.ACTIVE
644
+ : this.platform.Characteristic.Active.INACTIVE;
645
+ }
646
+ async setComfortMode(value) {
647
+ if (value === this.platform.Characteristic.Active.ACTIVE) {
648
+ await this.device.set_attribute({ POWER: true, COMFORT_MODE: true });
649
+ }
650
+ else {
651
+ await this.device.set_attribute({ COMFORT_MODE: false });
652
+ }
653
+ }
627
654
  }
628
655
  //# sourceMappingURL=AirConditionerAccessory.js.map