homebridge-midea-platform 1.2.6-beta.9 → 1.2.7-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.luarc.json +5 -0
  2. package/.zed/settings.json +1 -6
  3. package/CHANGELOG.md +6 -1
  4. package/README.md +1 -1
  5. package/ac_00000Q11.lua +5148 -0
  6. package/ac_00000Q1D.lua +5148 -0
  7. package/c3_HeatPump_152832116442666.lua +4681 -0
  8. package/cd_RSJ000CB.lua +4983 -0
  9. package/config.schema.json +89 -6
  10. package/dist/accessory/AccessoryFactory.d.ts +4 -3
  11. package/dist/accessory/AccessoryFactory.js +3 -0
  12. package/dist/accessory/AccessoryFactory.js.map +1 -1
  13. package/dist/accessory/AirConditionerAccessory.d.ts +4 -0
  14. package/dist/accessory/AirConditionerAccessory.js +104 -64
  15. package/dist/accessory/AirConditionerAccessory.js.map +1 -1
  16. package/dist/accessory/BaseAccessory.d.ts +2 -0
  17. package/dist/accessory/BaseAccessory.js +14 -0
  18. package/dist/accessory/BaseAccessory.js.map +1 -1
  19. package/dist/accessory/DehumidifierAccessory.js +23 -18
  20. package/dist/accessory/DehumidifierAccessory.js.map +1 -1
  21. package/dist/accessory/ElectricWaterHeaterAccessory.js +9 -8
  22. package/dist/accessory/ElectricWaterHeaterAccessory.js.map +1 -1
  23. package/dist/accessory/GasWaterHeaterAccessory.js +20 -20
  24. package/dist/accessory/GasWaterHeaterAccessory.js.map +1 -1
  25. package/dist/accessory/HeatPumpWaterHeaterAccessory.d.ts +45 -0
  26. package/dist/accessory/HeatPumpWaterHeaterAccessory.js +186 -0
  27. package/dist/accessory/HeatPumpWaterHeaterAccessory.js.map +1 -0
  28. package/dist/core/MideaConstants.d.ts +1 -0
  29. package/dist/core/MideaConstants.js +2 -0
  30. package/dist/core/MideaConstants.js.map +1 -1
  31. package/dist/core/MideaPacketBuilder.js +2 -2
  32. package/dist/core/MideaPacketBuilder.js.map +1 -1
  33. package/dist/devices/DeviceFactory.d.ts +2 -1
  34. package/dist/devices/DeviceFactory.js +5 -2
  35. package/dist/devices/DeviceFactory.js.map +1 -1
  36. package/dist/devices/a1/MideaA1Device.d.ts +1 -1
  37. package/dist/devices/a1/MideaA1Device.js +1 -1
  38. package/dist/devices/a1/MideaA1Device.js.map +1 -1
  39. package/dist/devices/ac/MideaACMessage.d.ts +6 -0
  40. package/dist/devices/ac/MideaACMessage.js +37 -10
  41. package/dist/devices/ac/MideaACMessage.js.map +1 -1
  42. package/dist/devices/c3/MideaC3Device.d.ts +3 -2
  43. package/dist/devices/c3/MideaC3Device.js +20 -7
  44. package/dist/devices/c3/MideaC3Device.js.map +1 -1
  45. package/dist/devices/c3/MideaC3Message.d.ts +128 -12
  46. package/dist/devices/c3/MideaC3Message.js +283 -35
  47. package/dist/devices/c3/MideaC3Message.js.map +1 -1
  48. package/dist/devices/cd/MideaCDDevice.d.ts +43 -0
  49. package/dist/devices/cd/MideaCDDevice.js +115 -0
  50. package/dist/devices/cd/MideaCDDevice.js.map +1 -0
  51. package/dist/devices/cd/MideaCDMessage.d.ts +100 -0
  52. package/dist/devices/cd/MideaCDMessage.js +235 -0
  53. package/dist/devices/cd/MideaCDMessage.js.map +1 -0
  54. package/dist/devices/ce/MideaCEDevice.js +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/platform.d.ts +3 -0
  57. package/dist/platform.js +0 -11
  58. package/dist/platform.js.map +1 -1
  59. package/dist/platformUtils.d.ts +13 -0
  60. package/dist/platformUtils.js +12 -0
  61. package/dist/platformUtils.js.map +1 -1
  62. package/docs/download_lua.md +3 -2
  63. package/homebridge-ui/server.js +2 -0
  64. package/package.json +7 -8
@@ -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
  ],
@@ -119,7 +120,7 @@
119
120
  },
120
121
  "humiditySensor": {
121
122
  "title": "Humidity Sensor",
122
- "description": "Toggles if a seperated humidity sensor is created with the accessory. This sensor can be used for autmations as for some reason the internal humidity sensor is not usable for this.",
123
+ "description": "Toggles if a seperated humidity sensor is created with the accessory. This sensor can be used for automations as for some reason the internal humidity sensor is not usable for this.",
123
124
  "type": "boolean"
124
125
  },
125
126
  "pumpSwitch": {
@@ -300,6 +301,16 @@
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"
309
+ },
310
+ "temperatureSensor": {
311
+ "title": "Indoor Temperature Sensor",
312
+ "description": "Toggles if a seperated indoor temperature is created with the accessory. This sensor can be used for automations as for some reason the internal sensors are not usable for this.",
313
+ "type": "boolean"
303
314
  }
304
315
  }
305
316
  },
@@ -347,11 +358,59 @@
347
358
  }
348
359
  }
349
360
  },
361
+ "CD_options": {
362
+ "title": "Heat Pump Water Heater Options",
363
+ "type": "object",
364
+ "condition": {
365
+ "functionBody": "return model.devices && model.devices[arrayIndices].type === 'Heat Pump Water Heater';"
366
+ },
367
+ "properties": {
368
+ "minTemp": {
369
+ "title": "Minimum Temperature (°C)",
370
+ "type": "number"
371
+ },
372
+ "maxTemp": {
373
+ "title": "Maximum Temperature (°C)",
374
+ "type": "number"
375
+ },
376
+ "tempStep": {
377
+ "title": "Temperature Step (°C)",
378
+ "type": "number",
379
+ "required": true,
380
+ "enum": [0.5, 1]
381
+ },
382
+ "energySaveModeSwitch": {
383
+ "title": "Energy Save Mode Switch",
384
+ "description": "Toggles if the energy save mode switch is created with the accessory.",
385
+ "type": "boolean"
386
+ },
387
+ "standardModeSwitch": {
388
+ "title": "Standard Mode Switch",
389
+ "description": "Toggles if the standard mode switch is created with the accessory.",
390
+ "type": "boolean"
391
+ },
392
+ "eHeaterModeSwitch": {
393
+ "title": "E-Heater Mode Switch",
394
+ "description": "Toggles if the e-heater mode switch is created with the accessory.",
395
+ "type": "boolean"
396
+ },
397
+ "smartModeSwitch": {
398
+ "title": "Smart Mode Switch",
399
+ "description": "Toggles if the smart mode switch is created with the accessory.",
400
+ "type": "boolean"
401
+ },
402
+ "disinfectionSwitch": {
403
+ "title": "Disinfection Mode Switch",
404
+ "description": "Toggles if the disinfection mode switch is created with the accessory.",
405
+ "type": "boolean"
406
+ }
407
+ }
408
+ },
350
409
  "CE_options": {
351
- "title": "Top Load Washer Options",
410
+ "title": "Fresh Air Appliance Options",
352
411
  "type": "object",
353
412
  "condition": {
354
- "functionBody": "return model.devices && model.devices[arrayIndices].type === 'Top Load Washer';"
413
+ "functionBody": "return model.devices && model.devices[arrayIndices].type === 'Fresh Air Appliance';"
355
414
  },
356
415
  "properties": {
357
416
  "silentMode": {
@@ -566,7 +625,11 @@
566
625
  "items": [
567
626
  {
568
627
  "key": "devices[].AC_options.swing",
569
- "items": ["devices[].AC_options.swing.mode", "devices[].AC_options.swing.angleAccessory", "devices[].AC_options.swing.angleMainControl"]
628
+ "items": [
629
+ "devices[].AC_options.swing.mode",
630
+ "devices[].AC_options.swing.angleAccessory",
631
+ "devices[].AC_options.swing.angleMainControl"
632
+ ]
570
633
  },
571
634
  "devices[].AC_options.heatingCapable",
572
635
  "devices[].AC_options.outDoorTemp",
@@ -582,7 +645,10 @@
582
645
  "devices[].AC_options.rateSelector",
583
646
  {
584
647
  "key": "devices[].AC_options.displaySwitch",
585
- "items": ["devices[].AC_options.displaySwitch.flag", "devices[].AC_options.displaySwitch.command"]
648
+ "items": [
649
+ "devices[].AC_options.displaySwitch.flag",
650
+ "devices[].AC_options.displaySwitch.command"
651
+ ]
586
652
  },
587
653
  "devices[].AC_options.minTemp",
588
654
  "devices[].AC_options.maxTemp",
@@ -590,7 +656,9 @@
590
656
  "devices[].AC_options.fahrenheit",
591
657
  "devices[].AC_options.fanOnlyModeSwitch",
592
658
  "devices[].AC_options.fanAccessory",
593
- "devices[].AC_options.sleepModeSwitch"
659
+ "devices[].AC_options.sleepModeSwitch",
660
+ "devices[].AC_options.comfortModeSwitch",
661
+ "devices[].AC_options.temperatureSensor"
594
662
  ]
595
663
  },
596
664
  {
@@ -607,6 +675,21 @@
607
675
  "devices[].C3_options.disinfectSwitch"
608
676
  ]
609
677
  },
678
+ {
679
+ "key": "devices[].CD_options",
680
+ "expandable": true,
681
+ "expanded": false,
682
+ "items": [
683
+ "devices[].CD_options.minTemp",
684
+ "devices[].CD_options.maxTemp",
685
+ "devices[].CD_options.tempStep",
686
+ "devices[].CD_options.energySaveModeSwitch",
687
+ "devices[].CD_options.standardModeSwitch",
688
+ "devices[].CD_options.eHeaterModeSwitch",
689
+ "devices[].CD_options.smartModeSwitch",
690
+ "devices[].CD_options.disinfectionSwitch"
691
+ ]
692
+ },
610
693
  {
611
694
  "key": "devices[].CE_options",
612
695
  "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;AAGn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AAQ,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,8 @@ export default class AirConditionerAccessory extends BaseAccessory<MideaACDevice
33
33
  private rateSelectService?;
34
34
  private sleepModeService?;
35
35
  private swingAngleService?;
36
+ private comfortModeService?;
37
+ private temperatureSensorService?;
36
38
  private swingAngleMainControl;
37
39
  /*********************************************************************
38
40
  * Constructor registers all the service types with Homebridge, registers
@@ -99,4 +101,6 @@ export default class AirConditionerAccessory extends BaseAccessory<MideaACDevice
99
101
  setSwingAngleTargetVerticalTiltAngle(value: CharacteristicValue): Promise<void>;
100
102
  getSleepMode(): CharacteristicValue;
101
103
  setSleepMode(value: CharacteristicValue): Promise<void>;
104
+ getComfortMode(): CharacteristicValue;
105
+ setComfortMode(value: CharacteristicValue): Promise<void>;
102
106
  }
@@ -1,5 +1,22 @@
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';
19
+ const temperatureSensorSubtype = 'temperatureSensor';
3
20
  export default class AirConditionerAccessory extends BaseAccessory {
4
21
  device;
5
22
  configDev;
@@ -19,6 +36,8 @@ export default class AirConditionerAccessory extends BaseAccessory {
19
36
  rateSelectService;
20
37
  sleepModeService;
21
38
  swingAngleService;
39
+ comfortModeService;
40
+ temperatureSensorService;
22
41
  swingAngleMainControl;
23
42
  /*********************************************************************
24
43
  * Constructor registers all the service types with Homebridge, registers
@@ -74,11 +93,10 @@ export default class AirConditionerAccessory extends BaseAccessory {
74
93
  this.service.getCharacteristic(this.platform.Characteristic.SwingMode).onGet(this.getSwingMode.bind(this)).onSet(this.setSwingMode.bind(this));
75
94
  }
76
95
  // Outdoor temperature sensor
77
- this.outDoorTemperatureService = this.accessory.getServiceById(this.platform.Service.TemperatureSensor, 'Outdoor');
96
+ this.outDoorTemperatureService = this.accessory.getServiceById(this.platform.Service.TemperatureSensor, outDoorTemperatureSubtype);
78
97
  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`);
98
+ this.outDoorTemperatureService ??= this.accessory.addService(this.platform.Service.TemperatureSensor, undefined, outDoorTemperatureSubtype);
99
+ this.handleConfiguredName(this.outDoorTemperatureService, outDoorTemperatureSubtype, 'Outdoor');
82
100
  this.outDoorTemperatureService.getCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(this.getOutdoorTemperature.bind(this));
83
101
  this.outDoorTemperatureService
84
102
  .getCharacteristic(this.platform.Characteristic.StatusFault)
@@ -90,22 +108,20 @@ export default class AirConditionerAccessory extends BaseAccessory {
90
108
  this.accessory.removeService(this.outDoorTemperatureService);
91
109
  }
92
110
  // Fan-only mode switch
93
- this.fanOnlyService = this.accessory.getServiceById(this.platform.Service.Switch, 'FanOnly');
111
+ this.fanOnlyService = this.accessory.getServiceById(this.platform.Service.Switch, fanOnlySubtype);
94
112
  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`);
113
+ this.fanOnlyService ??= this.accessory.addService(this.platform.Service.Switch, undefined, fanOnlySubtype);
114
+ this.handleConfiguredName(this.fanOnlyService, fanOnlySubtype, 'Fan-only Mode');
98
115
  this.fanOnlyService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getFanOnlyMode.bind(this)).onSet(this.setFanOnlyMode.bind(this));
99
116
  }
100
117
  else if (this.fanOnlyService) {
101
118
  this.accessory.removeService(this.fanOnlyService);
102
119
  }
103
120
  // Fan accessory
104
- this.fanService = this.accessory.getServiceById(this.platform.Service.Fanv2, 'Fan');
121
+ this.fanService = this.accessory.getServiceById(this.platform.Service.Fanv2, fanSubtype);
105
122
  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`);
123
+ this.fanService ??= this.accessory.addService(this.platform.Service.Fanv2, undefined, fanSubtype);
124
+ this.handleConfiguredName(this.fanService, fanSubtype, 'Fan');
109
125
  this.fanService.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
110
126
  this.fanService
111
127
  .getCharacteristic(this.platform.Characteristic.RotationSpeed)
@@ -118,88 +134,81 @@ export default class AirConditionerAccessory extends BaseAccessory {
118
134
  this.accessory.removeService(this.fanService);
119
135
  }
120
136
  // Display switch
121
- this.displayService = this.accessory.getServiceById(this.platform.Service.Switch, 'Display');
137
+ this.displayService = this.accessory.getServiceById(this.platform.Service.Switch, displaySubtype);
122
138
  if (this.configDev.AC_options.displaySwitch.flag) {
123
139
  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`);
140
+ this.displayService ??= this.accessory.addService(this.platform.Service.Switch, undefined, displaySubtype);
141
+ this.handleConfiguredName(this.displayService, displaySubtype, 'Display');
127
142
  this.displayService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getDisplayActive.bind(this)).onSet(this.setDisplayActive.bind(this));
128
143
  }
129
144
  else if (this.displayService) {
130
145
  this.accessory.removeService(this.displayService);
131
146
  }
132
147
  // Eco mode switch
133
- this.ecoModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'EcoMode');
148
+ this.ecoModeService = this.accessory.getServiceById(this.platform.Service.Switch, ecoModeSubtype);
134
149
  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`);
150
+ this.ecoModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, ecoModeSubtype);
151
+ this.handleConfiguredName(this.ecoModeService, ecoModeSubtype, 'Eco');
138
152
  this.ecoModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getEcoMode.bind(this)).onSet(this.setEcoMode.bind(this));
139
153
  }
140
154
  else if (this.ecoModeService) {
141
155
  this.accessory.removeService(this.ecoModeService);
142
156
  }
143
157
  // Breeze away switch
144
- this.breezeAwayService = this.accessory.getServiceById(this.platform.Service.Switch, 'BreezeAway');
158
+ this.breezeAwayService = this.accessory.getServiceById(this.platform.Service.Switch, breezeAwaySubtype);
145
159
  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`);
160
+ this.breezeAwayService ??= this.accessory.addService(this.platform.Service.Switch, undefined, breezeAwaySubtype);
161
+ this.handleConfiguredName(this.breezeAwayService, breezeAwaySubtype, 'Breeze');
149
162
  this.breezeAwayService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getBreezeAway.bind(this)).onSet(this.setBreezeAway.bind(this));
150
163
  }
151
164
  else if (this.breezeAwayService) {
152
165
  this.accessory.removeService(this.breezeAwayService);
153
166
  }
154
167
  // Dry mode switch
155
- this.dryModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'DryMode');
168
+ this.dryModeService = this.accessory.getServiceById(this.platform.Service.Switch, dryModeSubtype);
156
169
  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`);
170
+ this.dryModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, dryModeSubtype);
171
+ this.handleConfiguredName(this.dryModeService, dryModeSubtype, 'Dry');
160
172
  this.dryModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getDryMode.bind(this)).onSet(this.setDryMode.bind(this));
161
173
  }
162
174
  else if (this.dryModeService) {
163
175
  this.accessory.removeService(this.dryModeService);
164
176
  }
165
- this.boostModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'BoostMode');
177
+ // Boost mode switch
178
+ this.boostModeService = this.accessory.getServiceById(this.platform.Service.Switch, boostModeSubtype);
166
179
  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`);
180
+ this.boostModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, boostModeSubtype);
181
+ this.handleConfiguredName(this.boostModeService, boostModeSubtype, 'Boost');
170
182
  this.boostModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getBoostMode.bind(this)).onSet(this.setBoostMode.bind(this));
171
183
  }
172
184
  else if (this.boostModeService) {
173
185
  this.accessory.removeService(this.boostModeService);
174
186
  }
175
187
  // Aux switch
176
- this.auxService = this.accessory.getServiceById(this.platform.Service.Switch, 'Aux');
188
+ this.auxService = this.accessory.getServiceById(this.platform.Service.Switch, auxSubtype);
177
189
  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`);
190
+ this.auxService ??= this.accessory.addService(this.platform.Service.Switch, undefined, auxSubtype);
191
+ this.handleConfiguredName(this.auxService, auxSubtype, 'Aux');
181
192
  this.auxService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getAux.bind(this)).onSet(this.setAux.bind(this));
182
193
  }
183
194
  else if (this.auxService) {
184
195
  this.accessory.removeService(this.auxService);
185
196
  }
186
197
  // Aux+Heat switch
187
- this.auxHeatingService = this.accessory.getServiceById(this.platform.Service.Switch, 'AuxHeating');
198
+ this.auxHeatingService = this.accessory.getServiceById(this.platform.Service.Switch, auxHeatingSubtype);
188
199
  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`);
200
+ this.auxHeatingService ??= this.accessory.addService(this.platform.Service.Switch, undefined, auxHeatingSubtype);
201
+ this.handleConfiguredName(this.auxHeatingService, auxHeatingSubtype, 'Aux+Heat');
192
202
  this.auxHeatingService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getAuxHeating.bind(this)).onSet(this.setAuxHeating.bind(this));
193
203
  }
194
204
  else if (this.auxHeatingService) {
195
205
  this.accessory.removeService(this.auxHeatingService);
196
206
  }
197
207
  // Self-cleaning switch
198
- this.selfCleanService = this.accessory.getServiceById(this.platform.Service.Switch, 'SelfClean');
208
+ this.selfCleanService = this.accessory.getServiceById(this.platform.Service.Switch, selfCleanSubtype);
199
209
  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`);
210
+ this.selfCleanService ??= this.accessory.addService(this.platform.Service.Switch, undefined, selfCleanSubtype);
211
+ this.handleConfiguredName(this.selfCleanService, selfCleanSubtype, 'Self-cleaning');
203
212
  this.selfCleanService
204
213
  .getCharacteristic(this.platform.Characteristic.On)
205
214
  .onGet(this.getSelfCleanState.bind(this))
@@ -209,22 +218,20 @@ export default class AirConditionerAccessory extends BaseAccessory {
209
218
  this.accessory.removeService(this.selfCleanService);
210
219
  }
211
220
  // ION switch
212
- this.ionService = this.accessory.getServiceById(this.platform.Service.Switch, 'ION');
221
+ this.ionService = this.accessory.getServiceById(this.platform.Service.Switch, ionSubtype);
213
222
  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`);
223
+ this.ionService ??= this.accessory.addService(this.platform.Service.Switch, undefined, ionSubtype);
224
+ this.handleConfiguredName(this.ionService, ionSubtype, 'ION');
217
225
  this.ionService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getIonState.bind(this)).onSet(this.setIonState.bind(this));
218
226
  }
219
227
  else if (this.ionService) {
220
228
  this.accessory.removeService(this.ionService);
221
229
  }
222
230
  // Rate select slider
223
- this.rateSelectService = this.accessory.getServiceById(this.platform.Service.Lightbulb, 'Gear');
231
+ this.rateSelectService = this.accessory.getServiceById(this.platform.Service.Lightbulb, rateSelectSubtype);
224
232
  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`);
233
+ this.rateSelectService ??= this.accessory.addService(this.platform.Service.Lightbulb, undefined, rateSelectSubtype);
234
+ this.handleConfiguredName(this.rateSelectService, rateSelectSubtype, 'Gear');
228
235
  this.rateSelectService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
229
236
  this.rateSelectService
230
237
  .getCharacteristic(this.platform.Characteristic.Brightness)
@@ -238,26 +245,45 @@ export default class AirConditionerAccessory extends BaseAccessory {
238
245
  this.accessory.removeService(this.rateSelectService);
239
246
  }
240
247
  // Sleep mode accessory
241
- this.sleepModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'SleepMode');
248
+ this.sleepModeService = this.accessory.getServiceById(this.platform.Service.Switch, sleepModeSubtype);
242
249
  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`);
250
+ this.sleepModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, sleepModeSubtype);
251
+ this.handleConfiguredName(this.sleepModeService, sleepModeSubtype, 'Sleep');
245
252
  this.sleepModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getSleepMode.bind(this)).onSet(this.setSleepMode.bind(this));
246
253
  }
247
254
  else if (this.sleepModeService) {
248
255
  this.accessory.removeService(this.sleepModeService);
249
256
  }
257
+ // Comfort mode accessory
258
+ this.comfortModeService = this.accessory.getServiceById(this.platform.Service.Switch, comfortModeSubtype);
259
+ if (this.configDev.AC_options.comfortModeSwitch) {
260
+ this.comfortModeService ??= this.accessory.addService(this.platform.Service.Switch, undefined, comfortModeSubtype);
261
+ this.handleConfiguredName(this.comfortModeService, comfortModeSubtype, 'Comfort');
262
+ this.comfortModeService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getComfortMode.bind(this)).onSet(this.setComfortMode.bind(this));
263
+ }
264
+ else if (this.comfortModeService) {
265
+ this.accessory.removeService(this.comfortModeService);
266
+ }
267
+ // Separate temperature sensor accessory
268
+ this.temperatureSensorService = this.accessory.getServiceById(this.platform.Service.TemperatureSensor, temperatureSensorSubtype);
269
+ if (this.configDev.AC_options.temperatureSensor) {
270
+ this.temperatureSensorService ??= this.accessory.addService(this.platform.Service.TemperatureSensor, undefined, temperatureSensorSubtype);
271
+ this.handleConfiguredName(this.temperatureSensorService, temperatureSensorSubtype, 'Indoor Temperature');
272
+ this.temperatureSensorService.getCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(this.getCurrentTemperature.bind(this));
273
+ }
274
+ else if (this.temperatureSensorService) {
275
+ this.accessory.removeService(this.temperatureSensorService);
276
+ }
250
277
  const swingProps = this.configDev.AC_options.swing;
251
278
  this.swingAngleMainControl =
252
279
  swingProps.mode === SwingMode.VERTICAL || (swingProps.mode === SwingMode.BOTH && swingProps.angleMainControl === SwingAngle.VERTICAL)
253
280
  ? SwingAngle.VERTICAL
254
281
  : SwingAngle.HORIZONTAL;
255
282
  // Swing angle accessory
256
- this.swingAngleService = this.accessory.getServiceById(this.platform.Service.WindowCovering, 'SwingAngle');
283
+ this.swingAngleService = this.accessory.getServiceById(this.platform.Service.WindowCovering, swingAngleSubtype);
257
284
  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`);
285
+ this.swingAngleService ??= this.accessory.addService(this.platform.Service.WindowCovering, undefined, swingAngleSubtype);
286
+ this.handleConfiguredName(this.swingAngleService, swingAngleSubtype, 'Swing');
261
287
  this.swingAngleService.getCharacteristic(this.platform.Characteristic.CurrentPosition).onGet(this.getSwingAngleCurrentPosition.bind(this));
262
288
  this.swingAngleService
263
289
  .getCharacteristic(this.platform.Characteristic.TargetPosition)
@@ -405,7 +431,9 @@ export default class AirConditionerAccessory extends BaseAccessory {
405
431
  : this.platform.Characteristic.TemperatureDisplayUnits.CELSIUS;
406
432
  }
407
433
  async setTemperatureDisplayUnits(value) {
408
- await this.device.set_attribute({ TEMP_FAHRENHEIT: value === this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT });
434
+ await this.device.set_attribute({
435
+ TEMP_FAHRENHEIT: value === this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT,
436
+ });
409
437
  }
410
438
  getCurrentHeaterCoolerState() {
411
439
  if (this.device.attributes.POWER && this.device.attributes.MODE > 0 && this.device.attributes.MODE < 5) {
@@ -451,7 +479,7 @@ export default class AirConditionerAccessory extends BaseAccessory {
451
479
  return this.device.attributes.INDOOR_TEMPERATURE ?? this.configDev.AC_options.minTemp;
452
480
  }
453
481
  getTargetTemperature() {
454
- return Math.max(this.configDev.AC_options.minTemp, Math.min(this.configDev.AC_options.maxTemp, this.device.attributes.TARGET_TEMPERATURE));
482
+ return limitValue(this.device.attributes.TARGET_TEMPERATURE, this.configDev.AC_options.minTemp, this.configDev.AC_options.maxTemp);
455
483
  }
456
484
  getFanOnlyMode() {
457
485
  return this.device.attributes.POWER === true && this.device.attributes.MODE === 5;
@@ -471,8 +499,7 @@ export default class AirConditionerAccessory extends BaseAccessory {
471
499
  await this.device.set_fan_auto(value === this.platform.Characteristic.TargetFanState.AUTO);
472
500
  }
473
501
  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);
502
+ await this.device.set_target_temperature(limitValue(value, this.configDev.AC_options.minTemp, this.configDev.AC_options.maxTemp));
476
503
  }
477
504
  getSwingMode() {
478
505
  return this.device.attributes.SWING_HORIZONTAL || this.device.attributes.SWING_VERTICAL
@@ -624,5 +651,18 @@ export default class AirConditionerAccessory extends BaseAccessory {
624
651
  await this.device.set_attribute({ SLEEP_MODE: false });
625
652
  }
626
653
  }
654
+ getComfortMode() {
655
+ return this.device.attributes.POWER === true && this.device.attributes.COMFORT_MODE
656
+ ? this.platform.Characteristic.Active.ACTIVE
657
+ : this.platform.Characteristic.Active.INACTIVE;
658
+ }
659
+ async setComfortMode(value) {
660
+ if (value === this.platform.Characteristic.Active.ACTIVE) {
661
+ await this.device.set_attribute({ POWER: true, COMFORT_MODE: true });
662
+ }
663
+ else {
664
+ await this.device.set_attribute({ COMFORT_MODE: false });
665
+ }
666
+ }
627
667
  }
628
668
  //# sourceMappingURL=AirConditionerAccessory.js.map