homebridge-midea-platform 1.1.2-beta.9 → 1.2.0-beta.2
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/.husky/pre-commit +0 -0
- package/CHANGELOG.md +4 -2
- package/config.schema.json +46 -1
- package/dist/accessory/AccessoryFactory.d.ts +12 -12
- package/dist/accessory/AccessoryFactory.js +31 -31
- package/dist/accessory/AirConditionerAccessory.d.ts +92 -89
- package/dist/accessory/AirConditionerAccessory.d.ts.map +1 -1
- package/dist/accessory/AirConditionerAccessory.js +607 -584
- package/dist/accessory/AirConditionerAccessory.js.map +1 -1
- package/dist/accessory/BaseAccessory.d.ts +11 -11
- package/dist/accessory/BaseAccessory.js +21 -21
- package/dist/accessory/DehumidifierAccessory.d.ts +45 -45
- package/dist/accessory/DehumidifierAccessory.js +344 -344
- package/dist/accessory/DishwasherAccessory.d.ts +31 -0
- package/dist/accessory/DishwasherAccessory.d.ts.map +1 -0
- package/dist/accessory/DishwasherAccessory.js +64 -0
- package/dist/accessory/DishwasherAccessory.js.map +1 -0
- package/dist/accessory/ElectricWaterHeaterAccessory.d.ts +44 -44
- package/dist/accessory/ElectricWaterHeaterAccessory.js +176 -176
- package/dist/accessory/FanAccessory.d.ts +39 -39
- package/dist/accessory/FanAccessory.js +123 -123
- package/dist/accessory/FrontLoadWasherAccessory.d.ts +30 -30
- package/dist/accessory/FrontLoadWasherAccessory.d.ts.map +1 -1
- package/dist/accessory/FrontLoadWasherAccessory.js +66 -60
- package/dist/accessory/FrontLoadWasherAccessory.js.map +1 -1
- package/dist/accessory/GasWaterHeaterAccessory.d.ts +51 -51
- package/dist/accessory/GasWaterHeaterAccessory.js +216 -216
- package/dist/core/MideaCloud.d.ts +35 -35
- package/dist/core/MideaCloud.js +350 -350
- package/dist/core/MideaConstants.d.ts +50 -49
- package/dist/core/MideaConstants.d.ts.map +1 -1
- package/dist/core/MideaConstants.js +58 -57
- package/dist/core/MideaConstants.js.map +1 -1
- package/dist/core/MideaDevice.d.ts +76 -76
- package/dist/core/MideaDevice.js +409 -409
- package/dist/core/MideaDiscover.d.ts +35 -35
- package/dist/core/MideaDiscover.js +212 -212
- package/dist/core/MideaMessage.d.ts +75 -75
- package/dist/core/MideaMessage.js +184 -184
- package/dist/core/MideaPacketBuilder.d.ts +10 -10
- package/dist/core/MideaPacketBuilder.js +60 -60
- package/dist/core/MideaSecurity.d.ts +63 -63
- package/dist/core/MideaSecurity.js +251 -251
- package/dist/core/MideaUtils.d.ts +32 -32
- package/dist/core/MideaUtils.js +181 -181
- package/dist/devices/DeviceFactory.d.ts +13 -12
- package/dist/devices/DeviceFactory.d.ts.map +1 -1
- package/dist/devices/DeviceFactory.js +36 -33
- package/dist/devices/DeviceFactory.js.map +1 -1
- package/dist/devices/a1/MideaA1Device.d.ts +76 -76
- package/dist/devices/a1/MideaA1Device.d.ts.map +1 -1
- package/dist/devices/a1/MideaA1Device.js +145 -136
- package/dist/devices/a1/MideaA1Device.js.map +1 -1
- package/dist/devices/a1/MideaA1Message.d.ts +40 -40
- package/dist/devices/a1/MideaA1Message.js +198 -198
- package/dist/devices/ac/MideaACDevice.d.ts +104 -100
- package/dist/devices/ac/MideaACDevice.d.ts.map +1 -1
- package/dist/devices/ac/MideaACDevice.js +384 -381
- package/dist/devices/ac/MideaACDevice.js.map +1 -1
- package/dist/devices/ac/MideaACMessage.d.ts +94 -92
- package/dist/devices/ac/MideaACMessage.d.ts.map +1 -1
- package/dist/devices/ac/MideaACMessage.js +611 -589
- package/dist/devices/ac/MideaACMessage.js.map +1 -1
- package/dist/devices/db/MideaDBDevice.d.ts +29 -29
- package/dist/devices/db/MideaDBDevice.d.ts.map +1 -1
- package/dist/devices/db/MideaDBDevice.js +100 -88
- package/dist/devices/db/MideaDBDevice.js.map +1 -1
- package/dist/devices/db/MideaDBMessage.d.ts +32 -32
- package/dist/devices/db/MideaDBMessage.d.ts.map +1 -1
- package/dist/devices/db/MideaDBMessage.js +101 -101
- package/dist/devices/db/MideaDBMessage.js.map +1 -1
- package/dist/devices/e1/MideaE1Device.d.ts +57 -0
- package/dist/devices/e1/MideaE1Device.d.ts.map +1 -0
- package/dist/devices/e1/MideaE1Device.js +129 -0
- package/dist/devices/e1/MideaE1Device.js.map +1 -0
- package/dist/devices/e1/MideaE1Message.d.ts +29 -0
- package/dist/devices/e1/MideaE1Message.d.ts.map +1 -0
- package/dist/devices/e1/MideaE1Message.js +108 -0
- package/dist/devices/e1/MideaE1Message.js.map +1 -0
- package/dist/devices/e2/MideaE2Device.d.ts +44 -44
- package/dist/devices/e2/MideaE2Device.d.ts.map +1 -1
- package/dist/devices/e2/MideaE2Device.js +129 -119
- package/dist/devices/e2/MideaE2Device.js.map +1 -1
- package/dist/devices/e2/MideaE2Message.d.ts +33 -33
- package/dist/devices/e2/MideaE2Message.js +132 -132
- package/dist/devices/e3/MideaE3Device.d.ts +43 -43
- package/dist/devices/e3/MideaE3Device.d.ts.map +1 -1
- package/dist/devices/e3/MideaE3Device.js +137 -125
- package/dist/devices/e3/MideaE3Device.js.map +1 -1
- package/dist/devices/e3/MideaE3Message.d.ts +51 -51
- package/dist/devices/e3/MideaE3Message.js +136 -136
- package/dist/devices/fa/MideaFADevice.d.ts +36 -36
- package/dist/devices/fa/MideaFADevice.d.ts.map +1 -1
- package/dist/devices/fa/MideaFADevice.js +106 -92
- package/dist/devices/fa/MideaFADevice.js.map +1 -1
- package/dist/devices/fa/MideaFAMessage.d.ts +38 -38
- package/dist/devices/fa/MideaFAMessage.js +98 -98
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/platform.d.ts +60 -60
- package/dist/platform.js +212 -212
- package/dist/platformUtils.d.ts +106 -99
- package/dist/platformUtils.d.ts.map +1 -1
- package/dist/platformUtils.js +101 -97
- package/dist/platformUtils.js.map +1 -1
- package/dist/settings.d.ts +8 -8
- package/dist/settings.js +11 -11
- package/docs/e1.md +3 -0
- package/homebridge-ui/server.js +3 -0
- package/package.json +1 -1
|
@@ -1,585 +1,608 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const BaseAccessory_1 = __importDefault(require("./BaseAccessory"));
|
|
7
|
-
const platformUtils_1 = require("../platformUtils");
|
|
8
|
-
class AirConditionerAccessory extends BaseAccessory_1.default {
|
|
9
|
-
/*********************************************************************
|
|
10
|
-
* Constructor registers all the service types with Homebridge, registers
|
|
11
|
-
* a callback function with the MideaDevice class, and requests device status.
|
|
12
|
-
*/
|
|
13
|
-
constructor(platform, accessory, device, configDev) {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
15
|
-
super(platform, accessory, device, configDev);
|
|
16
|
-
this.device = device;
|
|
17
|
-
this.configDev = configDev;
|
|
18
|
-
this.service =
|
|
19
|
-
this.accessory.getService(this.platform.Service.HeaterCooler) || this.accessory.addService(this.platform.Service.HeaterCooler);
|
|
20
|
-
this.service.setCharacteristic(this.platform.Characteristic.Name, this.device.name);
|
|
21
|
-
this.service.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
|
|
22
|
-
this.service
|
|
23
|
-
.getCharacteristic(this.platform.Characteristic.TemperatureDisplayUnits)
|
|
24
|
-
.onGet(this.getTemperatureDisplayUnits.bind(this))
|
|
25
|
-
.onSet(this.setTemperatureDisplayUnits.bind(this));
|
|
26
|
-
this.service
|
|
27
|
-
.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState)
|
|
28
|
-
.onGet(this.getCurrentHeaterCoolerState.bind(this));
|
|
29
|
-
this.service
|
|
30
|
-
.getCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState)
|
|
31
|
-
.onGet(this.getTargetHeaterCoolerState.bind(this))
|
|
32
|
-
.onSet(this.setTargetHeaterCoolerState.bind(this))
|
|
33
|
-
.setProps({
|
|
34
|
-
validValues: this.configDev.AC_options.heatingCapable
|
|
35
|
-
? [
|
|
36
|
-
this.platform.Characteristic.TargetHeaterCoolerState.AUTO,
|
|
37
|
-
this.platform.Characteristic.TargetHeaterCoolerState.HEAT,
|
|
38
|
-
this.platform.Characteristic.TargetHeaterCoolerState.COOL,
|
|
39
|
-
]
|
|
40
|
-
: [this.platform.Characteristic.TargetHeaterCoolerState.AUTO, this.platform.Characteristic.TargetHeaterCoolerState.COOL],
|
|
41
|
-
});
|
|
42
|
-
this.service.getCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(this.getCurrentTemperature.bind(this));
|
|
43
|
-
this.service
|
|
44
|
-
.getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
|
|
45
|
-
.onGet(this.getTargetTemperature.bind(this))
|
|
46
|
-
.onSet(this.setTargetTemperature.bind(this))
|
|
47
|
-
.setProps({
|
|
48
|
-
minValue: this.configDev.AC_options.minTemp,
|
|
49
|
-
maxValue: this.configDev.AC_options.maxTemp,
|
|
50
|
-
minStep: this.configDev.AC_options.tempStep,
|
|
51
|
-
});
|
|
52
|
-
this.service
|
|
53
|
-
.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
|
|
54
|
-
.onGet(this.getTargetTemperature.bind(this))
|
|
55
|
-
.onSet(this.setTargetTemperature.bind(this))
|
|
56
|
-
.setProps({
|
|
57
|
-
minValue: this.configDev.AC_options.minTemp,
|
|
58
|
-
maxValue: this.configDev.AC_options.maxTemp,
|
|
59
|
-
minStep: this.configDev.AC_options.tempStep,
|
|
60
|
-
});
|
|
61
|
-
this.service
|
|
62
|
-
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
63
|
-
.onGet(this.getRotationSpeed.bind(this))
|
|
64
|
-
.onSet(this.setRotationSpeed.bind(this));
|
|
65
|
-
// Swing modes
|
|
66
|
-
if (this.configDev.AC_options.swing.mode !== platformUtils_1.SwingMode.NONE) {
|
|
67
|
-
this.service
|
|
68
|
-
.getCharacteristic(this.platform.Characteristic.SwingMode)
|
|
69
|
-
.onGet(this.getSwingMode.bind(this))
|
|
70
|
-
.onSet(this.setSwingMode.bind(this));
|
|
71
|
-
}
|
|
72
|
-
// Outdoor temperature sensor
|
|
73
|
-
this.outDoorTemperatureService = this.accessory.getServiceById(this.platform.Service.TemperatureSensor, 'Outdoor');
|
|
74
|
-
if (this.configDev.AC_options.outDoorTemp) {
|
|
75
|
-
(_a = this.outDoorTemperatureService) !== null && _a !== void 0 ? _a : (this.outDoorTemperatureService = this.accessory.addService(this.platform.Service.TemperatureSensor, `${this.device.name} Outdoor`, 'Outdoor'));
|
|
76
|
-
this.outDoorTemperatureService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Outdoor`);
|
|
77
|
-
this.outDoorTemperatureService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Outdoor`);
|
|
78
|
-
this.outDoorTemperatureService
|
|
79
|
-
.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
80
|
-
.onGet(this.getOutdoorTemperature.bind(this));
|
|
81
|
-
this.outDoorTemperatureService
|
|
82
|
-
.getCharacteristic(this.platform.Characteristic.StatusFault)
|
|
83
|
-
.onGet(() => this.device.attributes.OUTDOOR_TEMPERATURE === undefined
|
|
84
|
-
? this.platform.Characteristic.StatusFault.GENERAL_FAULT
|
|
85
|
-
: this.platform.Characteristic.StatusFault.NO_FAULT);
|
|
86
|
-
}
|
|
87
|
-
else if (this.outDoorTemperatureService) {
|
|
88
|
-
this.accessory.removeService(this.outDoorTemperatureService);
|
|
89
|
-
}
|
|
90
|
-
// Fan-only mode switch
|
|
91
|
-
this.fanOnlyService = this.accessory.getServiceById(this.platform.Service.Switch, 'FanOnly');
|
|
92
|
-
if (this.configDev.AC_options.fanOnlyModeSwitch) {
|
|
93
|
-
(_b = this.fanOnlyService) !== null && _b !== void 0 ? _b : (this.fanOnlyService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} FanOnly`, 'FanOnly'));
|
|
94
|
-
this.fanOnlyService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Fan-only Mode`);
|
|
95
|
-
this.fanOnlyService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Fan-only Mode`);
|
|
96
|
-
this.fanOnlyService
|
|
97
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
98
|
-
.onGet(this.getFanOnlyMode.bind(this))
|
|
99
|
-
.onSet(this.setFanOnlyMode.bind(this));
|
|
100
|
-
}
|
|
101
|
-
else if (this.fanOnlyService) {
|
|
102
|
-
this.accessory.removeService(this.fanOnlyService);
|
|
103
|
-
}
|
|
104
|
-
// Fan accessory
|
|
105
|
-
this.fanService = this.accessory.getServiceById(this.platform.Service.Fanv2, 'Fan');
|
|
106
|
-
if (this.configDev.AC_options.fanAccessory) {
|
|
107
|
-
(_c = this.fanService) !== null && _c !== void 0 ? _c : (this.fanService = this.accessory.addService(this.platform.Service.Fanv2, `${this.device.name} Fan`, 'Fan'));
|
|
108
|
-
this.fanService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Fan`);
|
|
109
|
-
this.fanService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Fan`);
|
|
110
|
-
this.fanService
|
|
111
|
-
.getCharacteristic(this.platform.Characteristic.Active)
|
|
112
|
-
.onGet(this.getActive.bind(this))
|
|
113
|
-
.onSet(this.setActive.bind(this));
|
|
114
|
-
this.fanService
|
|
115
|
-
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
116
|
-
.onGet(this.getRotationSpeed.bind(this))
|
|
117
|
-
.onSet(this.setRotationSpeed.bind(this));
|
|
118
|
-
this.fanService
|
|
119
|
-
.getCharacteristic(this.platform.Characteristic.TargetFanState)
|
|
120
|
-
.onGet(this.getFanState.bind(this))
|
|
121
|
-
.onSet(this.setFanState.bind(this));
|
|
122
|
-
this.fanService
|
|
123
|
-
.getCharacteristic(this.platform.Characteristic.SwingMode)
|
|
124
|
-
.onGet(this.getSwingMode.bind(this))
|
|
125
|
-
.onSet(this.setSwingMode.bind(this));
|
|
126
|
-
}
|
|
127
|
-
else if (this.fanService) {
|
|
128
|
-
this.accessory.removeService(this.fanService);
|
|
129
|
-
}
|
|
130
|
-
// Display switch
|
|
131
|
-
this.displayService = this.accessory.getServiceById(this.platform.Service.Switch, 'Display');
|
|
132
|
-
if (this.configDev.AC_options.displaySwitch.flag) {
|
|
133
|
-
this.device.set_alternate_switch_display(this.configDev.AC_options.displaySwitch.command);
|
|
134
|
-
(_d = this.displayService) !== null && _d !== void 0 ? _d : (this.displayService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Display`, 'Display'));
|
|
135
|
-
this.displayService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Display`);
|
|
136
|
-
this.displayService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Display`);
|
|
137
|
-
this.displayService
|
|
138
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
139
|
-
.onGet(this.getDisplayActive.bind(this))
|
|
140
|
-
.onSet(this.setDisplayActive.bind(this));
|
|
141
|
-
}
|
|
142
|
-
else if (this.displayService) {
|
|
143
|
-
this.accessory.removeService(this.displayService);
|
|
144
|
-
}
|
|
145
|
-
// Eco mode switch
|
|
146
|
-
this.ecoModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'EcoMode');
|
|
147
|
-
if (this.configDev.AC_options.ecoSwitch) {
|
|
148
|
-
(_e = this.ecoModeService) !== null && _e !== void 0 ? _e : (this.ecoModeService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Eco`, 'EcoMode'));
|
|
149
|
-
this.ecoModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Eco`);
|
|
150
|
-
this.ecoModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Eco`);
|
|
151
|
-
this.ecoModeService
|
|
152
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
153
|
-
.onGet(this.getEcoMode.bind(this))
|
|
154
|
-
.onSet(this.setEcoMode.bind(this));
|
|
155
|
-
}
|
|
156
|
-
else if (this.ecoModeService) {
|
|
157
|
-
this.accessory.removeService(this.ecoModeService);
|
|
158
|
-
}
|
|
159
|
-
// Breeze away switch
|
|
160
|
-
this.breezeAwayService = this.accessory.getServiceById(this.platform.Service.Switch, 'BreezeAway');
|
|
161
|
-
if (this.configDev.AC_options.breezeAwaySwitch) {
|
|
162
|
-
(_f = this.breezeAwayService) !== null && _f !== void 0 ? _f : (this.breezeAwayService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Breeze`, 'BreezeAway'));
|
|
163
|
-
this.breezeAwayService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Breeze`);
|
|
164
|
-
this.breezeAwayService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Breeze`);
|
|
165
|
-
this.breezeAwayService
|
|
166
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
167
|
-
.onGet(this.getBreezeAway.bind(this))
|
|
168
|
-
.onSet(this.setBreezeAway.bind(this));
|
|
169
|
-
}
|
|
170
|
-
else if (this.breezeAwayService) {
|
|
171
|
-
this.accessory.removeService(this.breezeAwayService);
|
|
172
|
-
}
|
|
173
|
-
// Dry mode switch
|
|
174
|
-
this.dryModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'DryMode');
|
|
175
|
-
if (this.configDev.AC_options.dryModeSwitch) {
|
|
176
|
-
(_g = this.dryModeService) !== null && _g !== void 0 ? _g : (this.dryModeService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Dry`, 'DryMode'));
|
|
177
|
-
this.dryModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Dry`);
|
|
178
|
-
this.dryModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Dry`);
|
|
179
|
-
this.dryModeService
|
|
180
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
181
|
-
.onGet(this.getDryMode.bind(this))
|
|
182
|
-
.onSet(this.setDryMode.bind(this));
|
|
183
|
-
}
|
|
184
|
-
else if (this.dryModeService) {
|
|
185
|
-
this.accessory.removeService(this.dryModeService);
|
|
186
|
-
}
|
|
187
|
-
this.boostModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'BoostMode');
|
|
188
|
-
if (this.configDev.AC_options.boostModeSwitch) {
|
|
189
|
-
(_h = this.boostModeService) !== null && _h !== void 0 ? _h : (this.boostModeService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Boost`, 'BoostMode'));
|
|
190
|
-
this.boostModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Boost`);
|
|
191
|
-
this.boostModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Boost`);
|
|
192
|
-
this.boostModeService
|
|
193
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
194
|
-
.onGet(this.getBoostMode.bind(this))
|
|
195
|
-
.onSet(this.setBoostMode.bind(this));
|
|
196
|
-
}
|
|
197
|
-
else if (this.boostModeService) {
|
|
198
|
-
this.accessory.removeService(this.boostModeService);
|
|
199
|
-
}
|
|
200
|
-
// Aux switch
|
|
201
|
-
this.auxService = this.accessory.getServiceById(this.platform.Service.Switch, 'Aux');
|
|
202
|
-
if (this.configDev.AC_options.auxHeatingSwitches) {
|
|
203
|
-
(_j = this.auxService) !== null && _j !== void 0 ? _j : (this.auxService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Aux`, 'Aux'));
|
|
204
|
-
this.auxService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Aux`);
|
|
205
|
-
this.auxService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Aux`);
|
|
206
|
-
this.auxService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getAux.bind(this)).onSet(this.setAux.bind(this));
|
|
207
|
-
}
|
|
208
|
-
else if (this.auxService) {
|
|
209
|
-
this.accessory.removeService(this.auxService);
|
|
210
|
-
}
|
|
211
|
-
// Aux+Heat switch
|
|
212
|
-
this.auxHeatingService = this.accessory.getServiceById(this.platform.Service.Switch, 'AuxHeating');
|
|
213
|
-
if (this.configDev.AC_options.auxHeatingSwitches) {
|
|
214
|
-
(_k = this.auxHeatingService) !== null && _k !== void 0 ? _k : (this.auxHeatingService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Aux+Heat`, 'AuxHeating'));
|
|
215
|
-
this.auxHeatingService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Aux+Heat`);
|
|
216
|
-
this.auxHeatingService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Aux+Heat`);
|
|
217
|
-
this.auxHeatingService
|
|
218
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
219
|
-
.onGet(this.getAuxHeating.bind(this))
|
|
220
|
-
.onSet(this.setAuxHeating.bind(this));
|
|
221
|
-
}
|
|
222
|
-
else if (this.auxHeatingService) {
|
|
223
|
-
this.accessory.removeService(this.auxHeatingService);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
this.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
this.
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
.
|
|
242
|
-
.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
this.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
this.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
case '
|
|
298
|
-
this.
|
|
299
|
-
break;
|
|
300
|
-
case '
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
case '
|
|
311
|
-
this.service.updateCharacteristic(this.platform.Characteristic.
|
|
312
|
-
break;
|
|
313
|
-
case '
|
|
314
|
-
|
|
315
|
-
break;
|
|
316
|
-
case '
|
|
317
|
-
|
|
318
|
-
break;
|
|
319
|
-
case '
|
|
320
|
-
(
|
|
321
|
-
break;
|
|
322
|
-
case '
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
case '
|
|
330
|
-
(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
return this.device.attributes.
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
return this.device.attributes.
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return this.device.attributes.POWER === true && this.device.attributes.
|
|
519
|
-
}
|
|
520
|
-
async
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
return this.
|
|
558
|
-
}
|
|
559
|
-
async
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseAccessory_1 = __importDefault(require("./BaseAccessory"));
|
|
7
|
+
const platformUtils_1 = require("../platformUtils");
|
|
8
|
+
class AirConditionerAccessory extends BaseAccessory_1.default {
|
|
9
|
+
/*********************************************************************
|
|
10
|
+
* Constructor registers all the service types with Homebridge, registers
|
|
11
|
+
* a callback function with the MideaDevice class, and requests device status.
|
|
12
|
+
*/
|
|
13
|
+
constructor(platform, accessory, device, configDev) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
15
|
+
super(platform, accessory, device, configDev);
|
|
16
|
+
this.device = device;
|
|
17
|
+
this.configDev = configDev;
|
|
18
|
+
this.service =
|
|
19
|
+
this.accessory.getService(this.platform.Service.HeaterCooler) || this.accessory.addService(this.platform.Service.HeaterCooler);
|
|
20
|
+
this.service.setCharacteristic(this.platform.Characteristic.Name, this.device.name);
|
|
21
|
+
this.service.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
|
|
22
|
+
this.service
|
|
23
|
+
.getCharacteristic(this.platform.Characteristic.TemperatureDisplayUnits)
|
|
24
|
+
.onGet(this.getTemperatureDisplayUnits.bind(this))
|
|
25
|
+
.onSet(this.setTemperatureDisplayUnits.bind(this));
|
|
26
|
+
this.service
|
|
27
|
+
.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState)
|
|
28
|
+
.onGet(this.getCurrentHeaterCoolerState.bind(this));
|
|
29
|
+
this.service
|
|
30
|
+
.getCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState)
|
|
31
|
+
.onGet(this.getTargetHeaterCoolerState.bind(this))
|
|
32
|
+
.onSet(this.setTargetHeaterCoolerState.bind(this))
|
|
33
|
+
.setProps({
|
|
34
|
+
validValues: this.configDev.AC_options.heatingCapable
|
|
35
|
+
? [
|
|
36
|
+
this.platform.Characteristic.TargetHeaterCoolerState.AUTO,
|
|
37
|
+
this.platform.Characteristic.TargetHeaterCoolerState.HEAT,
|
|
38
|
+
this.platform.Characteristic.TargetHeaterCoolerState.COOL,
|
|
39
|
+
]
|
|
40
|
+
: [this.platform.Characteristic.TargetHeaterCoolerState.AUTO, this.platform.Characteristic.TargetHeaterCoolerState.COOL],
|
|
41
|
+
});
|
|
42
|
+
this.service.getCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(this.getCurrentTemperature.bind(this));
|
|
43
|
+
this.service
|
|
44
|
+
.getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
|
|
45
|
+
.onGet(this.getTargetTemperature.bind(this))
|
|
46
|
+
.onSet(this.setTargetTemperature.bind(this))
|
|
47
|
+
.setProps({
|
|
48
|
+
minValue: this.configDev.AC_options.minTemp,
|
|
49
|
+
maxValue: this.configDev.AC_options.maxTemp,
|
|
50
|
+
minStep: this.configDev.AC_options.tempStep,
|
|
51
|
+
});
|
|
52
|
+
this.service
|
|
53
|
+
.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
|
|
54
|
+
.onGet(this.getTargetTemperature.bind(this))
|
|
55
|
+
.onSet(this.setTargetTemperature.bind(this))
|
|
56
|
+
.setProps({
|
|
57
|
+
minValue: this.configDev.AC_options.minTemp,
|
|
58
|
+
maxValue: this.configDev.AC_options.maxTemp,
|
|
59
|
+
minStep: this.configDev.AC_options.tempStep,
|
|
60
|
+
});
|
|
61
|
+
this.service
|
|
62
|
+
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
63
|
+
.onGet(this.getRotationSpeed.bind(this))
|
|
64
|
+
.onSet(this.setRotationSpeed.bind(this));
|
|
65
|
+
// Swing modes
|
|
66
|
+
if (this.configDev.AC_options.swing.mode !== platformUtils_1.SwingMode.NONE) {
|
|
67
|
+
this.service
|
|
68
|
+
.getCharacteristic(this.platform.Characteristic.SwingMode)
|
|
69
|
+
.onGet(this.getSwingMode.bind(this))
|
|
70
|
+
.onSet(this.setSwingMode.bind(this));
|
|
71
|
+
}
|
|
72
|
+
// Outdoor temperature sensor
|
|
73
|
+
this.outDoorTemperatureService = this.accessory.getServiceById(this.platform.Service.TemperatureSensor, 'Outdoor');
|
|
74
|
+
if (this.configDev.AC_options.outDoorTemp) {
|
|
75
|
+
(_a = this.outDoorTemperatureService) !== null && _a !== void 0 ? _a : (this.outDoorTemperatureService = this.accessory.addService(this.platform.Service.TemperatureSensor, `${this.device.name} Outdoor`, 'Outdoor'));
|
|
76
|
+
this.outDoorTemperatureService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Outdoor`);
|
|
77
|
+
this.outDoorTemperatureService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Outdoor`);
|
|
78
|
+
this.outDoorTemperatureService
|
|
79
|
+
.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
80
|
+
.onGet(this.getOutdoorTemperature.bind(this));
|
|
81
|
+
this.outDoorTemperatureService
|
|
82
|
+
.getCharacteristic(this.platform.Characteristic.StatusFault)
|
|
83
|
+
.onGet(() => this.device.attributes.OUTDOOR_TEMPERATURE === undefined
|
|
84
|
+
? this.platform.Characteristic.StatusFault.GENERAL_FAULT
|
|
85
|
+
: this.platform.Characteristic.StatusFault.NO_FAULT);
|
|
86
|
+
}
|
|
87
|
+
else if (this.outDoorTemperatureService) {
|
|
88
|
+
this.accessory.removeService(this.outDoorTemperatureService);
|
|
89
|
+
}
|
|
90
|
+
// Fan-only mode switch
|
|
91
|
+
this.fanOnlyService = this.accessory.getServiceById(this.platform.Service.Switch, 'FanOnly');
|
|
92
|
+
if (this.configDev.AC_options.fanOnlyModeSwitch) {
|
|
93
|
+
(_b = this.fanOnlyService) !== null && _b !== void 0 ? _b : (this.fanOnlyService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} FanOnly`, 'FanOnly'));
|
|
94
|
+
this.fanOnlyService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Fan-only Mode`);
|
|
95
|
+
this.fanOnlyService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Fan-only Mode`);
|
|
96
|
+
this.fanOnlyService
|
|
97
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
98
|
+
.onGet(this.getFanOnlyMode.bind(this))
|
|
99
|
+
.onSet(this.setFanOnlyMode.bind(this));
|
|
100
|
+
}
|
|
101
|
+
else if (this.fanOnlyService) {
|
|
102
|
+
this.accessory.removeService(this.fanOnlyService);
|
|
103
|
+
}
|
|
104
|
+
// Fan accessory
|
|
105
|
+
this.fanService = this.accessory.getServiceById(this.platform.Service.Fanv2, 'Fan');
|
|
106
|
+
if (this.configDev.AC_options.fanAccessory) {
|
|
107
|
+
(_c = this.fanService) !== null && _c !== void 0 ? _c : (this.fanService = this.accessory.addService(this.platform.Service.Fanv2, `${this.device.name} Fan`, 'Fan'));
|
|
108
|
+
this.fanService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Fan`);
|
|
109
|
+
this.fanService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Fan`);
|
|
110
|
+
this.fanService
|
|
111
|
+
.getCharacteristic(this.platform.Characteristic.Active)
|
|
112
|
+
.onGet(this.getActive.bind(this))
|
|
113
|
+
.onSet(this.setActive.bind(this));
|
|
114
|
+
this.fanService
|
|
115
|
+
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
116
|
+
.onGet(this.getRotationSpeed.bind(this))
|
|
117
|
+
.onSet(this.setRotationSpeed.bind(this));
|
|
118
|
+
this.fanService
|
|
119
|
+
.getCharacteristic(this.platform.Characteristic.TargetFanState)
|
|
120
|
+
.onGet(this.getFanState.bind(this))
|
|
121
|
+
.onSet(this.setFanState.bind(this));
|
|
122
|
+
this.fanService
|
|
123
|
+
.getCharacteristic(this.platform.Characteristic.SwingMode)
|
|
124
|
+
.onGet(this.getSwingMode.bind(this))
|
|
125
|
+
.onSet(this.setSwingMode.bind(this));
|
|
126
|
+
}
|
|
127
|
+
else if (this.fanService) {
|
|
128
|
+
this.accessory.removeService(this.fanService);
|
|
129
|
+
}
|
|
130
|
+
// Display switch
|
|
131
|
+
this.displayService = this.accessory.getServiceById(this.platform.Service.Switch, 'Display');
|
|
132
|
+
if (this.configDev.AC_options.displaySwitch.flag) {
|
|
133
|
+
this.device.set_alternate_switch_display(this.configDev.AC_options.displaySwitch.command);
|
|
134
|
+
(_d = this.displayService) !== null && _d !== void 0 ? _d : (this.displayService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Display`, 'Display'));
|
|
135
|
+
this.displayService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Display`);
|
|
136
|
+
this.displayService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Display`);
|
|
137
|
+
this.displayService
|
|
138
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
139
|
+
.onGet(this.getDisplayActive.bind(this))
|
|
140
|
+
.onSet(this.setDisplayActive.bind(this));
|
|
141
|
+
}
|
|
142
|
+
else if (this.displayService) {
|
|
143
|
+
this.accessory.removeService(this.displayService);
|
|
144
|
+
}
|
|
145
|
+
// Eco mode switch
|
|
146
|
+
this.ecoModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'EcoMode');
|
|
147
|
+
if (this.configDev.AC_options.ecoSwitch) {
|
|
148
|
+
(_e = this.ecoModeService) !== null && _e !== void 0 ? _e : (this.ecoModeService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Eco`, 'EcoMode'));
|
|
149
|
+
this.ecoModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Eco`);
|
|
150
|
+
this.ecoModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Eco`);
|
|
151
|
+
this.ecoModeService
|
|
152
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
153
|
+
.onGet(this.getEcoMode.bind(this))
|
|
154
|
+
.onSet(this.setEcoMode.bind(this));
|
|
155
|
+
}
|
|
156
|
+
else if (this.ecoModeService) {
|
|
157
|
+
this.accessory.removeService(this.ecoModeService);
|
|
158
|
+
}
|
|
159
|
+
// Breeze away switch
|
|
160
|
+
this.breezeAwayService = this.accessory.getServiceById(this.platform.Service.Switch, 'BreezeAway');
|
|
161
|
+
if (this.configDev.AC_options.breezeAwaySwitch) {
|
|
162
|
+
(_f = this.breezeAwayService) !== null && _f !== void 0 ? _f : (this.breezeAwayService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Breeze`, 'BreezeAway'));
|
|
163
|
+
this.breezeAwayService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Breeze`);
|
|
164
|
+
this.breezeAwayService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Breeze`);
|
|
165
|
+
this.breezeAwayService
|
|
166
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
167
|
+
.onGet(this.getBreezeAway.bind(this))
|
|
168
|
+
.onSet(this.setBreezeAway.bind(this));
|
|
169
|
+
}
|
|
170
|
+
else if (this.breezeAwayService) {
|
|
171
|
+
this.accessory.removeService(this.breezeAwayService);
|
|
172
|
+
}
|
|
173
|
+
// Dry mode switch
|
|
174
|
+
this.dryModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'DryMode');
|
|
175
|
+
if (this.configDev.AC_options.dryModeSwitch) {
|
|
176
|
+
(_g = this.dryModeService) !== null && _g !== void 0 ? _g : (this.dryModeService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Dry`, 'DryMode'));
|
|
177
|
+
this.dryModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Dry`);
|
|
178
|
+
this.dryModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Dry`);
|
|
179
|
+
this.dryModeService
|
|
180
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
181
|
+
.onGet(this.getDryMode.bind(this))
|
|
182
|
+
.onSet(this.setDryMode.bind(this));
|
|
183
|
+
}
|
|
184
|
+
else if (this.dryModeService) {
|
|
185
|
+
this.accessory.removeService(this.dryModeService);
|
|
186
|
+
}
|
|
187
|
+
this.boostModeService = this.accessory.getServiceById(this.platform.Service.Switch, 'BoostMode');
|
|
188
|
+
if (this.configDev.AC_options.boostModeSwitch) {
|
|
189
|
+
(_h = this.boostModeService) !== null && _h !== void 0 ? _h : (this.boostModeService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Boost`, 'BoostMode'));
|
|
190
|
+
this.boostModeService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Boost`);
|
|
191
|
+
this.boostModeService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Boost`);
|
|
192
|
+
this.boostModeService
|
|
193
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
194
|
+
.onGet(this.getBoostMode.bind(this))
|
|
195
|
+
.onSet(this.setBoostMode.bind(this));
|
|
196
|
+
}
|
|
197
|
+
else if (this.boostModeService) {
|
|
198
|
+
this.accessory.removeService(this.boostModeService);
|
|
199
|
+
}
|
|
200
|
+
// Aux switch
|
|
201
|
+
this.auxService = this.accessory.getServiceById(this.platform.Service.Switch, 'Aux');
|
|
202
|
+
if (this.configDev.AC_options.auxHeatingSwitches) {
|
|
203
|
+
(_j = this.auxService) !== null && _j !== void 0 ? _j : (this.auxService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Aux`, 'Aux'));
|
|
204
|
+
this.auxService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Aux`);
|
|
205
|
+
this.auxService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Aux`);
|
|
206
|
+
this.auxService.getCharacteristic(this.platform.Characteristic.On).onGet(this.getAux.bind(this)).onSet(this.setAux.bind(this));
|
|
207
|
+
}
|
|
208
|
+
else if (this.auxService) {
|
|
209
|
+
this.accessory.removeService(this.auxService);
|
|
210
|
+
}
|
|
211
|
+
// Aux+Heat switch
|
|
212
|
+
this.auxHeatingService = this.accessory.getServiceById(this.platform.Service.Switch, 'AuxHeating');
|
|
213
|
+
if (this.configDev.AC_options.auxHeatingSwitches) {
|
|
214
|
+
(_k = this.auxHeatingService) !== null && _k !== void 0 ? _k : (this.auxHeatingService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} Aux+Heat`, 'AuxHeating'));
|
|
215
|
+
this.auxHeatingService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Aux+Heat`);
|
|
216
|
+
this.auxHeatingService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Aux+Heat`);
|
|
217
|
+
this.auxHeatingService
|
|
218
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
219
|
+
.onGet(this.getAuxHeating.bind(this))
|
|
220
|
+
.onSet(this.setAuxHeating.bind(this));
|
|
221
|
+
}
|
|
222
|
+
else if (this.auxHeatingService) {
|
|
223
|
+
this.accessory.removeService(this.auxHeatingService);
|
|
224
|
+
}
|
|
225
|
+
this.selfCleanService = this.accessory.getServiceById(this.platform.Service.Switch, 'SelfClean');
|
|
226
|
+
if (this.configDev.AC_options.selfCleanSwitch) {
|
|
227
|
+
(_l = this.selfCleanService) !== null && _l !== void 0 ? _l : (this.selfCleanService = this.accessory.addService(this.platform.Service.Switch, `${this.device.name} SelfClean`, 'SelfClean'));
|
|
228
|
+
this.selfCleanService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} SelfClean`);
|
|
229
|
+
this.selfCleanService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} SelfClean`);
|
|
230
|
+
this.selfCleanService
|
|
231
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
232
|
+
.onGet(this.getSelfCleanState.bind(this))
|
|
233
|
+
.onSet(this.setSelfCleanState.bind(this));
|
|
234
|
+
}
|
|
235
|
+
else if (this.selfCleanService) {
|
|
236
|
+
this.accessory.removeService(this.selfCleanService);
|
|
237
|
+
}
|
|
238
|
+
const swingProps = this.configDev.AC_options.swing;
|
|
239
|
+
this.swingAngleMainControl =
|
|
240
|
+
swingProps.mode === platformUtils_1.SwingMode.VERTICAL || (swingProps.mode === platformUtils_1.SwingMode.BOTH && swingProps.angleMainControl === platformUtils_1.SwingAngle.VERTICAL)
|
|
241
|
+
? platformUtils_1.SwingAngle.VERTICAL
|
|
242
|
+
: platformUtils_1.SwingAngle.HORIZONTAL;
|
|
243
|
+
// Swing angle accessory
|
|
244
|
+
this.swingAngleService = this.accessory.getServiceById(this.platform.Service.WindowCovering, 'SwingAngle');
|
|
245
|
+
if (swingProps.mode !== platformUtils_1.SwingMode.NONE && swingProps.angleAccessory) {
|
|
246
|
+
(_m = this.swingAngleService) !== null && _m !== void 0 ? _m : (this.swingAngleService = this.accessory.addService(this.platform.Service.WindowCovering, `${this.device.name} Swing`, 'SwingAngle'));
|
|
247
|
+
this.swingAngleService.setCharacteristic(this.platform.Characteristic.Name, `${this.device.name} Swing`);
|
|
248
|
+
this.swingAngleService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${this.device.name} Swing`);
|
|
249
|
+
this.swingAngleService
|
|
250
|
+
.getCharacteristic(this.platform.Characteristic.CurrentPosition)
|
|
251
|
+
.onGet(this.getSwingAngleCurrentPosition.bind(this));
|
|
252
|
+
this.swingAngleService
|
|
253
|
+
.getCharacteristic(this.platform.Characteristic.TargetPosition)
|
|
254
|
+
.onGet(this.getSwingAngleTargetPosition.bind(this))
|
|
255
|
+
.onSet(this.setSwingAngleTargetPosition.bind(this));
|
|
256
|
+
this.swingAngleService
|
|
257
|
+
.getCharacteristic(this.platform.Characteristic.PositionState)
|
|
258
|
+
.onGet(this.getSwingAnglePositionState.bind(this));
|
|
259
|
+
if (swingProps.mode === platformUtils_1.SwingMode.BOTH) {
|
|
260
|
+
this.swingAngleService
|
|
261
|
+
.getCharacteristic(this.platform.Characteristic.CurrentHorizontalTiltAngle)
|
|
262
|
+
.onGet(this.getSwingAngleCurrentHorizontalTiltAngle.bind(this));
|
|
263
|
+
this.swingAngleService
|
|
264
|
+
.getCharacteristic(this.platform.Characteristic.TargetHorizontalTiltAngle)
|
|
265
|
+
.onGet(this.getSwingAngleTargetHorizontalTiltAngle.bind(this))
|
|
266
|
+
.onSet(this.setSwingAngleTargetHorizontalTiltAngle.bind(this));
|
|
267
|
+
this.swingAngleService
|
|
268
|
+
.getCharacteristic(this.platform.Characteristic.CurrentVerticalTiltAngle)
|
|
269
|
+
.onGet(this.getSwingAngleCurrentVerticalTiltAngle.bind(this));
|
|
270
|
+
this.swingAngleService
|
|
271
|
+
.getCharacteristic(this.platform.Characteristic.TargetVerticalTiltAngle)
|
|
272
|
+
.onGet(this.getSwingAngleTargetVerticalTiltAngle.bind(this))
|
|
273
|
+
.onSet(this.setSwingAngleTargetVerticalTiltAngle.bind(this));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// Misc
|
|
277
|
+
this.device.attributes.PROMPT_TONE = this.configDev.AC_options.audioFeedback;
|
|
278
|
+
this.device.attributes.TEMP_FAHRENHEIT = this.configDev.AC_options.fahrenheit;
|
|
279
|
+
}
|
|
280
|
+
/*********************************************************************
|
|
281
|
+
* Callback function called by MideaDevice whenever there is a change to
|
|
282
|
+
* any attribute value.
|
|
283
|
+
*/
|
|
284
|
+
async updateCharacteristics(attributes) {
|
|
285
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
286
|
+
for (const [k, v] of Object.entries(attributes)) {
|
|
287
|
+
this.platform.log.debug(`[${this.device.name}] Set attribute ${k} to: ${v}`);
|
|
288
|
+
let updateState = false;
|
|
289
|
+
switch (k.toLowerCase()) {
|
|
290
|
+
case 'power':
|
|
291
|
+
updateState = true;
|
|
292
|
+
break;
|
|
293
|
+
case 'temp_fahrenheit':
|
|
294
|
+
this.service.updateCharacteristic(this.platform.Characteristic.TemperatureDisplayUnits, this.getTemperatureDisplayUnits());
|
|
295
|
+
break;
|
|
296
|
+
case 'screen_display':
|
|
297
|
+
case 'screen_display_new':
|
|
298
|
+
(_a = this.displayService) === null || _a === void 0 ? void 0 : _a.updateCharacteristic(this.platform.Characteristic.On, this.getDisplayActive());
|
|
299
|
+
break;
|
|
300
|
+
case 'target_temperature':
|
|
301
|
+
// If MODE is 4 then device is heating. Therefore target temperature value must be heating target? Right?
|
|
302
|
+
if (this.device.attributes.MODE === 4) {
|
|
303
|
+
this.service.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.getTargetTemperature());
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
this.service.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, this.getTargetTemperature());
|
|
307
|
+
}
|
|
308
|
+
updateState = true;
|
|
309
|
+
break;
|
|
310
|
+
case 'indoor_temperature':
|
|
311
|
+
this.service.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.getCurrentTemperature());
|
|
312
|
+
break;
|
|
313
|
+
case 'outdoor_temperature':
|
|
314
|
+
(_b = this.outDoorTemperatureService) === null || _b === void 0 ? void 0 : _b.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.getOutdoorTemperature());
|
|
315
|
+
break;
|
|
316
|
+
case 'fan_speed':
|
|
317
|
+
updateState = true;
|
|
318
|
+
break;
|
|
319
|
+
case 'fan_auto':
|
|
320
|
+
(_c = this.fanService) === null || _c === void 0 ? void 0 : _c.updateCharacteristic(this.platform.Characteristic.TargetFanState, this.getFanState());
|
|
321
|
+
break;
|
|
322
|
+
case 'swing_vertical':
|
|
323
|
+
case 'swing_horizontal':
|
|
324
|
+
this.service.updateCharacteristic(this.platform.Characteristic.SwingMode, this.getSwingMode());
|
|
325
|
+
break;
|
|
326
|
+
case 'mode':
|
|
327
|
+
updateState = true;
|
|
328
|
+
break;
|
|
329
|
+
case 'eco_mode':
|
|
330
|
+
(_d = this.ecoModeService) === null || _d === void 0 ? void 0 : _d.updateCharacteristic(this.platform.Characteristic.On, this.getEcoMode());
|
|
331
|
+
break;
|
|
332
|
+
case 'indirect_wind':
|
|
333
|
+
(_e = this.breezeAwayService) === null || _e === void 0 ? void 0 : _e.updateCharacteristic(this.platform.Characteristic.On, this.getBreezeAway());
|
|
334
|
+
break;
|
|
335
|
+
case 'aux_heating':
|
|
336
|
+
(_f = this.auxHeatingService) === null || _f === void 0 ? void 0 : _f.updateCharacteristic(this.platform.Characteristic.On, this.getAuxHeating());
|
|
337
|
+
break;
|
|
338
|
+
case 'smart_eye':
|
|
339
|
+
(_g = this.auxService) === null || _g === void 0 ? void 0 : _g.updateCharacteristic(this.platform.Characteristic.On, this.getAux());
|
|
340
|
+
break;
|
|
341
|
+
case 'wind_swing_lr_angle':
|
|
342
|
+
case 'wind_swing_ud_angle':
|
|
343
|
+
(_h = this.swingAngleService) === null || _h === void 0 ? void 0 : _h.updateCharacteristic(this.platform.Characteristic.CurrentPosition, this.getSwingAngleCurrentPosition());
|
|
344
|
+
(_j = this.swingAngleService) === null || _j === void 0 ? void 0 : _j.updateCharacteristic(this.platform.Characteristic.TargetPosition, this.getSwingAngleTargetPosition());
|
|
345
|
+
if (this.configDev.AC_options.swing.mode === platformUtils_1.SwingMode.BOTH) {
|
|
346
|
+
(_k = this.swingAngleService) === null || _k === void 0 ? void 0 : _k.updateCharacteristic(this.platform.Characteristic.CurrentHorizontalTiltAngle, this.getSwingAngleCurrentHorizontalTiltAngle());
|
|
347
|
+
(_l = this.swingAngleService) === null || _l === void 0 ? void 0 : _l.updateCharacteristic(this.platform.Characteristic.CurrentVerticalTiltAngle, this.getSwingAngleCurrentVerticalTiltAngle());
|
|
348
|
+
(_m = this.swingAngleService) === null || _m === void 0 ? void 0 : _m.updateCharacteristic(this.platform.Characteristic.TargetHorizontalTiltAngle, this.getSwingAngleTargetHorizontalTiltAngle());
|
|
349
|
+
(_o = this.swingAngleService) === null || _o === void 0 ? void 0 : _o.updateCharacteristic(this.platform.Characteristic.TargetVerticalTiltAngle, this.getSwingAngleTargetVerticalTiltAngle());
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
case 'self_clean':
|
|
353
|
+
updateState = true;
|
|
354
|
+
(_p = this.selfCleanService) === null || _p === void 0 ? void 0 : _p.updateCharacteristic(this.platform.Characteristic.On, this.getSelfCleanState());
|
|
355
|
+
break;
|
|
356
|
+
default:
|
|
357
|
+
this.platform.log.debug(`[${this.device.name}] Attempt to set unsupported attribute ${k} to ${v}`);
|
|
358
|
+
}
|
|
359
|
+
if (updateState) {
|
|
360
|
+
this.service.updateCharacteristic(this.platform.Characteristic.Active, this.getActive());
|
|
361
|
+
this.service.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.getTargetHeaterCoolerState());
|
|
362
|
+
this.service.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.getCurrentHeaterCoolerState());
|
|
363
|
+
this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.getRotationSpeed());
|
|
364
|
+
(_q = this.fanOnlyService) === null || _q === void 0 ? void 0 : _q.updateCharacteristic(this.platform.Characteristic.On, this.getFanOnlyMode());
|
|
365
|
+
(_r = this.fanService) === null || _r === void 0 ? void 0 : _r.updateCharacteristic(this.platform.Characteristic.Active, this.getActive());
|
|
366
|
+
(_s = this.fanService) === null || _s === void 0 ? void 0 : _s.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.getRotationSpeed());
|
|
367
|
+
(_t = this.dryModeService) === null || _t === void 0 ? void 0 : _t.updateCharacteristic(this.platform.Characteristic.On, this.getDryMode());
|
|
368
|
+
(_u = this.displayService) === null || _u === void 0 ? void 0 : _u.updateCharacteristic(this.platform.Characteristic.On, this.getDisplayActive());
|
|
369
|
+
(_v = this.ecoModeService) === null || _v === void 0 ? void 0 : _v.updateCharacteristic(this.platform.Characteristic.On, this.getEcoMode());
|
|
370
|
+
(_w = this.breezeAwayService) === null || _w === void 0 ? void 0 : _w.updateCharacteristic(this.platform.Characteristic.On, this.getBreezeAway());
|
|
371
|
+
(_x = this.auxService) === null || _x === void 0 ? void 0 : _x.updateCharacteristic(this.platform.Characteristic.On, this.getAux());
|
|
372
|
+
(_y = this.auxHeatingService) === null || _y === void 0 ? void 0 : _y.updateCharacteristic(this.platform.Characteristic.On, this.getAuxHeating());
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/*********************************************************************
|
|
377
|
+
* Callback functions for each Homebridge/HomeKit service
|
|
378
|
+
*
|
|
379
|
+
*/
|
|
380
|
+
getActive() {
|
|
381
|
+
// Show as inactive if device is off
|
|
382
|
+
return this.device.attributes.POWER ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
|
|
383
|
+
}
|
|
384
|
+
async setActive(value) {
|
|
385
|
+
var _a;
|
|
386
|
+
await this.device.set_attribute({ POWER: !!value });
|
|
387
|
+
this.device.attributes.SCREEN_DISPLAY = !!value;
|
|
388
|
+
(_a = this.displayService) === null || _a === void 0 ? void 0 : _a.updateCharacteristic(this.platform.Characteristic.On, !!value);
|
|
389
|
+
}
|
|
390
|
+
getTemperatureDisplayUnits() {
|
|
391
|
+
return this.device.attributes.TEMP_FAHRENHEIT
|
|
392
|
+
? this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT
|
|
393
|
+
: this.platform.Characteristic.TemperatureDisplayUnits.CELSIUS;
|
|
394
|
+
}
|
|
395
|
+
async setTemperatureDisplayUnits(value) {
|
|
396
|
+
await this.device.set_attribute({ TEMP_FAHRENHEIT: value === this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT });
|
|
397
|
+
}
|
|
398
|
+
getCurrentHeaterCoolerState() {
|
|
399
|
+
var _a;
|
|
400
|
+
if (this.device.attributes.POWER && this.device.attributes.MODE > 0 && this.device.attributes.MODE < 5) {
|
|
401
|
+
if (this.device.attributes.TARGET_TEMPERATURE < ((_a = this.device.attributes.INDOOR_TEMPERATURE) !== null && _a !== void 0 ? _a : 0)) {
|
|
402
|
+
if ([1, 2].includes(this.device.attributes.MODE)) {
|
|
403
|
+
return this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
return this.platform.Characteristic.CurrentHeaterCoolerState.IDLE;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
else if (this.device.attributes.TARGET_TEMPERATURE === this.device.attributes.INDOOR_TEMPERATURE) {
|
|
410
|
+
return this.platform.Characteristic.CurrentHeaterCoolerState.IDLE;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
if (this.device.attributes.MODE === 4) {
|
|
414
|
+
return this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
return this.platform.Characteristic.CurrentHeaterCoolerState.IDLE;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
return this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
getTargetHeaterCoolerState() {
|
|
426
|
+
if (this.device.attributes.MODE === 2) {
|
|
427
|
+
return this.platform.Characteristic.TargetHeaterCoolerState.COOL;
|
|
428
|
+
}
|
|
429
|
+
else if (this.device.attributes.MODE === 4) {
|
|
430
|
+
return this.platform.Characteristic.TargetHeaterCoolerState.HEAT;
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
return this.platform.Characteristic.TargetHeaterCoolerState.AUTO;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
async setTargetHeaterCoolerState(value) {
|
|
437
|
+
switch (value) {
|
|
438
|
+
case this.platform.Characteristic.TargetHeaterCoolerState.AUTO:
|
|
439
|
+
await this.device.set_attribute({ POWER: true, MODE: 1 });
|
|
440
|
+
break;
|
|
441
|
+
case this.platform.Characteristic.TargetHeaterCoolerState.COOL:
|
|
442
|
+
await this.device.set_attribute({ POWER: true, MODE: 2 });
|
|
443
|
+
break;
|
|
444
|
+
case this.platform.Characteristic.TargetHeaterCoolerState.HEAT:
|
|
445
|
+
await this.device.set_attribute({ POWER: true, MODE: 4 });
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
getCurrentTemperature() {
|
|
450
|
+
var _a;
|
|
451
|
+
return (_a = this.device.attributes.INDOOR_TEMPERATURE) !== null && _a !== void 0 ? _a : this.configDev.AC_options.minTemp;
|
|
452
|
+
}
|
|
453
|
+
getTargetTemperature() {
|
|
454
|
+
return Math.max(this.configDev.AC_options.minTemp, Math.min(this.configDev.AC_options.maxTemp, this.device.attributes.TARGET_TEMPERATURE));
|
|
455
|
+
}
|
|
456
|
+
getFanOnlyMode() {
|
|
457
|
+
return this.device.attributes.POWER === true && this.device.attributes.MODE === 5;
|
|
458
|
+
}
|
|
459
|
+
async setFanOnlyMode(value) {
|
|
460
|
+
if (value) {
|
|
461
|
+
await this.device.set_attribute({ POWER: true, MODE: 5 });
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
await this.device.set_attribute({ POWER: false, MODE: 0 });
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
getFanState() {
|
|
468
|
+
return this.device.attributes.FAN_AUTO;
|
|
469
|
+
}
|
|
470
|
+
async setFanState(value) {
|
|
471
|
+
await this.device.set_fan_auto(value === this.platform.Characteristic.TargetFanState.AUTO);
|
|
472
|
+
}
|
|
473
|
+
async setTargetTemperature(value) {
|
|
474
|
+
value = Math.max(this.configDev.AC_options.minTemp, Math.min(this.configDev.AC_options.maxTemp, value));
|
|
475
|
+
await this.device.set_target_temperature(value);
|
|
476
|
+
}
|
|
477
|
+
getSwingMode() {
|
|
478
|
+
return this.device.attributes.SWING_HORIZONTAL || this.device.attributes.SWING_VERTICAL
|
|
479
|
+
? this.platform.Characteristic.SwingMode.SWING_ENABLED
|
|
480
|
+
: this.platform.Characteristic.SwingMode.SWING_DISABLED;
|
|
481
|
+
}
|
|
482
|
+
async setSwingMode(value) {
|
|
483
|
+
switch (value) {
|
|
484
|
+
case this.platform.Characteristic.SwingMode.SWING_ENABLED:
|
|
485
|
+
await this.device.set_swing([platformUtils_1.SwingMode.HORIZONTAL, platformUtils_1.SwingMode.BOTH].includes(this.configDev.AC_options.swing.mode), [platformUtils_1.SwingMode.VERTICAL, platformUtils_1.SwingMode.BOTH].includes(this.configDev.AC_options.swing.mode));
|
|
486
|
+
break;
|
|
487
|
+
case this.platform.Characteristic.SwingMode.SWING_DISABLED:
|
|
488
|
+
await this.device.set_swing(false, false);
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
getRotationSpeed() {
|
|
493
|
+
var _a;
|
|
494
|
+
return Math.min(100, (_a = this.device.attributes.FAN_SPEED) !== null && _a !== void 0 ? _a : 0);
|
|
495
|
+
}
|
|
496
|
+
async setRotationSpeed(value) {
|
|
497
|
+
await this.device.set_attribute({ FAN_SPEED: value });
|
|
498
|
+
}
|
|
499
|
+
getOutdoorTemperature() {
|
|
500
|
+
var _a;
|
|
501
|
+
return (_a = this.device.attributes.OUTDOOR_TEMPERATURE) !== null && _a !== void 0 ? _a : -270;
|
|
502
|
+
}
|
|
503
|
+
getDisplayActive() {
|
|
504
|
+
return this.device.attributes.SCREEN_DISPLAY === true;
|
|
505
|
+
}
|
|
506
|
+
async setDisplayActive(value) {
|
|
507
|
+
if (this.device.attributes.POWER) {
|
|
508
|
+
await this.device.set_attribute({ SCREEN_DISPLAY: !!value });
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
getEcoMode() {
|
|
512
|
+
return this.device.attributes.POWER === true && this.device.attributes.ECO_MODE;
|
|
513
|
+
}
|
|
514
|
+
async setEcoMode(value) {
|
|
515
|
+
await this.device.set_attribute({ ECO_MODE: !!value });
|
|
516
|
+
}
|
|
517
|
+
getBreezeAway() {
|
|
518
|
+
return this.device.attributes.POWER === true && this.device.attributes.INDIRECT_WIND;
|
|
519
|
+
}
|
|
520
|
+
async setBreezeAway(value) {
|
|
521
|
+
await this.device.set_attribute({ INDIRECT_WIND: !!value });
|
|
522
|
+
}
|
|
523
|
+
getDryMode() {
|
|
524
|
+
return this.device.attributes.POWER === true && this.device.attributes.MODE === 3;
|
|
525
|
+
}
|
|
526
|
+
async setDryMode(value) {
|
|
527
|
+
if (value) {
|
|
528
|
+
await this.device.set_attribute({ POWER: true, MODE: 3 });
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
await this.device.set_attribute({ POWER: false, MODE: 0 });
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
getBoostMode() {
|
|
535
|
+
return this.device.attributes.POWER === true && this.device.attributes.BOOST_MODE;
|
|
536
|
+
}
|
|
537
|
+
async setBoostMode(value) {
|
|
538
|
+
if (value) {
|
|
539
|
+
await this.device.set_attribute({ POWER: true, BOOST_MODE: true });
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
await this.device.set_attribute({ BOOST_MODE: false });
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
getAux() {
|
|
546
|
+
return this.device.attributes.POWER === true && this.device.attributes.SMART_EYE === true;
|
|
547
|
+
}
|
|
548
|
+
async setAux(value) {
|
|
549
|
+
if (value) {
|
|
550
|
+
await this.device.set_attribute({ SMART_EYE: true });
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
await this.device.set_attribute({ SMART_EYE: false });
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
getAuxHeating() {
|
|
557
|
+
return this.device.attributes.POWER === true && this.device.attributes.AUX_HEATING === true;
|
|
558
|
+
}
|
|
559
|
+
async setAuxHeating(value) {
|
|
560
|
+
if (value) {
|
|
561
|
+
await this.device.set_attribute({ AUX_HEATING: true });
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
await this.device.set_attribute({ AUX_HEATING: false });
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
getSelfCleanState() {
|
|
568
|
+
return this.device.attributes.SELF_CLEAN === true;
|
|
569
|
+
}
|
|
570
|
+
async setSelfCleanState(value) {
|
|
571
|
+
await this.device.set_self_clean(value === true);
|
|
572
|
+
}
|
|
573
|
+
getSwingAngleCurrentPosition() {
|
|
574
|
+
const value = this.swingAngleMainControl === platformUtils_1.SwingAngle.VERTICAL
|
|
575
|
+
? this.device.attributes.WIND_SWING_UD_ANGLE
|
|
576
|
+
: this.device.attributes.WIND_SWING_LR_ANGLE;
|
|
577
|
+
return value === 1 ? 0 : value;
|
|
578
|
+
}
|
|
579
|
+
getSwingAngleTargetPosition() {
|
|
580
|
+
return this.getSwingAngleCurrentPosition();
|
|
581
|
+
}
|
|
582
|
+
async setSwingAngleTargetPosition(value) {
|
|
583
|
+
await this.device.set_swing_angle(this.swingAngleMainControl, Math.max(1, value));
|
|
584
|
+
}
|
|
585
|
+
getSwingAnglePositionState() {
|
|
586
|
+
return this.platform.Characteristic.PositionState.STOPPED;
|
|
587
|
+
}
|
|
588
|
+
getSwingAngleCurrentHorizontalTiltAngle() {
|
|
589
|
+
return this.device.attributes.WIND_SWING_LR_ANGLE === 1 ? 0 : this.device.attributes.WIND_SWING_LR_ANGLE;
|
|
590
|
+
}
|
|
591
|
+
getSwingAngleTargetHorizontalTiltAngle() {
|
|
592
|
+
return this.getSwingAngleCurrentHorizontalTiltAngle();
|
|
593
|
+
}
|
|
594
|
+
async setSwingAngleTargetHorizontalTiltAngle(value) {
|
|
595
|
+
await this.device.set_swing_angle(platformUtils_1.SwingAngle.HORIZONTAL, Math.max(1, value));
|
|
596
|
+
}
|
|
597
|
+
getSwingAngleCurrentVerticalTiltAngle() {
|
|
598
|
+
return this.device.attributes.WIND_SWING_UD_ANGLE === 1 ? 0 : this.device.attributes.WIND_SWING_UD_ANGLE;
|
|
599
|
+
}
|
|
600
|
+
getSwingAngleTargetVerticalTiltAngle() {
|
|
601
|
+
return this.getSwingAngleCurrentVerticalTiltAngle();
|
|
602
|
+
}
|
|
603
|
+
async setSwingAngleTargetVerticalTiltAngle(value) {
|
|
604
|
+
await this.device.set_swing_angle(platformUtils_1.SwingAngle.VERTICAL, Math.max(1, value));
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
exports.default = AirConditionerAccessory;
|
|
585
608
|
//# sourceMappingURL=AirConditionerAccessory.js.map
|