@switchbot/homebridge-switchbot 3.5.0-beta.26 → 3.5.0-beta.27

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 (101) hide show
  1. package/dist/device/blindtilt.d.ts.map +1 -1
  2. package/dist/device/blindtilt.js +17 -14
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +13 -13
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.js +3 -3
  7. package/dist/device/ceilinglight.js.map +1 -1
  8. package/dist/device/colorbulb.js +3 -3
  9. package/dist/device/colorbulb.js.map +1 -1
  10. package/dist/device/contact.js +5 -5
  11. package/dist/device/contact.js.map +1 -1
  12. package/dist/device/curtain.d.ts.map +1 -1
  13. package/dist/device/curtain.js +12 -12
  14. package/dist/device/curtain.js.map +1 -1
  15. package/dist/device/hub.d.ts.map +1 -1
  16. package/dist/device/hub.js +6 -6
  17. package/dist/device/hub.js.map +1 -1
  18. package/dist/device/humidifier.js +4 -4
  19. package/dist/device/humidifier.js.map +1 -1
  20. package/dist/device/iosensor.js +5 -5
  21. package/dist/device/iosensor.js.map +1 -1
  22. package/dist/device/lightstrip.js +3 -3
  23. package/dist/device/lightstrip.js.map +1 -1
  24. package/dist/device/lock.js +6 -6
  25. package/dist/device/lock.js.map +1 -1
  26. package/dist/device/meter.js +5 -5
  27. package/dist/device/meter.js.map +1 -1
  28. package/dist/device/meterplus.js +5 -5
  29. package/dist/device/meterplus.js.map +1 -1
  30. package/dist/device/motion.js +5 -6
  31. package/dist/device/motion.js.map +1 -1
  32. package/dist/device/plug.js +3 -3
  33. package/dist/device/plug.js.map +1 -1
  34. package/dist/device/robotvacuumcleaner.js +4 -4
  35. package/dist/device/robotvacuumcleaner.js.map +1 -1
  36. package/dist/device/waterdetector.d.ts.map +1 -1
  37. package/dist/device/waterdetector.js +9 -16
  38. package/dist/device/waterdetector.js.map +1 -1
  39. package/dist/irdevice/airconditioner.d.ts +4 -14
  40. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  41. package/dist/irdevice/airconditioner.js +226 -234
  42. package/dist/irdevice/airconditioner.js.map +1 -1
  43. package/dist/irdevice/airpurifier.d.ts +3 -6
  44. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  45. package/dist/irdevice/airpurifier.js +65 -56
  46. package/dist/irdevice/airpurifier.js.map +1 -1
  47. package/dist/irdevice/camera.d.ts +2 -3
  48. package/dist/irdevice/camera.d.ts.map +1 -1
  49. package/dist/irdevice/camera.js +24 -27
  50. package/dist/irdevice/camera.js.map +1 -1
  51. package/dist/irdevice/fan.d.ts +2 -7
  52. package/dist/irdevice/fan.d.ts.map +1 -1
  53. package/dist/irdevice/fan.js +57 -61
  54. package/dist/irdevice/fan.js.map +1 -1
  55. package/dist/irdevice/irdevice.js +1 -1
  56. package/dist/irdevice/irdevice.js.map +1 -1
  57. package/dist/irdevice/light.d.ts +1 -1
  58. package/dist/irdevice/light.d.ts.map +1 -1
  59. package/dist/irdevice/light.js +13 -15
  60. package/dist/irdevice/light.js.map +1 -1
  61. package/dist/irdevice/other.js +51 -50
  62. package/dist/irdevice/other.js.map +1 -1
  63. package/dist/irdevice/tv.js +2 -2
  64. package/dist/irdevice/tv.js.map +1 -1
  65. package/dist/irdevice/vacuumcleaner.js +1 -1
  66. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  67. package/dist/irdevice/waterheater.js +1 -1
  68. package/dist/irdevice/waterheater.js.map +1 -1
  69. package/dist/platform.d.ts.map +1 -1
  70. package/dist/platform.js +22 -1
  71. package/dist/platform.js.map +1 -1
  72. package/package.json +2 -2
  73. package/src/custom.d.ts +1 -0
  74. package/src/device/blindtilt.ts +20 -18
  75. package/src/device/bot.ts +14 -14
  76. package/src/device/ceilinglight.ts +4 -4
  77. package/src/device/colorbulb.ts +4 -4
  78. package/src/device/contact.ts +6 -6
  79. package/src/device/curtain.ts +14 -13
  80. package/src/device/hub.ts +7 -6
  81. package/src/device/humidifier.ts +5 -5
  82. package/src/device/iosensor.ts +6 -6
  83. package/src/device/lightstrip.ts +4 -4
  84. package/src/device/lock.ts +7 -7
  85. package/src/device/meter.ts +6 -6
  86. package/src/device/meterplus.ts +6 -6
  87. package/src/device/motion.ts +6 -6
  88. package/src/device/plug.ts +4 -4
  89. package/src/device/robotvacuumcleaner.ts +5 -5
  90. package/src/device/waterdetector.ts +9 -17
  91. package/src/irdevice/airconditioner.ts +239 -238
  92. package/src/irdevice/airpurifier.ts +75 -56
  93. package/src/irdevice/camera.ts +27 -27
  94. package/src/irdevice/fan.ts +63 -63
  95. package/src/irdevice/irdevice.ts +1 -1
  96. package/src/irdevice/light.ts +17 -15
  97. package/src/irdevice/other.ts +51 -51
  98. package/src/irdevice/tv.ts +2 -2
  99. package/src/irdevice/vacuumcleaner.ts +1 -1
  100. package/src/irdevice/waterheater.ts +1 -1
  101. package/src/platform.ts +21 -4
@@ -13,15 +13,8 @@ import { Devices } from '../settings.js';
13
13
  export class AirConditioner extends irdeviceBase {
14
14
  platform;
15
15
  // Services
16
- coolerService;
17
- // Characteristic Values
18
- Active;
19
- RotationSpeed;
20
- CurrentTemperature;
21
- ThresholdTemperature;
22
- CurrentRelativeHumidity;
23
- TargetHeaterCoolerState;
24
- CurrentHeaterCoolerState;
16
+ HeaterCooler;
17
+ HumiditySensor;
25
18
  // Others
26
19
  state;
27
20
  Busy;
@@ -29,9 +22,6 @@ export class AirConditioner extends irdeviceBase {
29
22
  CurrentMode;
30
23
  ValidValues;
31
24
  CurrentFanSpeed;
32
- static MODE_AUTO;
33
- static MODE_COOL;
34
- static MODE_HEAT;
35
25
  // Config
36
26
  hide_automode;
37
27
  set_max_heat;
@@ -39,112 +29,60 @@ export class AirConditioner extends irdeviceBase {
39
29
  set_max_cool;
40
30
  set_min_cool;
41
31
  meter;
42
- valid12 = [1, 2];
43
- valid012 = [0, 1, 2];
44
32
  constructor(platform, accessory, device) {
45
33
  super(platform, accessory, device);
46
34
  this.platform = platform;
47
- if (this.Active === undefined) {
48
- this.Active = this.hap.Characteristic.Active.INACTIVE;
49
- }
50
- else if (this.Active) {
51
- this.Active;
52
- }
53
- else {
54
- this.Active = this.accessory.context.Active;
55
- }
56
- if (this.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
57
- this.CurrentTemperature = 24;
58
- }
59
- else {
60
- this.CurrentTemperature = this.CurrentTemperature || this.accessory.context.CurrentTemperature;
61
- }
62
- if (this.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
63
- this.ThresholdTemperature = 24;
64
- }
65
- else {
66
- this.ThresholdTemperature = this.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
67
- }
68
- if (this.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
69
- this.RotationSpeed = 4;
70
- }
71
- else {
72
- this.RotationSpeed = this.RotationSpeed || this.accessory.context.RotationSpeed;
73
- }
74
- if (this.device.irair?.hide_automode) {
75
- this.hide_automode = this.device.irair?.hide_automode;
76
- this.accessory.context.hide_automode = this.hide_automode;
77
- }
78
- else {
79
- this.hide_automode = this.device.irair?.hide_automode;
80
- this.accessory.context.hide_automode = this.hide_automode;
81
- }
82
- if (this.device.irair?.set_max_heat) {
83
- this.set_max_heat = this.device.irair?.set_max_heat;
84
- this.accessory.context.set_max_heat = this.set_max_heat;
85
- }
86
- else {
87
- this.set_max_heat = 35;
88
- this.accessory.context.set_max_heat = this.set_max_heat;
89
- }
90
- if (this.device.irair?.set_min_heat) {
91
- this.set_min_heat = this.device.irair?.set_min_heat;
92
- this.accessory.context.set_min_heat = this.set_min_heat;
93
- }
94
- else {
95
- this.set_min_heat = 0;
96
- this.accessory.context.set_min_heat = this.set_min_heat;
97
- }
98
- if (this.device.irair?.set_max_cool) {
99
- this.set_max_cool = this.device.irair?.set_max_cool;
100
- this.accessory.context.set_max_cool = this.set_max_cool;
101
- }
102
- else {
103
- this.set_max_cool = 35;
104
- this.accessory.context.set_max_cool = this.set_max_cool;
105
- }
106
- if (this.device.irair?.set_min_cool) {
107
- this.set_min_cool = this.device.irair?.set_min_cool;
108
- this.accessory.context.set_min_cool = this.set_min_cool;
109
- }
110
- else {
111
- this.set_min_cool = 0;
112
- this.accessory.context.set_min_cool = this.set_min_cool;
113
- }
114
- if (this.meter) {
115
- if (this.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
116
- this.CurrentRelativeHumidity = 0;
117
- }
118
- else {
119
- this.CurrentRelativeHumidity = this.CurrentRelativeHumidity || this.accessory.context.CurrentRelativeHumidity;
120
- }
35
+ // default placeholders
36
+ this.getAirConditionerConfigSettings(accessory, device);
37
+ // Initialize HeaterCooler property
38
+ this.HeaterCooler = {
39
+ Service: accessory.getService(this.hap.Service.Switch),
40
+ Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
41
+ CurrentHeaterCoolerState: accessory.context.CurrentHeaterCoolerState || this.hap.Characteristic.CurrentHeaterCoolerState.IDLE,
42
+ TargetHeaterCoolerState: accessory.context.TargetHeaterCoolerState || this.hap.Characteristic.TargetHeaterCoolerState.AUTO,
43
+ CurrentTemperature: accessory.context.CurrentTemperature || 24,
44
+ ThresholdTemperature: accessory.context.ThresholdTemperature || 24,
45
+ RotationSpeed: accessory.context.RotationSpeed || 4,
46
+ };
47
+ // Initialize HumiditySensor property
48
+ if (this.device.irair?.meterType && this.device.irair?.meterId) {
49
+ const meterUuid = this.platform.api.hap.uuid.generate(`${this.device.irair.meterId}-${this.device.irair.meterType}`);
50
+ this.meter = this.platform.accessories.find((accessory) => accessory.UUID === meterUuid);
51
+ this.HumiditySensor = {
52
+ Service: this.meter.getService(this.hap.Service.HumiditySensor),
53
+ CurrentRelativeHumidity: this.meter.context.CurrentRelativeHumidity || 0,
54
+ };
121
55
  }
122
56
  // get the Television service if it exists, otherwise create a new Television service
123
57
  // you can create multiple services for each accessory
124
- const coolerService = `${accessory.displayName} ${device.remoteType}`;
125
- (this.coolerService = accessory.getService(this.hap.Service.HeaterCooler)
126
- || accessory.addService(this.hap.Service.HeaterCooler)), coolerService;
127
- this.coolerService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
58
+ const HeaterCoolerService = `${accessory.displayName} ${device.remoteType}`;
59
+ (this.HeaterCooler.Service = accessory.getService(this.hap.Service.HeaterCooler)
60
+ || accessory.addService(this.hap.Service.HeaterCooler)), HeaterCoolerService;
61
+ this.HeaterCooler.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
128
62
  // handle on / off events using the Active characteristic
129
- this.coolerService.getCharacteristic(this.hap.Characteristic.Active).onSet(this.ActiveSet.bind(this));
130
- this.coolerService.getCharacteristic(this.hap.Characteristic.CurrentTemperature).onGet(this.CurrentTemperatureGet.bind(this));
63
+ this.HeaterCooler.Service.getCharacteristic(this.hap.Characteristic.Active)
64
+ .onSet(this.ActiveSet.bind(this));
65
+ this.HeaterCooler.Service.getCharacteristic(this.hap.Characteristic.CurrentTemperature)
66
+ .onGet(this.CurrentTemperatureGet.bind(this));
131
67
  this.ValidValues = this.hide_automode ? [1, 2] : [0, 1, 2];
132
68
  if (this.device.irair?.meterType && this.device.irair?.meterId) {
133
69
  const meterUuid = this.platform.api.hap.uuid.generate(`${this.device.irair.meterId}-${this.device.irair.meterType}`);
134
70
  this.meter = this.platform.accessories.find((accessory) => accessory.UUID === meterUuid);
135
71
  }
136
72
  if (this.meter) {
137
- this.coolerService.getCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity).onGet(this.CurrentRelativeHumidityGet.bind(this));
73
+ this.HumiditySensor.Service.getCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity)
74
+ .onGet(this.CurrentRelativeHumidityGet.bind(this));
138
75
  }
139
- this.coolerService
76
+ this.HeaterCooler.Service
140
77
  .getCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState)
141
78
  .setProps({
142
79
  validValues: this.ValidValues,
143
80
  })
144
81
  .onGet(this.TargetHeaterCoolerStateGet.bind(this))
145
82
  .onSet(this.TargetHeaterCoolerStateSet.bind(this));
146
- this.coolerService.getCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState).onGet(this.CurrentHeaterCoolerStateGet.bind(this));
147
- this.coolerService
83
+ this.HeaterCooler.Service.getCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState)
84
+ .onGet(this.CurrentHeaterCoolerStateGet.bind(this));
85
+ this.HeaterCooler.Service
148
86
  .getCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature)
149
87
  .setProps({
150
88
  minValue: this.set_min_heat,
@@ -153,7 +91,7 @@ export class AirConditioner extends irdeviceBase {
153
91
  })
154
92
  .onGet(this.ThresholdTemperatureGet.bind(this))
155
93
  .onSet(this.ThresholdTemperatureSet.bind(this));
156
- this.coolerService
94
+ this.HeaterCooler.Service
157
95
  .getCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature)
158
96
  .setProps({
159
97
  minValue: this.set_min_cool,
@@ -162,7 +100,7 @@ export class AirConditioner extends irdeviceBase {
162
100
  })
163
101
  .onGet(this.ThresholdTemperatureGet.bind(this))
164
102
  .onSet(this.ThresholdTemperatureSet.bind(this));
165
- this.coolerService
103
+ this.HeaterCooler.Service
166
104
  .getCharacteristic(this.hap.Characteristic.RotationSpeed)
167
105
  .setProps({
168
106
  format: 'int',
@@ -183,9 +121,9 @@ export class AirConditioner extends irdeviceBase {
183
121
  * AirConditioner: "command" "highSpeed" "default" = fan speed to high
184
122
  */
185
123
  async pushAirConditionerOnChanges() {
186
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges Active: ${this.Active},` +
124
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges Active: ${this.HeaterCooler.Active},` +
187
125
  ` disablePushOn: ${this.disablePushOn}`);
188
- if (this.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
126
+ if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
189
127
  const commandType = await this.commandType();
190
128
  const command = await this.commandOn();
191
129
  const bodyChange = JSON.stringify({
@@ -197,9 +135,9 @@ export class AirConditioner extends irdeviceBase {
197
135
  }
198
136
  }
199
137
  async pushAirConditionerOffChanges() {
200
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges Active: ${this.Active},` +
138
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges Active: ${this.HeaterCooler.Active},` +
201
139
  ` disablePushOff: ${this.disablePushOff}`);
202
- if (this.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
140
+ if (this.HeaterCooler.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
203
141
  const commandType = await this.commandType();
204
142
  const command = await this.commandOff();
205
143
  const bodyChange = JSON.stringify({
@@ -211,18 +149,18 @@ export class AirConditioner extends irdeviceBase {
211
149
  }
212
150
  }
213
151
  async pushAirConditionerStatusChanges() {
214
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerStatusChanges Active: ${this.Active},` +
152
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerStatusChanges Active: ${this.HeaterCooler.Active},` +
215
153
  ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
216
154
  if (!this.Busy) {
217
155
  this.Busy = true;
218
- this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE;
156
+ this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE;
219
157
  }
220
158
  clearTimeout(this.Timeout);
221
159
  // Make a new Timeout set to go off in 1000ms (1 second)
222
160
  this.Timeout = setTimeout(this.pushAirConditionerDetailsChanges.bind(this), 1500);
223
161
  }
224
162
  async pushAirConditionerDetailsChanges() {
225
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerDetailsChanges Active: ${this.Active},` +
163
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerDetailsChanges Active: ${this.HeaterCooler.Active},` +
226
164
  ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
227
165
  //await this.deviceContext();
228
166
  if (this.CurrentMode === undefined) {
@@ -231,7 +169,7 @@ export class AirConditioner extends irdeviceBase {
231
169
  if (this.CurrentFanSpeed === undefined) {
232
170
  this.CurrentFanSpeed = 1;
233
171
  }
234
- if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
172
+ if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
235
173
  this.state = 'on';
236
174
  }
237
175
  else {
@@ -239,11 +177,11 @@ export class AirConditioner extends irdeviceBase {
239
177
  }
240
178
  if (this.CurrentMode === 1) {
241
179
  // Remove or make configurable?
242
- this.ThresholdTemperature = 25;
180
+ this.HeaterCooler.ThresholdTemperature = 25;
243
181
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentMode: ${this.CurrentMode},` +
244
- ` ThresholdTemperature: ${this.ThresholdTemperature}`);
182
+ ` ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
245
183
  }
246
- const parameter = `${this.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
184
+ const parameter = `${this.HeaterCooler.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
247
185
  await this.UpdateCurrentHeaterCoolerState();
248
186
  const bodyChange = JSON.stringify({
249
187
  command: 'setAll',
@@ -253,33 +191,33 @@ export class AirConditioner extends irdeviceBase {
253
191
  await this.pushChanges(bodyChange);
254
192
  }
255
193
  async UpdateCurrentHeaterCoolerState() {
256
- if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
257
- if (this.Active === undefined) {
258
- this.Active = this.hap.Characteristic.Active.INACTIVE;
194
+ if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
195
+ if (this.HeaterCooler.Active === undefined) {
196
+ this.HeaterCooler.Active = this.hap.Characteristic.Active.INACTIVE;
259
197
  }
260
- else if (this.Active) {
261
- this.Active;
198
+ else if (this.HeaterCooler.Active) {
199
+ this.HeaterCooler.Active;
262
200
  }
263
201
  else {
264
- this.Active = this.accessory.context.Active;
202
+ this.HeaterCooler.Active = this.accessory.context.Active;
265
203
  }
266
- if (this.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
267
- this.CurrentTemperature = 24;
204
+ if (this.HeaterCooler.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
205
+ this.HeaterCooler.CurrentTemperature = 24;
268
206
  }
269
207
  else {
270
- this.CurrentTemperature = this.CurrentTemperature || this.accessory.context.CurrentTemperature;
208
+ this.HeaterCooler.CurrentTemperature = this.HeaterCooler.CurrentTemperature || this.accessory.context.CurrentTemperature;
271
209
  }
272
- if (this.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
273
- this.ThresholdTemperature = 24;
210
+ if (this.HeaterCooler.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
211
+ this.HeaterCooler.ThresholdTemperature = 24;
274
212
  }
275
213
  else {
276
- this.ThresholdTemperature = this.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
214
+ this.HeaterCooler.ThresholdTemperature = this.HeaterCooler.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
277
215
  }
278
- if (this.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
279
- this.RotationSpeed = 4;
216
+ if (this.HeaterCooler.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
217
+ this.HeaterCooler.RotationSpeed = 4;
280
218
  }
281
219
  else {
282
- this.RotationSpeed = this.RotationSpeed || this.accessory.context.RotationSpeed;
220
+ this.HeaterCooler.RotationSpeed = this.HeaterCooler.RotationSpeed || this.accessory.context.RotationSpeed;
283
221
  }
284
222
  if (this.device.irair?.hide_automode) {
285
223
  this.hide_automode = this.device.irair?.hide_automode;
@@ -322,27 +260,28 @@ export class AirConditioner extends irdeviceBase {
322
260
  this.accessory.context.set_min_cool = this.set_min_cool;
323
261
  }
324
262
  if (this.meter) {
325
- if (this.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
326
- this.CurrentRelativeHumidity = 0;
263
+ if (this.HumiditySensor.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
264
+ this.HumiditySensor.CurrentRelativeHumidity = 0;
327
265
  }
328
266
  else {
329
- this.CurrentRelativeHumidity = this.CurrentRelativeHumidity || this.accessory.context.CurrentRelativeHumidity;
267
+ this.HumiditySensor.CurrentRelativeHumidity = this.HumiditySensor.CurrentRelativeHumidity
268
+ || this.accessory.context.CurrentRelativeHumidity;
330
269
  }
331
270
  }
332
- if (this.ThresholdTemperature < this.CurrentTemperature &&
333
- this.TargetHeaterCoolerState !== this.hap.Characteristic.TargetHeaterCoolerState.HEAT) {
334
- this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.COOLING;
271
+ if (this.HeaterCooler.ThresholdTemperature < this.HeaterCooler.CurrentTemperature &&
272
+ this.HeaterCooler.TargetHeaterCoolerState !== this.hap.Characteristic.TargetHeaterCoolerState.HEAT) {
273
+ this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.COOLING;
335
274
  }
336
- else if (this.ThresholdTemperature > this.CurrentTemperature &&
337
- this.TargetHeaterCoolerState !== this.hap.Characteristic.TargetHeaterCoolerState.COOL) {
338
- this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.HEATING;
275
+ else if (this.HeaterCooler.ThresholdTemperature > this.HeaterCooler.CurrentTemperature &&
276
+ this.HeaterCooler.TargetHeaterCoolerState !== this.hap.Characteristic.TargetHeaterCoolerState.COOL) {
277
+ this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.HEATING;
339
278
  }
340
279
  else {
341
- this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE;
280
+ this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE;
342
281
  }
343
282
  }
344
283
  else {
345
- this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.INACTIVE;
284
+ this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.INACTIVE;
346
285
  }
347
286
  }
348
287
  async pushChanges(bodyChange) {
@@ -390,9 +329,9 @@ export class AirConditioner extends irdeviceBase {
390
329
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
391
330
  + `Using CurrentTemperature from ${this.meter.context.deviceType} (${this.meter.context.deviceID})`);
392
331
  }
393
- this.CurrentTemperature = this.accessory.context.CurrentTemperature || 24;
394
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentTemperature: ${this.CurrentTemperature}`);
395
- return this.CurrentTemperature;
332
+ this.HeaterCooler.CurrentTemperature = this.accessory.context.CurrentTemperature || 24;
333
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
334
+ return this.HeaterCooler.CurrentTemperature;
396
335
  }
397
336
  async CurrentRelativeHumidityGet() {
398
337
  if (this.meter?.context?.CurrentRelativeHumidity) {
@@ -400,19 +339,20 @@ export class AirConditioner extends irdeviceBase {
400
339
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
401
340
  + `Using CurrentRelativeHumidity from ${this.meter.context.deviceType} (${this.meter.context.deviceID})`);
402
341
  }
403
- this.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity || 0;
404
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
405
- return this.CurrentRelativeHumidity;
342
+ this.HumiditySensor.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity || 0;
343
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get`
344
+ + ` CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`);
345
+ return this.HumiditySensor.CurrentRelativeHumidity;
406
346
  }
407
347
  async RotationSpeedGet() {
408
348
  if (!this.CurrentFanSpeed || this.CurrentFanSpeed === 1) {
409
- this.RotationSpeed = 4;
349
+ this.HeaterCooler.RotationSpeed = 4;
410
350
  }
411
351
  else {
412
- this.RotationSpeed = this.CurrentFanSpeed - 1;
352
+ this.HeaterCooler.RotationSpeed = this.CurrentFanSpeed - 1;
413
353
  }
414
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get RotationSpeed: ${this.RotationSpeed}`);
415
- return this.RotationSpeed;
354
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
355
+ return this.HeaterCooler.RotationSpeed;
416
356
  }
417
357
  async RotationSpeedSet(value) {
418
358
  if (value === 4) {
@@ -421,16 +361,16 @@ export class AirConditioner extends irdeviceBase {
421
361
  else {
422
362
  this.CurrentFanSpeed = Number(value) + 1;
423
363
  }
424
- this.RotationSpeed = value;
364
+ this.HeaterCooler.RotationSpeed = value;
425
365
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
426
- `Set RotationSpeed: ${this.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`);
366
+ `Set RotationSpeed: ${this.HeaterCooler.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`);
427
367
  this.pushAirConditionerStatusChanges();
428
368
  }
429
369
  async ActiveSet(value) {
430
370
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
431
- this.Active = value;
432
- if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
433
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.Active}`);
371
+ this.HeaterCooler.Active = value;
372
+ if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
373
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.HeaterCooler.Active}`);
434
374
  if (this.disablePushOn) {
435
375
  this.pushAirConditionerStatusChanges();
436
376
  }
@@ -439,16 +379,16 @@ export class AirConditioner extends irdeviceBase {
439
379
  }
440
380
  }
441
381
  else {
442
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
382
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.HeaterCooler.Active}`);
443
383
  this.pushAirConditionerOffChanges();
444
384
  }
445
385
  }
446
386
  async TargetHeaterCoolerStateGet() {
447
- const targetState = this.TargetHeaterCoolerState || this.accessory.context.TargetHeaterCoolerState;
448
- this.TargetHeaterCoolerState = this.ValidValues.includes(targetState) ? targetState : this.ValidValues[0];
449
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get (${this.getTargetHeaterCoolerStateName()})` +
450
- ` TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}, ValidValues: ${this.ValidValues}, hide_automode: ${this.hide_automode}`);
451
- return this.TargetHeaterCoolerState;
387
+ const targetState = this.HeaterCooler.TargetHeaterCoolerState || this.accessory.context.TargetHeaterCoolerState;
388
+ this.HeaterCooler.TargetHeaterCoolerState = this.ValidValues.includes(targetState) ? targetState : this.ValidValues[0];
389
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get (${this.getTargetHeaterCoolerStateName()}) TargetHeaterCoolerState:`
390
+ + ` ${this.HeaterCooler.TargetHeaterCoolerState}, ValidValues: ${this.ValidValues}, hide_automode: ${this.hide_automode}`);
391
+ return this.HeaterCooler.TargetHeaterCoolerState;
452
392
  }
453
393
  async TargetHeaterCoolerStateSet(value) {
454
394
  if (!this.hide_automode && value === this.hap.Characteristic.TargetHeaterCoolerState.AUTO) {
@@ -461,37 +401,40 @@ export class AirConditioner extends irdeviceBase {
461
401
  this.TargetHeaterCoolerStateCOOL();
462
402
  }
463
403
  else {
464
- this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},` +
404
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState},` +
465
405
  ` hide_automode: ${this.hide_automode} `);
466
406
  }
467
407
  this.pushAirConditionerStatusChanges();
468
408
  }
469
409
  async TargetHeaterCoolerStateAUTO() {
470
- this.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.AUTO;
410
+ this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.AUTO;
471
411
  this.CurrentMode = 1;
472
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (AUTO) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
412
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (AUTO)`
413
+ + ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
473
414
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
474
415
  }
475
416
  async TargetHeaterCoolerStateCOOL() {
476
- this.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.COOL;
417
+ this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.COOL;
477
418
  this.CurrentMode = 2;
478
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (COOL) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
419
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (COOL)`
420
+ + ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
479
421
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
480
422
  }
481
423
  async TargetHeaterCoolerStateHEAT() {
482
- this.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.HEAT;
424
+ this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.HEAT;
483
425
  this.CurrentMode = 5;
484
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (HEAT) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
426
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (HEAT)`
427
+ + ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
485
428
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
486
429
  }
487
430
  async CurrentHeaterCoolerStateGet() {
488
431
  await this.UpdateCurrentHeaterCoolerState();
489
432
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
490
- ` Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
491
- return this.CurrentHeaterCoolerState;
433
+ ` Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
434
+ return this.HeaterCooler.CurrentHeaterCoolerState;
492
435
  }
493
436
  getTargetHeaterCoolerStateName() {
494
- switch (this.TargetHeaterCoolerState) {
437
+ switch (this.HeaterCooler.TargetHeaterCoolerState) {
495
438
  case this.hap.Characteristic.TargetHeaterCoolerState.AUTO:
496
439
  return 'AUTO';
497
440
  case this.hap.Characteristic.TargetHeaterCoolerState.HEAT:
@@ -499,36 +442,36 @@ export class AirConditioner extends irdeviceBase {
499
442
  case this.hap.Characteristic.TargetHeaterCoolerState.COOL:
500
443
  return 'COOL';
501
444
  default:
502
- return this.TargetHeaterCoolerState.toString();
445
+ return this.HeaterCooler.TargetHeaterCoolerState.toString();
503
446
  }
504
447
  }
505
448
  async ThresholdTemperatureGet() {
506
- if (this.Active === undefined) {
507
- this.Active = this.hap.Characteristic.Active.INACTIVE;
449
+ if (this.HeaterCooler.Active === undefined) {
450
+ this.HeaterCooler.Active = this.hap.Characteristic.Active.INACTIVE;
508
451
  }
509
- else if (this.Active) {
510
- this.Active;
452
+ else if (this.HeaterCooler.Active) {
453
+ this.HeaterCooler.Active;
511
454
  }
512
455
  else {
513
- this.Active = this.accessory.context.Active;
456
+ this.HeaterCooler.Active = this.accessory.context.Active;
514
457
  }
515
- if (this.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
516
- this.CurrentTemperature = 24;
458
+ if (this.HeaterCooler.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
459
+ this.HeaterCooler.CurrentTemperature = 24;
517
460
  }
518
461
  else {
519
- this.CurrentTemperature = this.CurrentTemperature || this.accessory.context.CurrentTemperature;
462
+ this.HeaterCooler.CurrentTemperature = this.HeaterCooler.CurrentTemperature || this.accessory.context.CurrentTemperature;
520
463
  }
521
- if (this.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
522
- this.ThresholdTemperature = 24;
464
+ if (this.HeaterCooler.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
465
+ this.HeaterCooler.ThresholdTemperature = 24;
523
466
  }
524
467
  else {
525
- this.ThresholdTemperature = this.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
468
+ this.HeaterCooler.ThresholdTemperature = this.HeaterCooler.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
526
469
  }
527
- if (this.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
528
- this.RotationSpeed = 4;
470
+ if (this.HeaterCooler.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
471
+ this.HeaterCooler.RotationSpeed = 4;
529
472
  }
530
473
  else {
531
- this.RotationSpeed = this.RotationSpeed || this.accessory.context.RotationSpeed;
474
+ this.HeaterCooler.RotationSpeed = this.HeaterCooler.RotationSpeed || this.accessory.context.RotationSpeed;
532
475
  }
533
476
  if (this.device.irair?.hide_automode) {
534
477
  this.hide_automode = this.device.irair?.hide_automode;
@@ -571,100 +514,149 @@ export class AirConditioner extends irdeviceBase {
571
514
  this.accessory.context.set_min_cool = this.set_min_cool;
572
515
  }
573
516
  if (this.meter) {
574
- if (this.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
575
- this.CurrentRelativeHumidity = 0;
517
+ if (this.HumiditySensor.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
518
+ this.HumiditySensor.CurrentRelativeHumidity = 0;
576
519
  }
577
520
  else {
578
- this.CurrentRelativeHumidity = this.CurrentRelativeHumidity || this.accessory.context.CurrentRelativeHumidity;
521
+ this.HumiditySensor.CurrentRelativeHumidity = this.HumiditySensor.CurrentRelativeHumidity || this.accessory.context.CurrentRelativeHumidity;
579
522
  }
580
523
  }
581
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get ThresholdTemperature: ${this.ThresholdTemperature}`);
582
- return this.ThresholdTemperature;
524
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
525
+ return this.HeaterCooler.ThresholdTemperature;
583
526
  }
584
527
  async ThresholdTemperatureSet(value) {
585
- this.ThresholdTemperature = value;
586
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ThresholdTemperature: ${this.ThresholdTemperature},` +
528
+ this.HeaterCooler.ThresholdTemperature = value;
529
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature},` +
587
530
  ` ThresholdTemperatureCached: ${this.accessory.context.ThresholdTemperature}`);
588
531
  this.pushAirConditionerStatusChanges();
589
532
  }
590
533
  async updateHomeKitCharacteristics() {
591
534
  // Active
592
- if (this.Active === undefined) {
593
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
535
+ if (this.HeaterCooler.Active === undefined) {
536
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.HeaterCooler.Active}`);
594
537
  }
595
538
  else {
596
- this.accessory.context.Active = this.Active;
597
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.Active, this.Active);
598
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
539
+ this.accessory.context.Active = this.HeaterCooler.Active;
540
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.Active, this.HeaterCooler.Active);
541
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.HeaterCooler.Active}`);
599
542
  }
600
543
  // RotationSpeed
601
- if (this.RotationSpeed === undefined) {
602
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
544
+ if (this.HeaterCooler.RotationSpeed === undefined) {
545
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
603
546
  }
604
547
  else {
605
- this.accessory.context.RotationSpeed = this.RotationSpeed;
606
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.RotationSpeed);
607
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
548
+ this.accessory.context.RotationSpeed = this.HeaterCooler.RotationSpeed;
549
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.HeaterCooler.RotationSpeed);
550
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
551
+ + ` RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
608
552
  }
609
553
  // CurrentTemperature
610
- if (this.CurrentTemperature === undefined) {
611
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
554
+ if (this.HeaterCooler.CurrentTemperature === undefined) {
555
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
612
556
  }
613
557
  else {
614
- this.accessory.context.CurrentTemperature = this.CurrentTemperature;
615
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.CurrentTemperature);
616
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
558
+ this.accessory.context.CurrentTemperature = this.HeaterCooler.CurrentTemperature;
559
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.HeaterCooler.CurrentTemperature);
560
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
561
+ + ` CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
617
562
  }
618
563
  // CurrentRelativeHumidity
619
564
  if (this.meter) {
620
- if (this.CurrentRelativeHumidity === undefined) {
621
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
565
+ if (this.HumiditySensor.CurrentRelativeHumidity === undefined) {
566
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
567
+ + ` CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`);
622
568
  }
623
569
  else {
624
- this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity;
625
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
626
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
570
+ this.accessory.context.CurrentRelativeHumidity = this.HumiditySensor.CurrentRelativeHumidity;
571
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, this.HumiditySensor.CurrentRelativeHumidity);
572
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
573
+ + ` CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`);
627
574
  }
628
575
  }
629
576
  // TargetHeaterCoolerState
630
- if (this.TargetHeaterCoolerState === undefined) {
631
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
577
+ if (this.HeaterCooler.TargetHeaterCoolerState === undefined) {
578
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
632
579
  }
633
580
  else {
634
- this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerState;
635
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
636
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
581
+ this.accessory.context.TargetHeaterCoolerState = this.HeaterCooler.TargetHeaterCoolerState;
582
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, this.HeaterCooler.TargetHeaterCoolerState);
583
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
584
+ + ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
637
585
  }
638
586
  // CurrentHeaterCoolerState
639
- if (this.CurrentHeaterCoolerState === undefined) {
640
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
587
+ if (this.HeaterCooler.CurrentHeaterCoolerState === undefined) {
588
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
589
+ + ` CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
641
590
  }
642
591
  else {
643
- this.accessory.context.CurrentHeaterCoolerState = this.CurrentHeaterCoolerState;
644
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
592
+ this.accessory.context.CurrentHeaterCoolerState = this.HeaterCooler.CurrentHeaterCoolerState;
593
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, this.HeaterCooler.CurrentHeaterCoolerState);
645
594
  this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
646
- ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
595
+ ` updateCharacteristic CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
647
596
  }
648
597
  // ThresholdTemperature
649
- if (this.ThresholdTemperature === undefined) {
650
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.ThresholdTemperature}`);
598
+ if (this.HeaterCooler.ThresholdTemperature === undefined) {
599
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
651
600
  }
652
601
  else {
653
- this.accessory.context.ThresholdTemperature = this.ThresholdTemperature;
654
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, this.ThresholdTemperature);
655
- this.coolerService?.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, this.ThresholdTemperature);
656
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ThresholdTemperature: ${this.ThresholdTemperature}`);
602
+ this.accessory.context.ThresholdTemperature = this.HeaterCooler.ThresholdTemperature;
603
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, this.HeaterCooler.ThresholdTemperature);
604
+ this.HeaterCooler.Service?.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, this.HeaterCooler.ThresholdTemperature);
605
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
606
+ + ` ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
657
607
  }
658
608
  }
659
609
  async apiError({ e }) {
660
- this.coolerService.updateCharacteristic(this.hap.Characteristic.Active, e);
661
- this.coolerService.updateCharacteristic(this.hap.Characteristic.RotationSpeed, e);
662
- this.coolerService.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e);
663
- this.coolerService.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, e);
664
- this.coolerService.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, e);
665
- this.coolerService.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, e);
666
- this.coolerService.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, e);
667
- this.coolerService.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, e);
610
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
611
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, e);
612
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e);
613
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, e);
614
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, e);
615
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, e);
616
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, e);
617
+ this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, e);
618
+ }
619
+ async getAirConditionerConfigSettings(accessory, device) {
620
+ if (this.device.irair?.hide_automode) {
621
+ this.hide_automode = device.irair?.hide_automode;
622
+ accessory.context.hide_automode = this.hide_automode;
623
+ }
624
+ else {
625
+ this.hide_automode = device.irair?.hide_automode;
626
+ accessory.context.hide_automode = this.hide_automode;
627
+ }
628
+ if (this.device.irair?.set_max_heat) {
629
+ this.set_max_heat = device.irair?.set_max_heat;
630
+ accessory.context.set_max_heat = this.set_max_heat;
631
+ }
632
+ else {
633
+ this.set_max_heat = 35;
634
+ accessory.context.set_max_heat = this.set_max_heat;
635
+ }
636
+ if (this.device.irair?.set_min_heat) {
637
+ this.set_min_heat = device.irair?.set_min_heat;
638
+ accessory.context.set_min_heat = this.set_min_heat;
639
+ }
640
+ else {
641
+ this.set_min_heat = 0;
642
+ accessory.context.set_min_heat = this.set_min_heat;
643
+ }
644
+ if (this.device.irair?.set_max_cool) {
645
+ this.set_max_cool = device.irair?.set_max_cool;
646
+ accessory.context.set_max_cool = this.set_max_cool;
647
+ }
648
+ else {
649
+ this.set_max_cool = 35;
650
+ accessory.context.set_max_cool = this.set_max_cool;
651
+ }
652
+ if (this.device.irair?.set_min_cool) {
653
+ this.set_min_cool = device.irair?.set_min_cool;
654
+ accessory.context.set_min_cool = this.set_min_cool;
655
+ }
656
+ else {
657
+ this.set_min_cool = 0;
658
+ accessory.context.set_min_cool = this.set_min_cool;
659
+ }
668
660
  }
669
661
  }
670
662
  //# sourceMappingURL=airconditioner.js.map