@switchbot/homebridge-switchbot 3.5.0-beta.6 → 3.5.0-beta.61
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.
- package/.vscode/settings.json +4 -1
- package/CHANGELOG.md +4 -1
- package/config.schema.json +120 -17
- package/dist/device/blindtilt.d.ts +23 -96
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +408 -779
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +26 -72
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +696 -822
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +14 -68
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +237 -606
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +14 -75
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +280 -658
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +15 -66
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +242 -544
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +19 -88
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +402 -805
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +59 -0
- package/dist/device/device.d.ts.map +1 -0
- package/dist/device/device.js +684 -0
- package/dist/device/device.js.map +1 -0
- package/dist/device/fan.d.ts +51 -0
- package/dist/device/fan.d.ts.map +1 -0
- package/dist/device/fan.js +535 -0
- package/dist/device/fan.js.map +1 -0
- package/dist/device/hub.d.ts +16 -60
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +246 -613
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +11 -66
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +232 -593
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +11 -64
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +185 -600
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +11 -69
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +277 -586
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +16 -63
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +241 -560
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +14 -64
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +181 -593
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +14 -65
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +170 -593
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +13 -69
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +178 -531
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +9 -57
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +92 -458
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +12 -63
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +197 -521
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +10 -65
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +139 -495
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +22 -16
- package/dist/homebridge-ui/server.js +1 -1
- package/dist/homebridge-ui/server.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +9 -49
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +309 -419
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +8 -39
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +72 -304
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +7 -36
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +34 -278
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +10 -43
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +100 -338
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +40 -0
- package/dist/irdevice/irdevice.d.ts.map +1 -0
- package/dist/irdevice/irdevice.js +330 -0
- package/dist/irdevice/irdevice.js.map +1 -0
- package/dist/irdevice/light.d.ts +12 -45
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +87 -357
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +19 -48
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +352 -546
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +8 -40
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +82 -321
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +7 -36
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +41 -284
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +7 -36
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +42 -287
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +19 -6
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +310 -169
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +62 -19
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +16 -552
- package/dist/settings.js.map +1 -1
- package/dist/utils.d.ts +77 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +638 -1
- package/dist/utils.js.map +1 -1
- package/eslint.config.js +96 -0
- package/package.json +19 -15
- package/src/custom.d.ts +2 -1
- package/src/device/blindtilt.ts +442 -814
- package/src/device/bot.ts +754 -915
- package/src/device/ceilinglight.ts +255 -633
- package/src/device/colorbulb.ts +295 -685
- package/src/device/contact.ts +277 -571
- package/src/device/curtain.ts +431 -835
- package/src/device/device.ts +709 -0
- package/src/device/fan.ts +591 -0
- package/src/device/hub.ts +286 -644
- package/src/device/humidifier.ts +266 -646
- package/src/device/iosensor.ts +220 -625
- package/src/device/lightstrip.ts +305 -620
- package/src/device/lock.ts +280 -600
- package/src/device/meter.ts +216 -617
- package/src/device/meterplus.ts +205 -619
- package/src/device/motion.ts +206 -556
- package/src/device/plug.ts +107 -490
- package/src/device/robotvacuumcleaner.ts +223 -550
- package/src/device/waterdetector.ts +160 -519
- package/src/homebridge-ui/public/index.html +22 -16
- package/src/homebridge-ui/server.ts +1 -1
- package/src/index.ts +4 -3
- package/src/irdevice/airconditioner.ts +333 -447
- package/src/irdevice/airpurifier.ts +92 -322
- package/src/irdevice/camera.ts +45 -294
- package/src/irdevice/fan.ts +115 -353
- package/src/irdevice/irdevice.ts +346 -0
- package/src/irdevice/light.ts +110 -385
- package/src/irdevice/other.ts +399 -616
- package/src/irdevice/tv.ts +103 -340
- package/src/irdevice/vacuumcleaner.ts +52 -306
- package/src/irdevice/waterheater.ts +53 -311
- package/src/platform.ts +355 -216
- package/src/settings.ts +116 -611
- package/src/utils.ts +642 -1
- package/src/device/waterdetector.json +0 -11
|
@@ -1,29 +1,20 @@
|
|
|
1
|
+
/* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* airconditioners.ts: @switchbot/homebridge-switchbot.
|
|
4
|
+
*/
|
|
1
5
|
import { request } from 'undici';
|
|
2
6
|
import { Devices } from '../settings.js';
|
|
7
|
+
import { irdeviceBase } from './irdevice.js';
|
|
3
8
|
/**
|
|
4
9
|
* Platform Accessory
|
|
5
10
|
* An instance of this class is created for each accessory your platform registers
|
|
6
11
|
* Each accessory may expose multiple services of different service types.
|
|
7
12
|
*/
|
|
8
|
-
export class AirConditioner {
|
|
13
|
+
export class AirConditioner extends irdeviceBase {
|
|
9
14
|
platform;
|
|
10
|
-
accessory;
|
|
11
|
-
device;
|
|
12
|
-
api;
|
|
13
|
-
log;
|
|
14
|
-
config;
|
|
15
|
-
hap;
|
|
16
15
|
// Services
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Active;
|
|
20
|
-
RotationSpeed;
|
|
21
|
-
FirmwareRevision;
|
|
22
|
-
CurrentTemperature;
|
|
23
|
-
ThresholdTemperature;
|
|
24
|
-
CurrentRelativeHumidity;
|
|
25
|
-
TargetHeaterCoolerState;
|
|
26
|
-
CurrentHeaterCoolerState;
|
|
16
|
+
HeaterCooler;
|
|
17
|
+
HumiditySensor;
|
|
27
18
|
// Others
|
|
28
19
|
state;
|
|
29
20
|
Busy;
|
|
@@ -31,73 +22,67 @@ export class AirConditioner {
|
|
|
31
22
|
CurrentMode;
|
|
32
23
|
ValidValues;
|
|
33
24
|
CurrentFanSpeed;
|
|
34
|
-
static MODE_AUTO;
|
|
35
|
-
static MODE_COOL;
|
|
36
|
-
static MODE_HEAT;
|
|
37
25
|
// Config
|
|
38
|
-
deviceLogging;
|
|
39
26
|
hide_automode;
|
|
40
27
|
set_max_heat;
|
|
41
28
|
set_min_heat;
|
|
42
29
|
set_max_cool;
|
|
43
30
|
set_min_cool;
|
|
44
|
-
disablePushOn;
|
|
45
|
-
disablePushOff;
|
|
46
31
|
meter;
|
|
47
|
-
disablePushDetail;
|
|
48
|
-
valid12 = [1, 2];
|
|
49
|
-
valid012 = [0, 1, 2];
|
|
50
32
|
constructor(platform, accessory, device) {
|
|
33
|
+
super(platform, accessory, device);
|
|
51
34
|
this.platform = platform;
|
|
52
|
-
this.accessory = accessory;
|
|
53
|
-
this.device = device;
|
|
54
|
-
this.api = this.platform.api;
|
|
55
|
-
this.log = this.platform.log;
|
|
56
|
-
this.config = this.platform.config;
|
|
57
|
-
this.hap = this.api.hap;
|
|
58
35
|
// default placeholders
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
};
|
|
55
|
+
}
|
|
72
56
|
// get the Television service if it exists, otherwise create a new Television service
|
|
73
57
|
// you can create multiple services for each accessory
|
|
74
|
-
const
|
|
75
|
-
(this.
|
|
76
|
-
|| accessory.addService(this.hap.Service.HeaterCooler)),
|
|
77
|
-
this.
|
|
78
|
-
if (!this.coolerService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
|
|
79
|
-
this.coolerService.addCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.displayName);
|
|
80
|
-
}
|
|
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);
|
|
81
62
|
// handle on / off events using the Active characteristic
|
|
82
|
-
this.
|
|
83
|
-
|
|
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));
|
|
84
67
|
this.ValidValues = this.hide_automode ? [1, 2] : [0, 1, 2];
|
|
85
68
|
if (this.device.irair?.meterType && this.device.irair?.meterId) {
|
|
86
69
|
const meterUuid = this.platform.api.hap.uuid.generate(`${this.device.irair.meterId}-${this.device.irair.meterType}`);
|
|
87
70
|
this.meter = this.platform.accessories.find((accessory) => accessory.UUID === meterUuid);
|
|
88
71
|
}
|
|
89
72
|
if (this.meter) {
|
|
90
|
-
this.
|
|
73
|
+
this.HumiditySensor.Service.getCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity)
|
|
74
|
+
.onGet(this.CurrentRelativeHumidityGet.bind(this));
|
|
91
75
|
}
|
|
92
|
-
this.
|
|
76
|
+
this.HeaterCooler.Service
|
|
93
77
|
.getCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState)
|
|
94
78
|
.setProps({
|
|
95
79
|
validValues: this.ValidValues,
|
|
96
80
|
})
|
|
97
81
|
.onGet(this.TargetHeaterCoolerStateGet.bind(this))
|
|
98
82
|
.onSet(this.TargetHeaterCoolerStateSet.bind(this));
|
|
99
|
-
this.
|
|
100
|
-
|
|
83
|
+
this.HeaterCooler.Service.getCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState)
|
|
84
|
+
.onGet(this.CurrentHeaterCoolerStateGet.bind(this));
|
|
85
|
+
this.HeaterCooler.Service
|
|
101
86
|
.getCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature)
|
|
102
87
|
.setProps({
|
|
103
88
|
minValue: this.set_min_heat,
|
|
@@ -106,7 +91,7 @@ export class AirConditioner {
|
|
|
106
91
|
})
|
|
107
92
|
.onGet(this.ThresholdTemperatureGet.bind(this))
|
|
108
93
|
.onSet(this.ThresholdTemperatureSet.bind(this));
|
|
109
|
-
this.
|
|
94
|
+
this.HeaterCooler.Service
|
|
110
95
|
.getCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature)
|
|
111
96
|
.setProps({
|
|
112
97
|
minValue: this.set_min_cool,
|
|
@@ -115,7 +100,7 @@ export class AirConditioner {
|
|
|
115
100
|
})
|
|
116
101
|
.onGet(this.ThresholdTemperatureGet.bind(this))
|
|
117
102
|
.onSet(this.ThresholdTemperatureSet.bind(this));
|
|
118
|
-
this.
|
|
103
|
+
this.HeaterCooler.Service
|
|
119
104
|
.getCharacteristic(this.hap.Characteristic.RotationSpeed)
|
|
120
105
|
.setProps({
|
|
121
106
|
format: 'int',
|
|
@@ -136,9 +121,9 @@ export class AirConditioner {
|
|
|
136
121
|
* AirConditioner: "command" "highSpeed" "default" = fan speed to high
|
|
137
122
|
*/
|
|
138
123
|
async pushAirConditionerOnChanges() {
|
|
139
|
-
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},` +
|
|
140
125
|
` disablePushOn: ${this.disablePushOn}`);
|
|
141
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
126
|
+
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
142
127
|
const commandType = await this.commandType();
|
|
143
128
|
const command = await this.commandOn();
|
|
144
129
|
const bodyChange = JSON.stringify({
|
|
@@ -150,9 +135,9 @@ export class AirConditioner {
|
|
|
150
135
|
}
|
|
151
136
|
}
|
|
152
137
|
async pushAirConditionerOffChanges() {
|
|
153
|
-
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},` +
|
|
154
139
|
` disablePushOff: ${this.disablePushOff}`);
|
|
155
|
-
if (this.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
140
|
+
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
156
141
|
const commandType = await this.commandType();
|
|
157
142
|
const command = await this.commandOff();
|
|
158
143
|
const bodyChange = JSON.stringify({
|
|
@@ -164,18 +149,18 @@ export class AirConditioner {
|
|
|
164
149
|
}
|
|
165
150
|
}
|
|
166
151
|
async pushAirConditionerStatusChanges() {
|
|
167
|
-
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},` +
|
|
168
153
|
` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
169
154
|
if (!this.Busy) {
|
|
170
155
|
this.Busy = true;
|
|
171
|
-
this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE;
|
|
156
|
+
this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE;
|
|
172
157
|
}
|
|
173
158
|
clearTimeout(this.Timeout);
|
|
174
159
|
// Make a new Timeout set to go off in 1000ms (1 second)
|
|
175
160
|
this.Timeout = setTimeout(this.pushAirConditionerDetailsChanges.bind(this), 1500);
|
|
176
161
|
}
|
|
177
162
|
async pushAirConditionerDetailsChanges() {
|
|
178
|
-
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},` +
|
|
179
164
|
` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
180
165
|
//await this.deviceContext();
|
|
181
166
|
if (this.CurrentMode === undefined) {
|
|
@@ -184,7 +169,7 @@ export class AirConditioner {
|
|
|
184
169
|
if (this.CurrentFanSpeed === undefined) {
|
|
185
170
|
this.CurrentFanSpeed = 1;
|
|
186
171
|
}
|
|
187
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
172
|
+
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
188
173
|
this.state = 'on';
|
|
189
174
|
}
|
|
190
175
|
else {
|
|
@@ -192,11 +177,11 @@ export class AirConditioner {
|
|
|
192
177
|
}
|
|
193
178
|
if (this.CurrentMode === 1) {
|
|
194
179
|
// Remove or make configurable?
|
|
195
|
-
this.ThresholdTemperature = 25;
|
|
180
|
+
this.HeaterCooler.ThresholdTemperature = 25;
|
|
196
181
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentMode: ${this.CurrentMode},` +
|
|
197
|
-
` ThresholdTemperature: ${this.ThresholdTemperature}`);
|
|
182
|
+
` ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
198
183
|
}
|
|
199
|
-
const parameter = `${this.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
|
|
184
|
+
const parameter = `${this.HeaterCooler.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
|
|
200
185
|
await this.UpdateCurrentHeaterCoolerState();
|
|
201
186
|
const bodyChange = JSON.stringify({
|
|
202
187
|
command: 'setAll',
|
|
@@ -206,22 +191,97 @@ export class AirConditioner {
|
|
|
206
191
|
await this.pushChanges(bodyChange);
|
|
207
192
|
}
|
|
208
193
|
async UpdateCurrentHeaterCoolerState() {
|
|
209
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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;
|
|
197
|
+
}
|
|
198
|
+
else if (this.HeaterCooler.Active) {
|
|
199
|
+
this.HeaterCooler.Active;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this.HeaterCooler.Active = this.accessory.context.Active;
|
|
203
|
+
}
|
|
204
|
+
if (this.HeaterCooler.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
|
|
205
|
+
this.HeaterCooler.CurrentTemperature = 24;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.HeaterCooler.CurrentTemperature = this.HeaterCooler.CurrentTemperature || this.accessory.context.CurrentTemperature;
|
|
209
|
+
}
|
|
210
|
+
if (this.HeaterCooler.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
|
|
211
|
+
this.HeaterCooler.ThresholdTemperature = 24;
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
this.HeaterCooler.ThresholdTemperature = this.HeaterCooler.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
|
|
215
|
+
}
|
|
216
|
+
if (this.HeaterCooler.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
|
|
217
|
+
this.HeaterCooler.RotationSpeed = 4;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
this.HeaterCooler.RotationSpeed = this.HeaterCooler.RotationSpeed || this.accessory.context.RotationSpeed;
|
|
221
|
+
}
|
|
222
|
+
if (this.device.irair?.hide_automode) {
|
|
223
|
+
this.hide_automode = this.device.irair?.hide_automode;
|
|
224
|
+
this.accessory.context.hide_automode = this.hide_automode;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this.hide_automode = this.device.irair?.hide_automode;
|
|
228
|
+
this.accessory.context.hide_automode = this.hide_automode;
|
|
229
|
+
}
|
|
230
|
+
if (this.device.irair?.set_max_heat) {
|
|
231
|
+
this.set_max_heat = this.device.irair?.set_max_heat;
|
|
232
|
+
this.accessory.context.set_max_heat = this.set_max_heat;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this.set_max_heat = 35;
|
|
236
|
+
this.accessory.context.set_max_heat = this.set_max_heat;
|
|
237
|
+
}
|
|
238
|
+
if (this.device.irair?.set_min_heat) {
|
|
239
|
+
this.set_min_heat = this.device.irair?.set_min_heat;
|
|
240
|
+
this.accessory.context.set_min_heat = this.set_min_heat;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
this.set_min_heat = 0;
|
|
244
|
+
this.accessory.context.set_min_heat = this.set_min_heat;
|
|
245
|
+
}
|
|
246
|
+
if (this.device.irair?.set_max_cool) {
|
|
247
|
+
this.set_max_cool = this.device.irair?.set_max_cool;
|
|
248
|
+
this.accessory.context.set_max_cool = this.set_max_cool;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
this.set_max_cool = 35;
|
|
252
|
+
this.accessory.context.set_max_cool = this.set_max_cool;
|
|
214
253
|
}
|
|
215
|
-
|
|
216
|
-
this.
|
|
217
|
-
this.
|
|
254
|
+
if (this.device.irair?.set_min_cool) {
|
|
255
|
+
this.set_min_cool = this.device.irair?.set_min_cool;
|
|
256
|
+
this.accessory.context.set_min_cool = this.set_min_cool;
|
|
218
257
|
}
|
|
219
258
|
else {
|
|
220
|
-
this.
|
|
259
|
+
this.set_min_cool = 0;
|
|
260
|
+
this.accessory.context.set_min_cool = this.set_min_cool;
|
|
261
|
+
}
|
|
262
|
+
if (this.meter) {
|
|
263
|
+
if (this.HumiditySensor.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
|
|
264
|
+
this.HumiditySensor.CurrentRelativeHumidity = 0;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
this.HumiditySensor.CurrentRelativeHumidity = this.HumiditySensor.CurrentRelativeHumidity
|
|
268
|
+
|| this.accessory.context.CurrentRelativeHumidity;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
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;
|
|
274
|
+
}
|
|
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;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE;
|
|
221
281
|
}
|
|
222
282
|
}
|
|
223
283
|
else {
|
|
224
|
-
this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.INACTIVE;
|
|
284
|
+
this.HeaterCooler.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.INACTIVE;
|
|
225
285
|
}
|
|
226
286
|
}
|
|
227
287
|
async pushChanges(bodyChange) {
|
|
@@ -239,8 +299,10 @@ export class AirConditioner {
|
|
|
239
299
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
240
300
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
|
|
241
301
|
if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
|
|
242
|
-
this.
|
|
302
|
+
this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
243
303
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
304
|
+
this.successLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
305
|
+
+ ` request to SwitchBot API, body: ${JSON.stringify(bodyChange)} sent successfully`);
|
|
244
306
|
this.updateHomeKitCharacteristics();
|
|
245
307
|
}
|
|
246
308
|
else {
|
|
@@ -268,9 +330,9 @@ export class AirConditioner {
|
|
|
268
330
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
269
331
|
+ `Using CurrentTemperature from ${this.meter.context.deviceType} (${this.meter.context.deviceID})`);
|
|
270
332
|
}
|
|
271
|
-
this.CurrentTemperature = this.accessory.context.CurrentTemperature || 24;
|
|
272
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentTemperature: ${this.CurrentTemperature}`);
|
|
273
|
-
return this.CurrentTemperature;
|
|
333
|
+
this.HeaterCooler.CurrentTemperature = this.accessory.context.CurrentTemperature || 24;
|
|
334
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
|
|
335
|
+
return this.HeaterCooler.CurrentTemperature;
|
|
274
336
|
}
|
|
275
337
|
async CurrentRelativeHumidityGet() {
|
|
276
338
|
if (this.meter?.context?.CurrentRelativeHumidity) {
|
|
@@ -278,19 +340,20 @@ export class AirConditioner {
|
|
|
278
340
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
279
341
|
+ `Using CurrentRelativeHumidity from ${this.meter.context.deviceType} (${this.meter.context.deviceID})`);
|
|
280
342
|
}
|
|
281
|
-
this.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity || 0;
|
|
282
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get
|
|
283
|
-
|
|
343
|
+
this.HumiditySensor.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity || 0;
|
|
344
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get`
|
|
345
|
+
+ ` CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`);
|
|
346
|
+
return this.HumiditySensor.CurrentRelativeHumidity;
|
|
284
347
|
}
|
|
285
348
|
async RotationSpeedGet() {
|
|
286
349
|
if (!this.CurrentFanSpeed || this.CurrentFanSpeed === 1) {
|
|
287
|
-
this.RotationSpeed = 4;
|
|
350
|
+
this.HeaterCooler.RotationSpeed = 4;
|
|
288
351
|
}
|
|
289
352
|
else {
|
|
290
|
-
this.RotationSpeed = this.CurrentFanSpeed - 1;
|
|
353
|
+
this.HeaterCooler.RotationSpeed = this.CurrentFanSpeed - 1;
|
|
291
354
|
}
|
|
292
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get RotationSpeed: ${this.RotationSpeed}`);
|
|
293
|
-
return this.RotationSpeed;
|
|
355
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
|
|
356
|
+
return this.HeaterCooler.RotationSpeed;
|
|
294
357
|
}
|
|
295
358
|
async RotationSpeedSet(value) {
|
|
296
359
|
if (value === 4) {
|
|
@@ -299,16 +362,16 @@ export class AirConditioner {
|
|
|
299
362
|
else {
|
|
300
363
|
this.CurrentFanSpeed = Number(value) + 1;
|
|
301
364
|
}
|
|
302
|
-
this.RotationSpeed = value;
|
|
365
|
+
this.HeaterCooler.RotationSpeed = value;
|
|
303
366
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
|
|
304
|
-
`Set RotationSpeed: ${this.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`);
|
|
367
|
+
`Set RotationSpeed: ${this.HeaterCooler.RotationSpeed}, CurrentFanSpeed: ${this.CurrentFanSpeed}`);
|
|
305
368
|
this.pushAirConditionerStatusChanges();
|
|
306
369
|
}
|
|
307
370
|
async ActiveSet(value) {
|
|
308
371
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
|
|
309
|
-
this.Active = value;
|
|
310
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
311
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.Active}`);
|
|
372
|
+
this.HeaterCooler.Active = value;
|
|
373
|
+
if (this.HeaterCooler.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
374
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOnChanges, Active: ${this.HeaterCooler.Active}`);
|
|
312
375
|
if (this.disablePushOn) {
|
|
313
376
|
this.pushAirConditionerStatusChanges();
|
|
314
377
|
}
|
|
@@ -317,16 +380,16 @@ export class AirConditioner {
|
|
|
317
380
|
}
|
|
318
381
|
}
|
|
319
382
|
else {
|
|
320
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
|
|
383
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.HeaterCooler.Active}`);
|
|
321
384
|
this.pushAirConditionerOffChanges();
|
|
322
385
|
}
|
|
323
386
|
}
|
|
324
387
|
async TargetHeaterCoolerStateGet() {
|
|
325
|
-
const targetState = this.TargetHeaterCoolerState || this.accessory.context.TargetHeaterCoolerState;
|
|
326
|
-
this.TargetHeaterCoolerState = this.ValidValues.includes(targetState) ? targetState : this.ValidValues[0];
|
|
327
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get (${this.getTargetHeaterCoolerStateName()})
|
|
328
|
-
`
|
|
329
|
-
return this.TargetHeaterCoolerState;
|
|
388
|
+
const targetState = this.HeaterCooler.TargetHeaterCoolerState || this.accessory.context.TargetHeaterCoolerState;
|
|
389
|
+
this.HeaterCooler.TargetHeaterCoolerState = this.ValidValues.includes(targetState) ? targetState : this.ValidValues[0];
|
|
390
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get (${this.getTargetHeaterCoolerStateName()}) TargetHeaterCoolerState:`
|
|
391
|
+
+ ` ${this.HeaterCooler.TargetHeaterCoolerState}, ValidValues: ${this.ValidValues}, hide_automode: ${this.hide_automode}`);
|
|
392
|
+
return this.HeaterCooler.TargetHeaterCoolerState;
|
|
330
393
|
}
|
|
331
394
|
async TargetHeaterCoolerStateSet(value) {
|
|
332
395
|
if (!this.hide_automode && value === this.hap.Characteristic.TargetHeaterCoolerState.AUTO) {
|
|
@@ -339,37 +402,40 @@ export class AirConditioner {
|
|
|
339
402
|
this.TargetHeaterCoolerStateCOOL();
|
|
340
403
|
}
|
|
341
404
|
else {
|
|
342
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},` +
|
|
405
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState},` +
|
|
343
406
|
` hide_automode: ${this.hide_automode} `);
|
|
344
407
|
}
|
|
345
408
|
this.pushAirConditionerStatusChanges();
|
|
346
409
|
}
|
|
347
410
|
async TargetHeaterCoolerStateAUTO() {
|
|
348
|
-
this.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.AUTO;
|
|
411
|
+
this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.AUTO;
|
|
349
412
|
this.CurrentMode = 1;
|
|
350
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (AUTO)
|
|
413
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (AUTO)`
|
|
414
|
+
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
351
415
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
|
|
352
416
|
}
|
|
353
417
|
async TargetHeaterCoolerStateCOOL() {
|
|
354
|
-
this.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.COOL;
|
|
418
|
+
this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.COOL;
|
|
355
419
|
this.CurrentMode = 2;
|
|
356
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (COOL)
|
|
420
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (COOL)`
|
|
421
|
+
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
357
422
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
|
|
358
423
|
}
|
|
359
424
|
async TargetHeaterCoolerStateHEAT() {
|
|
360
|
-
this.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.HEAT;
|
|
425
|
+
this.HeaterCooler.TargetHeaterCoolerState = this.hap.Characteristic.TargetHeaterCoolerState.HEAT;
|
|
361
426
|
this.CurrentMode = 5;
|
|
362
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (HEAT)
|
|
427
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set (HEAT)`
|
|
428
|
+
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
363
429
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Switchbot CurrentMode: ${this.CurrentMode}`);
|
|
364
430
|
}
|
|
365
431
|
async CurrentHeaterCoolerStateGet() {
|
|
366
432
|
await this.UpdateCurrentHeaterCoolerState();
|
|
367
433
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
|
|
368
|
-
` Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
369
|
-
return this.CurrentHeaterCoolerState;
|
|
434
|
+
` Get (${this.getTargetHeaterCoolerStateName()}) CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
435
|
+
return this.HeaterCooler.CurrentHeaterCoolerState;
|
|
370
436
|
}
|
|
371
437
|
getTargetHeaterCoolerStateName() {
|
|
372
|
-
switch (this.TargetHeaterCoolerState) {
|
|
438
|
+
switch (this.HeaterCooler.TargetHeaterCoolerState) {
|
|
373
439
|
case this.hap.Characteristic.TargetHeaterCoolerState.AUTO:
|
|
374
440
|
return 'AUTO';
|
|
375
441
|
case this.hap.Characteristic.TargetHeaterCoolerState.HEAT:
|
|
@@ -377,249 +443,36 @@ export class AirConditioner {
|
|
|
377
443
|
case this.hap.Characteristic.TargetHeaterCoolerState.COOL:
|
|
378
444
|
return 'COOL';
|
|
379
445
|
default:
|
|
380
|
-
return this.TargetHeaterCoolerState.toString();
|
|
446
|
+
return this.HeaterCooler.TargetHeaterCoolerState.toString();
|
|
381
447
|
}
|
|
382
448
|
}
|
|
383
449
|
async ThresholdTemperatureGet() {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
return this.ThresholdTemperature;
|
|
387
|
-
}
|
|
388
|
-
async ThresholdTemperatureSet(value) {
|
|
389
|
-
this.ThresholdTemperature = value;
|
|
390
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ThresholdTemperature: ${this.ThresholdTemperature},` +
|
|
391
|
-
` ThresholdTemperatureCached: ${this.accessory.context.ThresholdTemperature}`);
|
|
392
|
-
this.pushAirConditionerStatusChanges();
|
|
393
|
-
}
|
|
394
|
-
async updateHomeKitCharacteristics() {
|
|
395
|
-
// Active
|
|
396
|
-
if (this.Active === undefined) {
|
|
397
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
450
|
+
if (this.HeaterCooler.Active === undefined) {
|
|
451
|
+
this.HeaterCooler.Active = this.hap.Characteristic.Active.INACTIVE;
|
|
398
452
|
}
|
|
399
|
-
else {
|
|
400
|
-
this.
|
|
401
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.Active, this.Active);
|
|
402
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
403
|
-
}
|
|
404
|
-
// RotationSpeed
|
|
405
|
-
if (this.RotationSpeed === undefined) {
|
|
406
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
|
|
453
|
+
else if (this.HeaterCooler.Active) {
|
|
454
|
+
this.HeaterCooler.Active;
|
|
407
455
|
}
|
|
408
456
|
else {
|
|
409
|
-
this.
|
|
410
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.RotationSpeed);
|
|
411
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
457
|
+
this.HeaterCooler.Active = this.accessory.context.Active;
|
|
412
458
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
|
|
459
|
+
if (this.HeaterCooler.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
|
|
460
|
+
this.HeaterCooler.CurrentTemperature = 24;
|
|
416
461
|
}
|
|
417
462
|
else {
|
|
418
|
-
this.
|
|
419
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.CurrentTemperature);
|
|
420
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
421
|
-
}
|
|
422
|
-
// CurrentRelativeHumidity
|
|
423
|
-
if (this.meter) {
|
|
424
|
-
if (this.CurrentRelativeHumidity === undefined) {
|
|
425
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity;
|
|
429
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
|
|
430
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
431
|
-
}
|
|
463
|
+
this.HeaterCooler.CurrentTemperature = this.HeaterCooler.CurrentTemperature || this.accessory.context.CurrentTemperature;
|
|
432
464
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
|
|
465
|
+
if (this.HeaterCooler.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
|
|
466
|
+
this.HeaterCooler.ThresholdTemperature = 24;
|
|
436
467
|
}
|
|
437
468
|
else {
|
|
438
|
-
this.
|
|
439
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
|
|
440
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
|
|
469
|
+
this.HeaterCooler.ThresholdTemperature = this.HeaterCooler.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
|
|
441
470
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
471
|
+
if (this.HeaterCooler.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
|
|
472
|
+
this.HeaterCooler.RotationSpeed = 4;
|
|
445
473
|
}
|
|
446
474
|
else {
|
|
447
|
-
this.
|
|
448
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
|
|
449
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
|
|
450
|
-
` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
451
|
-
}
|
|
452
|
-
// ThresholdTemperature
|
|
453
|
-
if (this.ThresholdTemperature === undefined) {
|
|
454
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.ThresholdTemperature}`);
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
this.accessory.context.ThresholdTemperature = this.ThresholdTemperature;
|
|
458
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, this.ThresholdTemperature);
|
|
459
|
-
this.coolerService?.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, this.ThresholdTemperature);
|
|
460
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ThresholdTemperature: ${this.ThresholdTemperature}`);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
async disablePushOnChanges(device) {
|
|
464
|
-
if (device.disablePushOn === undefined) {
|
|
465
|
-
this.disablePushOn = false;
|
|
466
|
-
}
|
|
467
|
-
else {
|
|
468
|
-
this.disablePushOn = device.disablePushOn;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
async disablePushOffChanges(device) {
|
|
472
|
-
if (device.disablePushOff === undefined) {
|
|
473
|
-
this.disablePushOff = false;
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
476
|
-
this.disablePushOff = device.disablePushOff;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
async disablePushDetailChanges(device) {
|
|
480
|
-
if (device.disablePushDetail === undefined) {
|
|
481
|
-
this.disablePushDetail = false;
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
this.disablePushDetail = device.disablePushDetail;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
async commandType() {
|
|
488
|
-
let commandType;
|
|
489
|
-
if (this.device.customize) {
|
|
490
|
-
commandType = 'customize';
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
commandType = 'command';
|
|
494
|
-
}
|
|
495
|
-
return commandType;
|
|
496
|
-
}
|
|
497
|
-
async commandOn() {
|
|
498
|
-
let command;
|
|
499
|
-
if (this.device.customize && this.device.customOn) {
|
|
500
|
-
command = this.device.customOn;
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
command = 'turnOn';
|
|
504
|
-
}
|
|
505
|
-
return command;
|
|
506
|
-
}
|
|
507
|
-
async commandOff() {
|
|
508
|
-
let command;
|
|
509
|
-
if (this.device.customize && this.device.customOff) {
|
|
510
|
-
command = this.device.customOff;
|
|
511
|
-
}
|
|
512
|
-
else {
|
|
513
|
-
command = 'turnOff';
|
|
514
|
-
}
|
|
515
|
-
return command;
|
|
516
|
-
}
|
|
517
|
-
async statusCode(statusCode) {
|
|
518
|
-
switch (statusCode) {
|
|
519
|
-
case 151:
|
|
520
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this deviceType, statusCode: ${statusCode}`);
|
|
521
|
-
break;
|
|
522
|
-
case 152:
|
|
523
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found, statusCode: ${statusCode}`);
|
|
524
|
-
break;
|
|
525
|
-
case 160:
|
|
526
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported, statusCode: ${statusCode}`);
|
|
527
|
-
break;
|
|
528
|
-
case 161:
|
|
529
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline, statusCode: ${statusCode}`);
|
|
530
|
-
break;
|
|
531
|
-
case 171:
|
|
532
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
|
|
533
|
-
`Hub: ${this.device.hubDeviceId}`);
|
|
534
|
-
break;
|
|
535
|
-
case 190:
|
|
536
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
|
|
537
|
-
` Or command format is invalid, statusCode: ${statusCode}`);
|
|
538
|
-
break;
|
|
539
|
-
case 100:
|
|
540
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
|
|
541
|
-
break;
|
|
542
|
-
case 200:
|
|
543
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
|
|
544
|
-
break;
|
|
545
|
-
case 400:
|
|
546
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. `
|
|
547
|
-
+ `This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
|
|
548
|
-
break;
|
|
549
|
-
case 401:
|
|
550
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, `
|
|
551
|
-
+ `but the request has not been authenticated, statusCode: ${statusCode}`);
|
|
552
|
-
break;
|
|
553
|
-
case 403:
|
|
554
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not `
|
|
555
|
-
+ `have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
|
|
556
|
-
break;
|
|
557
|
-
case 404:
|
|
558
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, `
|
|
559
|
-
+ `statusCode: ${statusCode}`);
|
|
560
|
-
break;
|
|
561
|
-
case 406:
|
|
562
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via `
|
|
563
|
-
+ `the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
|
|
564
|
-
break;
|
|
565
|
-
case 415:
|
|
566
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType `
|
|
567
|
-
+ `header that is not supported by the server, statusCode: ${statusCode}`);
|
|
568
|
-
break;
|
|
569
|
-
case 422:
|
|
570
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, but `
|
|
571
|
-
+ `the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
|
|
572
|
-
break;
|
|
573
|
-
case 429:
|
|
574
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of `
|
|
575
|
-
+ `requests allowed for a given time window, statusCode: ${statusCode}`);
|
|
576
|
-
break;
|
|
577
|
-
case 500:
|
|
578
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings `
|
|
579
|
-
+ `servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
|
|
580
|
-
break;
|
|
581
|
-
default:
|
|
582
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode: ` +
|
|
583
|
-
`${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
async apiError({ e }) {
|
|
587
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.Active, e);
|
|
588
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.RotationSpeed, e);
|
|
589
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e);
|
|
590
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, e);
|
|
591
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, e);
|
|
592
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, e);
|
|
593
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, e);
|
|
594
|
-
this.coolerService.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, e);
|
|
595
|
-
}
|
|
596
|
-
async deviceContext() {
|
|
597
|
-
if (this.Active === undefined) {
|
|
598
|
-
this.Active = this.hap.Characteristic.Active.INACTIVE;
|
|
599
|
-
}
|
|
600
|
-
else if (this.Active) {
|
|
601
|
-
this.Active;
|
|
602
|
-
}
|
|
603
|
-
else {
|
|
604
|
-
this.Active = this.accessory.context.Active;
|
|
605
|
-
}
|
|
606
|
-
if (this.CurrentTemperature === undefined && this.accessory.context.CurrentTemperature === undefined) {
|
|
607
|
-
this.CurrentTemperature = 24;
|
|
608
|
-
}
|
|
609
|
-
else {
|
|
610
|
-
this.CurrentTemperature = this.CurrentTemperature || this.accessory.context.CurrentTemperature;
|
|
611
|
-
}
|
|
612
|
-
if (this.ThresholdTemperature === undefined && this.accessory.context.ThresholdTemperature === undefined) {
|
|
613
|
-
this.ThresholdTemperature = 24;
|
|
614
|
-
}
|
|
615
|
-
else {
|
|
616
|
-
this.ThresholdTemperature = this.ThresholdTemperature || this.accessory.context.ThresholdTemperature;
|
|
617
|
-
}
|
|
618
|
-
if (this.RotationSpeed === undefined && this.accessory.context.RotationSpeed === undefined) {
|
|
619
|
-
this.RotationSpeed = 4;
|
|
620
|
-
}
|
|
621
|
-
else {
|
|
622
|
-
this.RotationSpeed = this.RotationSpeed || this.accessory.context.RotationSpeed;
|
|
475
|
+
this.HeaterCooler.RotationSpeed = this.HeaterCooler.RotationSpeed || this.accessory.context.RotationSpeed;
|
|
623
476
|
}
|
|
624
477
|
if (this.device.irair?.hide_automode) {
|
|
625
478
|
this.hide_automode = this.device.irair?.hide_automode;
|
|
@@ -662,112 +515,149 @@ export class AirConditioner {
|
|
|
662
515
|
this.accessory.context.set_min_cool = this.set_min_cool;
|
|
663
516
|
}
|
|
664
517
|
if (this.meter) {
|
|
665
|
-
if (this.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
|
|
666
|
-
this.CurrentRelativeHumidity = 0;
|
|
518
|
+
if (this.HumiditySensor.CurrentRelativeHumidity === undefined && this.accessory.context.CurrentRelativeHumidity === undefined) {
|
|
519
|
+
this.HumiditySensor.CurrentRelativeHumidity = 0;
|
|
667
520
|
}
|
|
668
521
|
else {
|
|
669
|
-
this.CurrentRelativeHumidity = this.CurrentRelativeHumidity || this.accessory.context.CurrentRelativeHumidity;
|
|
522
|
+
this.HumiditySensor.CurrentRelativeHumidity = this.HumiditySensor.CurrentRelativeHumidity || this.accessory.context.CurrentRelativeHumidity;
|
|
670
523
|
}
|
|
671
524
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
675
|
-
}
|
|
525
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
526
|
+
return this.HeaterCooler.ThresholdTemperature;
|
|
676
527
|
}
|
|
677
|
-
async
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
528
|
+
async ThresholdTemperatureSet(value) {
|
|
529
|
+
this.HeaterCooler.ThresholdTemperature = value;
|
|
530
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature},` +
|
|
531
|
+
` ThresholdTemperatureCached: ${this.accessory.context.ThresholdTemperature}`);
|
|
532
|
+
this.pushAirConditionerStatusChanges();
|
|
533
|
+
}
|
|
534
|
+
async updateHomeKitCharacteristics() {
|
|
535
|
+
// Active
|
|
536
|
+
if (this.HeaterCooler.Active === undefined) {
|
|
537
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.HeaterCooler.Active}`);
|
|
681
538
|
}
|
|
682
|
-
|
|
683
|
-
|
|
539
|
+
else {
|
|
540
|
+
this.accessory.context.Active = this.HeaterCooler.Active;
|
|
541
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.Active, this.HeaterCooler.Active);
|
|
542
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.HeaterCooler.Active}`);
|
|
684
543
|
}
|
|
685
|
-
|
|
686
|
-
|
|
544
|
+
// RotationSpeed
|
|
545
|
+
if (this.HeaterCooler.RotationSpeed === undefined) {
|
|
546
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
this.accessory.context.RotationSpeed = this.HeaterCooler.RotationSpeed;
|
|
550
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.HeaterCooler.RotationSpeed);
|
|
551
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
552
|
+
+ ` RotationSpeed: ${this.HeaterCooler.RotationSpeed}`);
|
|
553
|
+
}
|
|
554
|
+
// CurrentTemperature
|
|
555
|
+
if (this.HeaterCooler.CurrentTemperature === undefined) {
|
|
556
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
|
|
687
557
|
}
|
|
688
|
-
|
|
689
|
-
|
|
558
|
+
else {
|
|
559
|
+
this.accessory.context.CurrentTemperature = this.HeaterCooler.CurrentTemperature;
|
|
560
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.HeaterCooler.CurrentTemperature);
|
|
561
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
562
|
+
+ ` CurrentTemperature: ${this.HeaterCooler.CurrentTemperature}`);
|
|
690
563
|
}
|
|
691
|
-
|
|
692
|
-
|
|
564
|
+
// CurrentRelativeHumidity
|
|
565
|
+
if (this.meter) {
|
|
566
|
+
if (this.HumiditySensor.CurrentRelativeHumidity === undefined) {
|
|
567
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
568
|
+
+ ` CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`);
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
this.accessory.context.CurrentRelativeHumidity = this.HumiditySensor.CurrentRelativeHumidity;
|
|
572
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, this.HumiditySensor.CurrentRelativeHumidity);
|
|
573
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
574
|
+
+ ` CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`);
|
|
575
|
+
}
|
|
693
576
|
}
|
|
694
|
-
|
|
695
|
-
|
|
577
|
+
// TargetHeaterCoolerState
|
|
578
|
+
if (this.HeaterCooler.TargetHeaterCoolerState === undefined) {
|
|
579
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
696
580
|
}
|
|
697
|
-
|
|
698
|
-
|
|
581
|
+
else {
|
|
582
|
+
this.accessory.context.TargetHeaterCoolerState = this.HeaterCooler.TargetHeaterCoolerState;
|
|
583
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, this.HeaterCooler.TargetHeaterCoolerState);
|
|
584
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
585
|
+
+ ` TargetHeaterCoolerState: ${this.HeaterCooler.TargetHeaterCoolerState}`);
|
|
699
586
|
}
|
|
700
|
-
|
|
701
|
-
|
|
587
|
+
// CurrentHeaterCoolerState
|
|
588
|
+
if (this.HeaterCooler.CurrentHeaterCoolerState === undefined) {
|
|
589
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
590
|
+
+ ` CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
702
591
|
}
|
|
703
|
-
|
|
704
|
-
|
|
592
|
+
else {
|
|
593
|
+
this.accessory.context.CurrentHeaterCoolerState = this.HeaterCooler.CurrentHeaterCoolerState;
|
|
594
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, this.HeaterCooler.CurrentHeaterCoolerState);
|
|
595
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` +
|
|
596
|
+
` updateCharacteristic CurrentHeaterCoolerState: ${this.HeaterCooler.CurrentHeaterCoolerState}`);
|
|
705
597
|
}
|
|
706
|
-
|
|
707
|
-
|
|
598
|
+
// ThresholdTemperature
|
|
599
|
+
if (this.HeaterCooler.ThresholdTemperature === undefined) {
|
|
600
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
708
601
|
}
|
|
709
|
-
|
|
710
|
-
this.
|
|
602
|
+
else {
|
|
603
|
+
this.accessory.context.ThresholdTemperature = this.HeaterCooler.ThresholdTemperature;
|
|
604
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, this.HeaterCooler.ThresholdTemperature);
|
|
605
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, this.HeaterCooler.ThresholdTemperature);
|
|
606
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
607
|
+
+ ` ThresholdTemperature: ${this.HeaterCooler.ThresholdTemperature}`);
|
|
711
608
|
}
|
|
712
609
|
}
|
|
713
|
-
async
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
610
|
+
async apiError({ e }) {
|
|
611
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
|
|
612
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, e);
|
|
613
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e);
|
|
614
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, e);
|
|
615
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState, e);
|
|
616
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, e);
|
|
617
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature, e);
|
|
618
|
+
this.HeaterCooler.Service.updateCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature, e);
|
|
619
|
+
}
|
|
620
|
+
async getAirConditionerConfigSettings(accessory, device) {
|
|
621
|
+
if (this.device.irair?.hide_automode) {
|
|
622
|
+
this.hide_automode = device.irair?.hide_automode;
|
|
623
|
+
accessory.context.hide_automode = this.hide_automode;
|
|
717
624
|
}
|
|
718
|
-
else
|
|
719
|
-
this.
|
|
720
|
-
|
|
625
|
+
else {
|
|
626
|
+
this.hide_automode = device.irair?.hide_automode;
|
|
627
|
+
accessory.context.hide_automode = this.hide_automode;
|
|
721
628
|
}
|
|
722
|
-
|
|
723
|
-
this.
|
|
724
|
-
|
|
629
|
+
if (this.device.irair?.set_max_heat) {
|
|
630
|
+
this.set_max_heat = device.irair?.set_max_heat;
|
|
631
|
+
accessory.context.set_max_heat = this.set_max_heat;
|
|
725
632
|
}
|
|
726
633
|
else {
|
|
727
|
-
this.
|
|
728
|
-
|
|
634
|
+
this.set_max_heat = 35;
|
|
635
|
+
accessory.context.set_max_heat = this.set_max_heat;
|
|
729
636
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
*/
|
|
734
|
-
infoLog(...log) {
|
|
735
|
-
if (this.enablingDeviceLogging()) {
|
|
736
|
-
this.platform.log.info(String(...log));
|
|
637
|
+
if (this.device.irair?.set_min_heat) {
|
|
638
|
+
this.set_min_heat = device.irair?.set_min_heat;
|
|
639
|
+
accessory.context.set_min_heat = this.set_min_heat;
|
|
737
640
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
this.platform.log.warn(String(...log));
|
|
641
|
+
else {
|
|
642
|
+
this.set_min_heat = 0;
|
|
643
|
+
accessory.context.set_min_heat = this.set_min_heat;
|
|
742
644
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
this.platform.log.warn('[DEBUG]', String(...log));
|
|
645
|
+
if (this.device.irair?.set_max_cool) {
|
|
646
|
+
this.set_max_cool = device.irair?.set_max_cool;
|
|
647
|
+
accessory.context.set_max_cool = this.set_max_cool;
|
|
747
648
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
this.platform.log.error(String(...log));
|
|
649
|
+
else {
|
|
650
|
+
this.set_max_cool = 35;
|
|
651
|
+
accessory.context.set_max_cool = this.set_max_cool;
|
|
752
652
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
this.platform.log.error('[DEBUG]', String(...log));
|
|
653
|
+
if (this.device.irair?.set_min_cool) {
|
|
654
|
+
this.set_min_cool = device.irair?.set_min_cool;
|
|
655
|
+
accessory.context.set_min_cool = this.set_min_cool;
|
|
757
656
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
if (this.deviceLogging === 'debug') {
|
|
762
|
-
this.platform.log.info('[DEBUG]', String(...log));
|
|
763
|
-
}
|
|
764
|
-
else {
|
|
765
|
-
this.platform.log.debug(String(...log));
|
|
766
|
-
}
|
|
657
|
+
else {
|
|
658
|
+
this.set_min_cool = 0;
|
|
659
|
+
accessory.context.set_min_cool = this.set_min_cool;
|
|
767
660
|
}
|
|
768
661
|
}
|
|
769
|
-
enablingDeviceLogging() {
|
|
770
|
-
return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
|
|
771
|
-
}
|
|
772
662
|
}
|
|
773
663
|
//# sourceMappingURL=airconditioner.js.map
|