@switchbot/homebridge-switchbot 1.4.1-beta.5 → 1.4.1-beta.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.
@@ -1,3 +1,4 @@
1
+ import { AxiosResponse } from 'axios';
1
2
  import { SwitchBotPlatform } from '../platform';
2
3
  import { irDevicesConfig, irdevice, payload } from '../settings';
3
4
  import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
@@ -14,11 +15,17 @@ export declare class AirConditioner {
14
15
  Active: CharacteristicValue;
15
16
  ActiveCached: CharacteristicValue;
16
17
  RotationSpeed: CharacteristicValue;
17
- LastTemperature: CharacteristicValue;
18
+ RotationSpeedCached: CharacteristicValue;
18
19
  CurrentTemperature: CharacteristicValue;
19
20
  CurrentTemperatureCached: CharacteristicValue;
20
- TargetHeaterCoolerState?: CharacteristicValue;
21
+ TargetHeaterCoolerState: CharacteristicValue;
22
+ TargetHeaterCoolerStateCached: CharacteristicValue;
21
23
  CurrentHeaterCoolerState: CharacteristicValue;
24
+ CurrentHeaterCoolerStateCached: CharacteristicValue;
25
+ HeatingThresholdTemperature: CharacteristicValue;
26
+ HeatingThresholdTemperatureCached: CharacteristicValue;
27
+ CoolingThresholdTemperature: CharacteristicValue;
28
+ CoolingThresholdTemperatureCached: CharacteristicValue;
22
29
  state: string;
23
30
  Busy: any;
24
31
  Timeout: any;
@@ -29,15 +36,9 @@ export declare class AirConditioner {
29
36
  static MODE_COOL: number;
30
37
  static MODE_HEAT: number;
31
38
  deviceLogging: string;
39
+ hide_automode?: boolean;
32
40
  constructor(platform: SwitchBotPlatform, accessory: PlatformAccessory, device: irdevice & irDevicesConfig);
33
41
  logs(): void;
34
- private RotationSpeedSet;
35
- private RotationSpeedGet;
36
- private ActiveSet;
37
- private updateHomeKitCharacteristics;
38
- private CurrentTemperatureGet;
39
- private TargetHeaterCoolerStateSet;
40
- private CurrentHeaterCoolerStateGet;
41
42
  /**
42
43
  * Pushes the requested changes to the SwitchBot API
43
44
  * deviceType commandType Command command parameter Description
@@ -52,8 +53,26 @@ export declare class AirConditioner {
52
53
  pushAirConditionerStatusChanges(): Promise<void>;
53
54
  pushAirConditionerDetailsChanges(): Promise<void>;
54
55
  pushChanges(payload: payload): Promise<void>;
55
- private statusCode;
56
+ statusCode(push: AxiosResponse<{
57
+ statusCode: number;
58
+ }>): void;
59
+ updateHomeKitCharacteristics(): void;
56
60
  apiError(e: any): void;
61
+ CurrentTemperatureGet(): CharacteristicValue;
62
+ RotationSpeedGet(): number;
63
+ RotationSpeedSet(value: CharacteristicValue): void;
64
+ ActiveSet(value: CharacteristicValue): void;
65
+ TargetHeaterCoolerStateGet(): CharacteristicValue;
66
+ TargetHeaterCoolerStateSet(value: CharacteristicValue): void;
67
+ private TargetHeaterCoolerStateAUTO;
68
+ private TargetHeaterCoolerStateCOOL;
69
+ private TargetHeaterCoolerStateHEAT;
70
+ CurrentHeaterCoolerStateGet(): CharacteristicValue;
71
+ private HeatingThresholdTemperatureGet;
72
+ private HeatingThresholdTemperatureSet;
73
+ private CoolingThresholdTemperatureGet;
74
+ private CoolingThresholdTemperatureSet;
75
+ private CurrentTemperatureUndefined;
57
76
  /**
58
77
  * Logging for Device
59
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"airconditioners.d.ts","sourceRoot":"","sources":["../../src/irdevices/airconditioners.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAa,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;GAIG;AACH,qBAAa,cAAc;IA6BvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,SAAS;IACV,MAAM,EAAE,QAAQ,GAAG,eAAe;IA7B3C,OAAO,EAAG,OAAO,CAAC;IAG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AAG,EAAE,GAAG,EAAE;IAUtB,qBAAqB,IAAI,OAAO;CAGjC"}
@@ -27,6 +27,14 @@ class AirConditioner {
27
27
  else {
28
28
  this.CurrentTemperature = this.accessory.context.CurrentTemperature;
29
29
  }
30
+ if (device.irair?.hide_automode) {
31
+ this.hide_automode = device.irair?.hide_automode;
32
+ this.accessory.context.hide_automode = this.hide_automode;
33
+ }
34
+ else {
35
+ this.hide_automode = device.irair?.hide_automode;
36
+ this.accessory.context.hide_automode = this.hide_automode;
37
+ }
30
38
  // set accessory information
31
39
  accessory
32
40
  .getService(this.platform.Service.AccessoryInformation)
@@ -53,24 +61,56 @@ class AirConditioner {
53
61
  maxValue: 100,
54
62
  minStep: 0.01,
55
63
  })
56
- .onGet((value) => {
57
- return this.CurrentTemperatureGet(value);
64
+ .onGet(() => {
65
+ return this.CurrentTemperatureGet();
58
66
  });
59
- if (device.irair?.hide_automode) {
67
+ if (this.hide_automode) {
68
+ this.TargetHeaterCoolerState = 1 || 2;
60
69
  this.ValidValues = [1, 2];
70
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} ValidValues: ${JSON.stringify(this.ValidValues)},`
71
+ + ` hide_automode: ${this.hide_automode}, TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
61
72
  }
62
73
  else {
74
+ this.TargetHeaterCoolerState = 0 || 1 || 2;
63
75
  this.ValidValues = [0, 1, 2];
76
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} ValidValues: ${JSON.stringify(this.ValidValues)},`
77
+ + ` hide_automode: ${this.hide_automode}, TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
64
78
  }
65
79
  this.service
66
80
  .getCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState)
67
81
  .setProps({
68
82
  validValues: this.ValidValues,
83
+ })
84
+ .onGet(async () => {
85
+ return this.TargetHeaterCoolerStateGet();
69
86
  })
70
87
  .onSet(this.TargetHeaterCoolerStateSet.bind(this));
71
- this.service.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState).onGet(async () => {
88
+ this.service.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState)
89
+ .onGet(async () => {
72
90
  return this.CurrentHeaterCoolerStateGet();
73
91
  });
92
+ this.service
93
+ .getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
94
+ .setProps({
95
+ minValue: 16,
96
+ maxValue: 30,
97
+ minStep: 1,
98
+ })
99
+ .onGet(() => {
100
+ return this.HeatingThresholdTemperatureGet();
101
+ })
102
+ .onSet(this.HeatingThresholdTemperatureSet.bind(this));
103
+ this.service
104
+ .getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
105
+ .setProps({
106
+ minValue: 16,
107
+ maxValue: 30,
108
+ minStep: 1,
109
+ })
110
+ .onGet(() => {
111
+ return this.CoolingThresholdTemperatureGet();
112
+ })
113
+ .onSet(this.CoolingThresholdTemperatureSet.bind(this));
74
114
  this.service
75
115
  .getCharacteristic(this.platform.Characteristic.RotationSpeed)
76
116
  .setProps({
@@ -94,119 +134,6 @@ class AirConditioner {
94
134
  this.deviceLogging = this.accessory.context.logging = 'standard';
95
135
  }
96
136
  }
97
- RotationSpeedSet(value) {
98
- if (value === 4) {
99
- this.CurrentFanSpeed = 1;
100
- }
101
- else {
102
- this.CurrentFanSpeed = Number(value) + 1;
103
- }
104
- this.pushAirConditionerStatusChanges();
105
- this.RotationSpeed = this.CurrentFanSpeed || 1;
106
- }
107
- RotationSpeedGet() {
108
- if (!this.CurrentFanSpeed || this.CurrentFanSpeed === 1) {
109
- this.RotationSpeed = 4;
110
- }
111
- else {
112
- this.RotationSpeed = this.CurrentFanSpeed - 1;
113
- }
114
- return this.RotationSpeed;
115
- }
116
- ActiveSet(value) {
117
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set Active: ${value}`);
118
- if (value === this.platform.Characteristic.Active.INACTIVE) {
119
- this.pushAirConditionerOffChanges();
120
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
121
- }
122
- else {
123
- this.pushAirConditionerOnChanges();
124
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
125
- }
126
- this.Active = value;
127
- this.ActiveCached = this.Active;
128
- this.accessory.context.Active = this.ActiveCached;
129
- }
130
- updateHomeKitCharacteristics() {
131
- if (this.Active === undefined) {
132
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Active: ${this.Active}`);
133
- }
134
- else {
135
- this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
136
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
137
- }
138
- if (this.RotationSpeed === undefined) {
139
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
140
- }
141
- else {
142
- this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
143
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
144
- }
145
- if (this.CurrentTemperature === undefined) {
146
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
147
- }
148
- else {
149
- this.service?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
150
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
151
- }
152
- if (this.TargetHeaterCoolerState === undefined) {
153
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
154
- }
155
- else {
156
- this.service?.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
157
- this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
158
- + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
159
- }
160
- if (this.CurrentHeaterCoolerState === undefined) {
161
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
162
- }
163
- else {
164
- this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
165
- this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
166
- + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
167
- }
168
- }
169
- CurrentTemperatureGet(value) {
170
- value = Number(this.CurrentTemperature) || 24;
171
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Trigger Get CurrentTemperature: ${value}`);
172
- this.service
173
- .getCharacteristic(this.platform.Characteristic.CurrentTemperature)
174
- .updateValue(value);
175
- return value;
176
- }
177
- TargetHeaterCoolerStateSet(value) {
178
- switch (value) {
179
- case this.platform.Characteristic.TargetHeaterCoolerState.HEAT:
180
- this.CurrentMode = AirConditioner.MODE_HEAT;
181
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Set) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
182
- break;
183
- case this.platform.Characteristic.TargetHeaterCoolerState.COOL:
184
- this.CurrentMode = AirConditioner.MODE_COOL;
185
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Set) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
186
- break;
187
- case this.platform.Characteristic.TargetHeaterCoolerState.AUTO:
188
- this.CurrentMode = AirConditioner.MODE_AUTO;
189
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Set) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
190
- }
191
- this.pushAirConditionerStatusChanges();
192
- }
193
- CurrentHeaterCoolerStateGet() {
194
- if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
195
- if ((this.CurrentTemperature || 24) < (this.LastTemperature || 30)) {
196
- this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
197
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Get) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
198
- }
199
- else {
200
- this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
201
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Get) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
202
- }
203
- }
204
- else {
205
- this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE;
206
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Get) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
207
- }
208
- return this.CurrentHeaterCoolerState;
209
- }
210
137
  /**
211
138
  * Pushes the requested changes to the SwitchBot API
212
139
  * deviceType commandType Command command parameter Description
@@ -227,14 +154,12 @@ class AirConditioner {
227
154
  }
228
155
  }
229
156
  async pushAirConditionerOffChanges() {
230
- if (this.Active !== this.platform.Characteristic.Active.INACTIVE) {
231
- const payload = {
232
- commandType: 'command',
233
- parameter: 'default',
234
- command: 'turnOff',
235
- };
236
- await this.pushChanges(payload);
237
- }
157
+ const payload = {
158
+ commandType: 'command',
159
+ parameter: 'default',
160
+ command: 'turnOff',
161
+ };
162
+ await this.pushChanges(payload);
238
163
  }
239
164
  async pushAirConditionerStatusChanges() {
240
165
  if (!this.Busy) {
@@ -259,7 +184,6 @@ class AirConditioner {
259
184
  if (this.CurrentFanSpeed === undefined) {
260
185
  this.CurrentFanSpeed = 1;
261
186
  }
262
- this.Active = this.platform.Characteristic.Active.ACTIVE;
263
187
  if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
264
188
  this.state = 'on';
265
189
  }
@@ -268,10 +192,11 @@ class AirConditioner {
268
192
  }
269
193
  payload.parameter = `${this.CurrentTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
270
194
  if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
271
- if ((this.CurrentTemperature || 24) < (this.LastTemperature || 30)) {
195
+ this.CurrentTemperatureUndefined();
196
+ if (this.CurrentTemperature < this.CurrentTemperatureCached) {
272
197
  this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
273
198
  }
274
- else {
199
+ else if (this.CurrentTemperature > this.CurrentTemperatureCached) {
275
200
  this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
276
201
  }
277
202
  }
@@ -286,10 +211,16 @@ class AirConditioner {
286
211
  + ` parameter: [${payload.parameter}], commandType: ${payload.commandType}`);
287
212
  // Make the API request
288
213
  const push = await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload);
289
- this.errorLog(`Air Conditioner: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
214
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
290
215
  this.statusCode(push);
291
216
  this.CurrentTemperatureCached = this.CurrentTemperature;
292
217
  this.accessory.context.CurrentTemperature = this.CurrentTemperatureCached;
218
+ this.HeatingThresholdTemperature = this.CurrentTemperatureCached;
219
+ this.HeatingThresholdTemperatureCached = this.CurrentTemperatureCached;
220
+ this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperatureCached;
221
+ this.CoolingThresholdTemperature = this.CurrentTemperatureCached;
222
+ this.CoolingThresholdTemperatureCached = this.CurrentTemperatureCached;
223
+ this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperatureCached;
293
224
  this.updateHomeKitCharacteristics();
294
225
  }
295
226
  catch (e) {
@@ -333,6 +264,61 @@ class AirConditioner {
333
264
  this.debugLog(`Air Conditioner: ${this.accessory.displayName} Unknown statusCode.`);
334
265
  }
335
266
  }
267
+ updateHomeKitCharacteristics() {
268
+ if (this.Active === undefined) {
269
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Active: ${this.Active}`);
270
+ }
271
+ else {
272
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
273
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
274
+ }
275
+ if (this.RotationSpeed === undefined) {
276
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
277
+ }
278
+ else {
279
+ this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
280
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
281
+ }
282
+ if (this.CurrentTemperature === undefined) {
283
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
284
+ }
285
+ else {
286
+ this.service?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
287
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
288
+ }
289
+ if (this.TargetHeaterCoolerState === undefined) {
290
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
291
+ }
292
+ else {
293
+ this.service?.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
294
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
295
+ + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
296
+ }
297
+ if (this.CurrentHeaterCoolerState === undefined) {
298
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
299
+ }
300
+ else {
301
+ this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
302
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
303
+ + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
304
+ }
305
+ if (this.HeatingThresholdTemperature === undefined) {
306
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
307
+ }
308
+ else {
309
+ this.service?.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.HeatingThresholdTemperature);
310
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
311
+ + ` updateCharacteristic HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
312
+ }
313
+ if (this.CoolingThresholdTemperature === undefined) {
314
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
315
+ }
316
+ else {
317
+ this.service?.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, this.CoolingThresholdTemperature);
318
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
319
+ + ` updateCharacteristic CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
320
+ }
321
+ }
336
322
  apiError(e) {
337
323
  this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
338
324
  this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, e);
@@ -340,8 +326,196 @@ class AirConditioner {
340
326
  this.service.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, e);
341
327
  this.service.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, e);
342
328
  this.service.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, e);
329
+ this.service.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, e);
343
330
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
344
331
  }
332
+ CurrentTemperatureGet() {
333
+ if (this.CurrentTemperature === undefined) {
334
+ this.CurrentTemperature = 24;
335
+ this.CurrentTemperatureCached = this.CurrentTemperature;
336
+ }
337
+ else {
338
+ this.CurrentTemperatureCached = this.CurrentTemperature;
339
+ }
340
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get CurrentTemperature: ${this.CurrentTemperature}`);
341
+ this.accessory.context.CurrentTemperature = this.CurrentTemperatureCached;
342
+ return this.CurrentTemperature;
343
+ }
344
+ RotationSpeedGet() {
345
+ if (!this.CurrentFanSpeed) {
346
+ this.RotationSpeed = 4;
347
+ }
348
+ else if (this.CurrentFanSpeed === 1) {
349
+ this.RotationSpeed = 4;
350
+ }
351
+ else {
352
+ this.RotationSpeed = this.CurrentFanSpeed - 1;
353
+ }
354
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get RotationSpeed: ${this.RotationSpeed}`);
355
+ this.RotationSpeedCached = this.RotationSpeed;
356
+ this.accessory.context.RotationSpeed = this.RotationSpeedCached;
357
+ return this.RotationSpeed;
358
+ }
359
+ RotationSpeedSet(value) {
360
+ if (value === 4) {
361
+ this.CurrentFanSpeed = 1;
362
+ }
363
+ else {
364
+ this.CurrentFanSpeed = Number(value) + 1;
365
+ }
366
+ this.RotationSpeed = this.CurrentFanSpeed;
367
+ this.RotationSpeedCached = this.RotationSpeed;
368
+ this.accessory.context.RotationSpeed = this.RotationSpeedCached;
369
+ this.pushAirConditionerStatusChanges();
370
+ }
371
+ ActiveSet(value) {
372
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set Active: ${value}`);
373
+ this.Active = value;
374
+ this.ActiveCached = this.Active;
375
+ this.accessory.context.Active = this.ActiveCached;
376
+ if (value === this.platform.Characteristic.Active.INACTIVE) {
377
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
378
+ this.pushAirConditionerOffChanges();
379
+ }
380
+ else {
381
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.Active}`);
382
+ this.pushAirConditionerStatusChanges();
383
+ }
384
+ }
385
+ TargetHeaterCoolerStateGet() {
386
+ if (this.ValidValues === [0, 1, 2]) {
387
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.AUTO;
388
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (AUTO) TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},`
389
+ + ` ValidValues: ${this.ValidValues}`);
390
+ }
391
+ else if (this.ValidValues === [1, 2]) {
392
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.COOL
393
+ || this.platform.Characteristic.TargetHeaterCoolerState.HEAT;
394
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (COOL/HEAT) TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},`
395
+ + ` ValidValues: ${this.ValidValues}`);
396
+ }
397
+ else {
398
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},`
399
+ + ` ValidValues: ${this.ValidValues}`);
400
+ }
401
+ this.TargetHeaterCoolerStateCached = this.TargetHeaterCoolerState;
402
+ this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerStateCached;
403
+ return this.TargetHeaterCoolerState;
404
+ }
405
+ TargetHeaterCoolerStateSet(value) {
406
+ if (this.hide_automode) {
407
+ if (value === this.platform.Characteristic.TargetHeaterCoolerState.HEAT) {
408
+ this.TargetHeaterCoolerStateHEAT();
409
+ }
410
+ else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
411
+ this.TargetHeaterCoolerStateCOOL();
412
+ }
413
+ else {
414
+ this.errorLog(`Air Conditioner: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},`
415
+ + ` hide_automode: ${this.hide_automode} `);
416
+ }
417
+ }
418
+ else {
419
+ if (value === this.platform.Characteristic.TargetHeaterCoolerState.AUTO) {
420
+ this.TargetHeaterCoolerStateAUTO();
421
+ }
422
+ else if (value === this.platform.Characteristic.TargetHeaterCoolerState.HEAT) {
423
+ this.TargetHeaterCoolerStateHEAT();
424
+ }
425
+ else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
426
+ this.TargetHeaterCoolerStateCOOL();
427
+ }
428
+ else {
429
+ this.errorLog(`Air Conditioner: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},`
430
+ + ` hide_automode: ${this.hide_automode} `);
431
+ }
432
+ }
433
+ this.TargetHeaterCoolerStateCached = this.TargetHeaterCoolerState;
434
+ this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerStateCached;
435
+ this.pushAirConditionerStatusChanges();
436
+ }
437
+ TargetHeaterCoolerStateAUTO() {
438
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.AUTO;
439
+ this.CurrentMode = 1;
440
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set (AUTO) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
441
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
442
+ }
443
+ TargetHeaterCoolerStateCOOL() {
444
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.COOL;
445
+ this.CurrentMode = 2;
446
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set (COOL) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
447
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
448
+ }
449
+ TargetHeaterCoolerStateHEAT() {
450
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.HEAT;
451
+ this.CurrentMode = 5;
452
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set (HEAT) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
453
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
454
+ }
455
+ CurrentHeaterCoolerStateGet() {
456
+ if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
457
+ this.CurrentTemperatureUndefined();
458
+ if (this.CurrentTemperature < this.CurrentTemperatureCached) {
459
+ this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
460
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (COOLLING) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
461
+ }
462
+ else if (this.CurrentTemperature > this.CurrentTemperatureCached) {
463
+ this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
464
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (HEATING) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
465
+ }
466
+ }
467
+ else {
468
+ this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE;
469
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (INACTIVE) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
470
+ }
471
+ this.CurrentHeaterCoolerStateCached = this.CurrentHeaterCoolerState;
472
+ this.accessory.context.CurrentHeaterCoolerState = this.CurrentHeaterCoolerStateCached;
473
+ return this.CurrentHeaterCoolerState;
474
+ }
475
+ HeatingThresholdTemperatureGet() {
476
+ this.CurrentTemperatureUndefined;
477
+ this.CurrentTemperature = this.CurrentTemperatureCached;
478
+ this.HeatingThresholdTemperature = this.CurrentTemperatureCached;
479
+ this.HeatingThresholdTemperatureCached = this.HeatingThresholdTemperature;
480
+ this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperatureCached;
481
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
482
+ return this.HeatingThresholdTemperature;
483
+ }
484
+ HeatingThresholdTemperatureSet(value) {
485
+ this.CurrentTemperatureCached = this.CurrentTemperature;
486
+ this.CurrentTemperature = value;
487
+ this.HeatingThresholdTemperatureCached = this.HeatingThresholdTemperature;
488
+ this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperatureCached;
489
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set HeatingThresholdTemperature: ${this.HeatingThresholdTemperature},`
490
+ + ` CurrentTemperatureCached: ${this.CurrentTemperatureCached}`);
491
+ this.pushAirConditionerStatusChanges();
492
+ }
493
+ CoolingThresholdTemperatureGet() {
494
+ this.CurrentTemperatureUndefined;
495
+ this.CurrentTemperature = this.CurrentTemperatureCached;
496
+ this.CoolingThresholdTemperature = this.CurrentTemperatureCached;
497
+ this.CoolingThresholdTemperatureCached = this.CoolingThresholdTemperature;
498
+ this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperatureCached;
499
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
500
+ return this.CoolingThresholdTemperature;
501
+ }
502
+ CoolingThresholdTemperatureSet(value) {
503
+ this.CurrentTemperatureCached = this.CurrentTemperature;
504
+ this.CurrentTemperature = value;
505
+ this.CoolingThresholdTemperatureCached = this.CoolingThresholdTemperature;
506
+ this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperatureCached;
507
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set CoolingThresholdTemperature: ${this.CoolingThresholdTemperature},`
508
+ + ` CurrentTemperatureCached: ${this.CurrentTemperatureCached}`);
509
+ this.pushAirConditionerStatusChanges();
510
+ }
511
+ CurrentTemperatureUndefined() {
512
+ if (this.CurrentTemperature === undefined) {
513
+ this.CurrentTemperature = 24;
514
+ }
515
+ if (this.CurrentTemperatureCached === undefined) {
516
+ this.CurrentTemperature = 30;
517
+ }
518
+ }
345
519
  /**
346
520
  * Logging for Device
347
521
  */
@@ -1 +1 @@
1
- {"version":3,"file":"airconditioners.js","sourceRoot":"","sources":["../../src/irdevices/airconditioners.ts"],"names":[],"mappings":";;;AAEA,0CAA4E;AAG5E;;;;GAIG;AACH,MAAa,cAAc;IA4BzB,YACmB,QAA2B,EACpC,SAA4B,EAC7B,MAAkC;QAFxB,aAAQ,GAAR,QAAQ,CAAmB;QACpC,cAAS,GAAT,SAAS,CAAmB;QAC7B,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,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;IAC7E,CAAC;CACF;AA9kBD,wCA8kBC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Homebridge SwitchBot",
3
3
  "name": "@switchbot/homebridge-switchbot",
4
- "version": "1.4.1-beta.5",
4
+ "version": "1.4.1-beta.6",
5
5
  "description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.",
6
6
  "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
7
7
  "license": "ISC",
@@ -16,11 +16,17 @@ export class AirConditioner {
16
16
  Active!: CharacteristicValue;
17
17
  ActiveCached!: CharacteristicValue;
18
18
  RotationSpeed!: CharacteristicValue;
19
- LastTemperature!: CharacteristicValue;
19
+ RotationSpeedCached!: CharacteristicValue;
20
20
  CurrentTemperature!: CharacteristicValue;
21
21
  CurrentTemperatureCached!: CharacteristicValue;
22
- TargetHeaterCoolerState?: CharacteristicValue;
22
+ TargetHeaterCoolerState!: CharacteristicValue;
23
+ TargetHeaterCoolerStateCached!: CharacteristicValue;
23
24
  CurrentHeaterCoolerState!: CharacteristicValue;
25
+ CurrentHeaterCoolerStateCached!: CharacteristicValue;
26
+ HeatingThresholdTemperature!: CharacteristicValue;
27
+ HeatingThresholdTemperatureCached!: CharacteristicValue;
28
+ CoolingThresholdTemperature!: CharacteristicValue;
29
+ CoolingThresholdTemperatureCached!: CharacteristicValue;
24
30
 
25
31
  // Others
26
32
  state!: string;
@@ -35,6 +41,7 @@ export class AirConditioner {
35
41
 
36
42
  // Config
37
43
  deviceLogging!: string;
44
+ hide_automode?: boolean;
38
45
 
39
46
  constructor(
40
47
  private readonly platform: SwitchBotPlatform,
@@ -53,6 +60,13 @@ export class AirConditioner {
53
60
  } else {
54
61
  this.CurrentTemperature = this.accessory.context.CurrentTemperature;
55
62
  }
63
+ if (device.irair?.hide_automode) {
64
+ this.hide_automode = device.irair?.hide_automode;
65
+ this.accessory.context.hide_automode = this.hide_automode;
66
+ } else {
67
+ this.hide_automode = device.irair?.hide_automode;
68
+ this.accessory.context.hide_automode = this.hide_automode;
69
+ }
56
70
 
57
71
  // set accessory information
58
72
  accessory
@@ -85,25 +99,59 @@ export class AirConditioner {
85
99
  maxValue: 100,
86
100
  minStep: 0.01,
87
101
  })
88
- .onGet((value: CharacteristicValue) => {
89
- return this.CurrentTemperatureGet(value);
102
+ .onGet(() => {
103
+ return this.CurrentTemperatureGet();
90
104
  });
91
105
 
92
- if (device.irair?.hide_automode) {
106
+ if (this.hide_automode) {
107
+ this.TargetHeaterCoolerState = 1 || 2;
93
108
  this.ValidValues = [1, 2];
109
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} ValidValues: ${JSON.stringify(this.ValidValues)},`
110
+ + ` hide_automode: ${this.hide_automode}, TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
94
111
  } else {
112
+ this.TargetHeaterCoolerState = 0 || 1 || 2;
95
113
  this.ValidValues = [0, 1, 2];
114
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} ValidValues: ${JSON.stringify(this.ValidValues)},`
115
+ + ` hide_automode: ${this.hide_automode}, TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
96
116
  }
97
117
  this.service
98
118
  .getCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState)
99
119
  .setProps({
100
120
  validValues: this.ValidValues,
101
121
  })
122
+ .onGet(async () => {
123
+ return this.TargetHeaterCoolerStateGet();
124
+ })
102
125
  .onSet(this.TargetHeaterCoolerStateSet.bind(this));
103
126
 
104
- this.service.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState).onGet(async () => {
105
- return this.CurrentHeaterCoolerStateGet();
106
- });
127
+ this.service.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState)
128
+ .onGet(async () => {
129
+ return this.CurrentHeaterCoolerStateGet();
130
+ });
131
+
132
+ this.service
133
+ .getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
134
+ .setProps({
135
+ minValue: 16,
136
+ maxValue: 30,
137
+ minStep: 1,
138
+ })
139
+ .onGet(() => {
140
+ return this.HeatingThresholdTemperatureGet();
141
+ })
142
+ .onSet(this.HeatingThresholdTemperatureSet.bind(this));
143
+
144
+ this.service
145
+ .getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
146
+ .setProps({
147
+ minValue: 16,
148
+ maxValue: 30,
149
+ minStep: 1,
150
+ })
151
+ .onGet(() => {
152
+ return this.CoolingThresholdTemperatureGet();
153
+ })
154
+ .onSet(this.CoolingThresholdTemperatureSet.bind(this));
107
155
 
108
156
  this.service
109
157
  .getCharacteristic(this.platform.Characteristic.RotationSpeed)
@@ -128,119 +176,6 @@ export class AirConditioner {
128
176
  }
129
177
  }
130
178
 
131
- private RotationSpeedSet(value: CharacteristicValue) {
132
- if (value === 4) {
133
- this.CurrentFanSpeed = 1;
134
- } else {
135
- this.CurrentFanSpeed = Number(value) + 1;
136
- }
137
- this.pushAirConditionerStatusChanges();
138
- this.RotationSpeed = this.CurrentFanSpeed || 1;
139
- }
140
-
141
- private RotationSpeedGet() {
142
- if (!this.CurrentFanSpeed || this.CurrentFanSpeed === 1) {
143
- this.RotationSpeed = 4;
144
- } else {
145
- this.RotationSpeed = this.CurrentFanSpeed - 1;
146
- }
147
- return this.RotationSpeed;
148
- }
149
-
150
- private ActiveSet(value: CharacteristicValue) {
151
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set Active: ${value}`);
152
-
153
- if (value === this.platform.Characteristic.Active.INACTIVE) {
154
- this.pushAirConditionerOffChanges();
155
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
156
- } else {
157
- this.pushAirConditionerOnChanges();
158
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
159
- }
160
- this.Active = value;
161
- this.ActiveCached = this.Active;
162
- this.accessory.context.Active = this.ActiveCached;
163
- }
164
-
165
- private updateHomeKitCharacteristics() {
166
- if (this.Active === undefined) {
167
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Active: ${this.Active}`);
168
- } else {
169
- this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
170
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
171
- }
172
- if (this.RotationSpeed === undefined) {
173
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
174
- } else {
175
- this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
176
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
177
- }
178
- if (this.CurrentTemperature === undefined) {
179
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
180
- } else {
181
- this.service?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
182
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
183
- }
184
- if (this.TargetHeaterCoolerState === undefined) {
185
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
186
- } else {
187
- this.service?.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
188
- this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
189
- + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
190
- }
191
- if (this.CurrentHeaterCoolerState === undefined) {
192
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
193
- } else {
194
- this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
195
- this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
196
- + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
197
- }
198
- }
199
-
200
- private CurrentTemperatureGet(value: CharacteristicValue) {
201
- value = Number(this.CurrentTemperature) || 24;
202
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} Trigger Get CurrentTemperature: ${value}`);
203
-
204
- this.service
205
- .getCharacteristic(this.platform.Characteristic.CurrentTemperature)
206
- .updateValue(value);
207
-
208
- return value;
209
- }
210
-
211
- private TargetHeaterCoolerStateSet(value: CharacteristicValue) {
212
- switch (value) {
213
- case this.platform.Characteristic.TargetHeaterCoolerState.HEAT:
214
- this.CurrentMode = AirConditioner.MODE_HEAT;
215
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Set) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
216
- break;
217
- case this.platform.Characteristic.TargetHeaterCoolerState.COOL:
218
- this.CurrentMode = AirConditioner.MODE_COOL;
219
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Set) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
220
- break;
221
- case this.platform.Characteristic.TargetHeaterCoolerState.AUTO:
222
- this.CurrentMode = AirConditioner.MODE_AUTO;
223
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Set) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
224
- }
225
- this.pushAirConditionerStatusChanges();
226
- }
227
-
228
- private CurrentHeaterCoolerStateGet() {
229
- if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
230
- if ((this.CurrentTemperature || 24) < (this.LastTemperature || 30)) {
231
- this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
232
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Get) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
233
- } else {
234
- this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
235
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Get) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
236
- }
237
- } else {
238
- this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE;
239
- this.debugLog(`Air Conditioner: ${this.accessory.displayName} (Get) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
240
- }
241
- return this.CurrentHeaterCoolerState;
242
- }
243
-
244
179
  /**
245
180
  * Pushes the requested changes to the SwitchBot API
246
181
  * deviceType commandType Command command parameter Description
@@ -262,14 +197,12 @@ export class AirConditioner {
262
197
  }
263
198
 
264
199
  async pushAirConditionerOffChanges() {
265
- if (this.Active !== this.platform.Characteristic.Active.INACTIVE) {
266
- const payload = {
267
- commandType: 'command',
268
- parameter: 'default',
269
- command: 'turnOff',
270
- } as any;
271
- await this.pushChanges(payload);
272
- }
200
+ const payload = {
201
+ commandType: 'command',
202
+ parameter: 'default',
203
+ command: 'turnOff',
204
+ } as any;
205
+ await this.pushChanges(payload);
273
206
  }
274
207
 
275
208
  async pushAirConditionerStatusChanges() {
@@ -298,7 +231,6 @@ export class AirConditioner {
298
231
  if (this.CurrentFanSpeed === undefined) {
299
232
  this.CurrentFanSpeed = 1;
300
233
  }
301
- this.Active = this.platform.Characteristic.Active.ACTIVE;
302
234
  if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
303
235
  this.state = 'on';
304
236
  } else {
@@ -308,9 +240,10 @@ export class AirConditioner {
308
240
 
309
241
 
310
242
  if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
311
- if ((this.CurrentTemperature || 24) < (this.LastTemperature || 30)) {
243
+ this.CurrentTemperatureUndefined();
244
+ if (this.CurrentTemperature < this.CurrentTemperatureCached) {
312
245
  this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
313
- } else {
246
+ } else if (this.CurrentTemperature > this.CurrentTemperatureCached) {
314
247
  this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
315
248
  }
316
249
  } else {
@@ -327,10 +260,16 @@ export class AirConditioner {
327
260
 
328
261
  // Make the API request
329
262
  const push: any = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
330
- this.errorLog(`Air Conditioner: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
263
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
331
264
  this.statusCode(push);
332
265
  this.CurrentTemperatureCached = this.CurrentTemperature;
333
266
  this.accessory.context.CurrentTemperature = this.CurrentTemperatureCached;
267
+ this.HeatingThresholdTemperature = this.CurrentTemperatureCached;
268
+ this.HeatingThresholdTemperatureCached = this.CurrentTemperatureCached;
269
+ this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperatureCached;
270
+ this.CoolingThresholdTemperature = this.CurrentTemperatureCached;
271
+ this.CoolingThresholdTemperatureCached = this.CurrentTemperatureCached;
272
+ this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperatureCached;
334
273
  this.updateHomeKitCharacteristics();
335
274
  } catch (e: any) {
336
275
  this.errorLog(`Air Conditioner: ${this.accessory.displayName} failed pushChanges`);
@@ -346,7 +285,7 @@ export class AirConditioner {
346
285
  }
347
286
  }
348
287
 
349
- private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
288
+ statusCode(push: AxiosResponse<{ statusCode: number; }>) {
350
289
  switch (push.data.statusCode) {
351
290
  case 151:
352
291
  this.errorLog(`Air Conditioner: ${this.accessory.displayName} Command not supported by this device type.`);
@@ -375,6 +314,55 @@ export class AirConditioner {
375
314
  }
376
315
  }
377
316
 
317
+ updateHomeKitCharacteristics() {
318
+ if (this.Active === undefined) {
319
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Active: ${this.Active}`);
320
+ } else {
321
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
322
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
323
+ }
324
+ if (this.RotationSpeed === undefined) {
325
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
326
+ } else {
327
+ this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
328
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
329
+ }
330
+ if (this.CurrentTemperature === undefined) {
331
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
332
+ } else {
333
+ this.service?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
334
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
335
+ }
336
+ if (this.TargetHeaterCoolerState === undefined) {
337
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
338
+ } else {
339
+ this.service?.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
340
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
341
+ + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
342
+ }
343
+ if (this.CurrentHeaterCoolerState === undefined) {
344
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
345
+ } else {
346
+ this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
347
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
348
+ + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
349
+ }
350
+ if (this.HeatingThresholdTemperature === undefined) {
351
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
352
+ } else {
353
+ this.service?.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.HeatingThresholdTemperature);
354
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
355
+ + ` updateCharacteristic HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
356
+ }
357
+ if (this.CoolingThresholdTemperature === undefined) {
358
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
359
+ } else {
360
+ this.service?.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, this.CoolingThresholdTemperature);
361
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName}`
362
+ + ` updateCharacteristic CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
363
+ }
364
+ }
365
+
378
366
  public apiError(e: any) {
379
367
  this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
380
368
  this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, e);
@@ -382,9 +370,200 @@ export class AirConditioner {
382
370
  this.service.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, e);
383
371
  this.service.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, e);
384
372
  this.service.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, e);
373
+ this.service.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, e);
385
374
  //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
386
375
  }
387
376
 
377
+ CurrentTemperatureGet() {
378
+ if (this.CurrentTemperature === undefined) {
379
+ this.CurrentTemperature = 24;
380
+ this.CurrentTemperatureCached = this.CurrentTemperature;
381
+ } else {
382
+ this.CurrentTemperatureCached = this.CurrentTemperature;
383
+ }
384
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get CurrentTemperature: ${this.CurrentTemperature}`);
385
+ this.accessory.context.CurrentTemperature = this.CurrentTemperatureCached;
386
+ return this.CurrentTemperature;
387
+ }
388
+
389
+ RotationSpeedGet() {
390
+ if (!this.CurrentFanSpeed) {
391
+ this.RotationSpeed = 4;
392
+ } else if (this.CurrentFanSpeed === 1) {
393
+ this.RotationSpeed = 4;
394
+ } else {
395
+ this.RotationSpeed = this.CurrentFanSpeed - 1;
396
+ }
397
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get RotationSpeed: ${this.RotationSpeed}`);
398
+ this.RotationSpeedCached = this.RotationSpeed;
399
+ this.accessory.context.RotationSpeed = this.RotationSpeedCached;
400
+ return this.RotationSpeed;
401
+ }
402
+
403
+ RotationSpeedSet(value: CharacteristicValue) {
404
+ if (value === 4) {
405
+ this.CurrentFanSpeed = 1;
406
+ } else {
407
+ this.CurrentFanSpeed = Number(value) + 1;
408
+ }
409
+ this.RotationSpeed = this.CurrentFanSpeed;
410
+ this.RotationSpeedCached = this.RotationSpeed;
411
+ this.accessory.context.RotationSpeed = this.RotationSpeedCached;
412
+ this.pushAirConditionerStatusChanges();
413
+ }
414
+
415
+ ActiveSet(value: CharacteristicValue) {
416
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set Active: ${value}`);
417
+
418
+ this.Active = value;
419
+ this.ActiveCached = this.Active;
420
+ this.accessory.context.Active = this.ActiveCached;
421
+
422
+ if (value === this.platform.Characteristic.Active.INACTIVE) {
423
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
424
+ this.pushAirConditionerOffChanges();
425
+ } else {
426
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.Active}`);
427
+ this.pushAirConditionerStatusChanges();
428
+ }
429
+ }
430
+
431
+ TargetHeaterCoolerStateGet() {
432
+ if (this.ValidValues === [0, 1, 2]) {
433
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.AUTO;
434
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (AUTO) TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},`
435
+ + ` ValidValues: ${this.ValidValues}`);
436
+ } else if (this.ValidValues === [1, 2]) {
437
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.COOL
438
+ || this.platform.Characteristic.TargetHeaterCoolerState.HEAT;
439
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (COOL/HEAT) TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},`
440
+ + ` ValidValues: ${this.ValidValues}`);
441
+ } else {
442
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get TargetHeaterCoolerState: ${this.CurrentHeaterCoolerState},`
443
+ + ` ValidValues: ${this.ValidValues}`);
444
+ }
445
+ this.TargetHeaterCoolerStateCached = this.TargetHeaterCoolerState;
446
+ this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerStateCached;
447
+ return this.TargetHeaterCoolerState;
448
+ }
449
+
450
+ TargetHeaterCoolerStateSet(value: CharacteristicValue) {
451
+ if (this.hide_automode) {
452
+ if (value === this.platform.Characteristic.TargetHeaterCoolerState.HEAT) {
453
+ this.TargetHeaterCoolerStateHEAT();
454
+ } else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
455
+ this.TargetHeaterCoolerStateCOOL();
456
+ } else {
457
+ this.errorLog(`Air Conditioner: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},`
458
+ + ` hide_automode: ${this.hide_automode} `);
459
+ }
460
+ } else {
461
+ if (value === this.platform.Characteristic.TargetHeaterCoolerState.AUTO) {
462
+ this.TargetHeaterCoolerStateAUTO();
463
+ } else if (value === this.platform.Characteristic.TargetHeaterCoolerState.HEAT) {
464
+ this.TargetHeaterCoolerStateHEAT();
465
+ } else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
466
+ this.TargetHeaterCoolerStateCOOL();
467
+ } else {
468
+ this.errorLog(`Air Conditioner: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},`
469
+ + ` hide_automode: ${this.hide_automode} `);
470
+ }
471
+ }
472
+ this.TargetHeaterCoolerStateCached = this.TargetHeaterCoolerState;
473
+ this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerStateCached;
474
+ this.pushAirConditionerStatusChanges();
475
+ }
476
+
477
+ private TargetHeaterCoolerStateAUTO() {
478
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.AUTO;
479
+ this.CurrentMode = 1;
480
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set (AUTO) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
481
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
482
+ }
483
+
484
+ private TargetHeaterCoolerStateCOOL() {
485
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.COOL;
486
+ this.CurrentMode = 2;
487
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set (COOL) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
488
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
489
+ }
490
+
491
+ private TargetHeaterCoolerStateHEAT() {
492
+ this.TargetHeaterCoolerState = this.platform.Characteristic.TargetHeaterCoolerState.HEAT;
493
+ this.CurrentMode = 5;
494
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set (HEAT) TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
495
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
496
+ }
497
+
498
+ CurrentHeaterCoolerStateGet() {
499
+ if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
500
+ this.CurrentTemperatureUndefined();
501
+ if (this.CurrentTemperature < this.CurrentTemperatureCached) {
502
+ this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
503
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (COOLLING) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
504
+ } else if (this.CurrentTemperature > this.CurrentTemperatureCached) {
505
+ this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
506
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (HEATING) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
507
+ }
508
+ } else {
509
+ this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE;
510
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get (INACTIVE) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
511
+ }
512
+ this.CurrentHeaterCoolerStateCached = this.CurrentHeaterCoolerState;
513
+ this.accessory.context.CurrentHeaterCoolerState = this.CurrentHeaterCoolerStateCached;
514
+ return this.CurrentHeaterCoolerState;
515
+ }
516
+
517
+ private HeatingThresholdTemperatureGet() {
518
+ this.CurrentTemperatureUndefined;
519
+ this.CurrentTemperature = this.CurrentTemperatureCached;
520
+ this.HeatingThresholdTemperature = this.CurrentTemperatureCached;
521
+ this.HeatingThresholdTemperatureCached = this.HeatingThresholdTemperature;
522
+ this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperatureCached;
523
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
524
+ return this.HeatingThresholdTemperature;
525
+ }
526
+
527
+ private HeatingThresholdTemperatureSet(value: CharacteristicValue) {
528
+ this.CurrentTemperatureCached = this.CurrentTemperature;
529
+ this.CurrentTemperature = value;
530
+ this.HeatingThresholdTemperatureCached = this.HeatingThresholdTemperature;
531
+ this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperatureCached;
532
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set HeatingThresholdTemperature: ${this.HeatingThresholdTemperature},`
533
+ + ` CurrentTemperatureCached: ${this.CurrentTemperatureCached}`);
534
+ this.pushAirConditionerStatusChanges();
535
+ }
536
+
537
+
538
+ private CoolingThresholdTemperatureGet() {
539
+ this.CurrentTemperatureUndefined;
540
+ this.CurrentTemperature = this.CurrentTemperatureCached;
541
+ this.CoolingThresholdTemperature = this.CurrentTemperatureCached;
542
+ this.CoolingThresholdTemperatureCached = this.CoolingThresholdTemperature;
543
+ this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperatureCached;
544
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Get CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
545
+ return this.CoolingThresholdTemperature;
546
+ }
547
+
548
+ private CoolingThresholdTemperatureSet(value: CharacteristicValue) {
549
+ this.CurrentTemperatureCached = this.CurrentTemperature;
550
+ this.CurrentTemperature = value;
551
+ this.CoolingThresholdTemperatureCached = this.CoolingThresholdTemperature;
552
+ this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperatureCached;
553
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Set CoolingThresholdTemperature: ${this.CoolingThresholdTemperature},`
554
+ + ` CurrentTemperatureCached: ${this.CurrentTemperatureCached}`);
555
+ this.pushAirConditionerStatusChanges();
556
+ }
557
+
558
+ private CurrentTemperatureUndefined() {
559
+ if (this.CurrentTemperature === undefined) {
560
+ this.CurrentTemperature = 24;
561
+ }
562
+ if (this.CurrentTemperatureCached === undefined) {
563
+ this.CurrentTemperature = 30;
564
+ }
565
+ }
566
+
388
567
  /**
389
568
  * Logging for Device
390
569
  */