homebridge-midea-platform 1.2.0-beta.2 → 1.2.0-beta.4
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/AC_ori.lua +5140 -0
- package/config.schema.json +14 -2
- package/dist/accessory/AccessoryFactory.d.ts +13 -12
- package/dist/accessory/AccessoryFactory.d.ts.map +1 -1
- package/dist/accessory/AccessoryFactory.js +37 -31
- package/dist/accessory/AccessoryFactory.js.map +1 -1
- package/dist/accessory/AirConditionerAccessory.d.ts +98 -92
- package/dist/accessory/AirConditionerAccessory.d.ts.map +1 -1
- package/dist/accessory/AirConditionerAccessory.js +662 -607
- 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 +30 -30
- package/dist/accessory/DishwasherAccessory.js +63 -63
- 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.js +66 -66
- 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 -50
- package/dist/core/MideaConstants.js +58 -58
- 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 -13
- package/dist/devices/DeviceFactory.d.ts.map +1 -1
- package/dist/devices/DeviceFactory.js +37 -36
- package/dist/devices/DeviceFactory.js.map +1 -1
- package/dist/devices/a1/MideaA1Device.d.ts +76 -76
- package/dist/devices/a1/MideaA1Device.js +145 -145
- package/dist/devices/a1/MideaA1Message.d.ts +40 -40
- package/dist/devices/a1/MideaA1Message.js +198 -198
- package/dist/devices/ac/MideaACDevice.d.ts +106 -104
- package/dist/devices/ac/MideaACDevice.d.ts.map +1 -1
- package/dist/devices/ac/MideaACDevice.js +400 -384
- package/dist/devices/ac/MideaACDevice.js.map +1 -1
- package/dist/devices/ac/MideaACMessage.d.ts +95 -94
- package/dist/devices/ac/MideaACMessage.d.ts.map +1 -1
- package/dist/devices/ac/MideaACMessage.js +619 -611
- package/dist/devices/ac/MideaACMessage.js.map +1 -1
- package/dist/devices/db/MideaDBDevice.d.ts +29 -29
- package/dist/devices/db/MideaDBDevice.js +100 -100
- package/dist/devices/db/MideaDBMessage.d.ts +32 -32
- package/dist/devices/db/MideaDBMessage.js +101 -101
- package/dist/devices/e1/MideaE1Device.d.ts +56 -56
- package/dist/devices/e1/MideaE1Device.js +128 -128
- package/dist/devices/e1/MideaE1Message.d.ts +28 -28
- package/dist/devices/e1/MideaE1Message.js +107 -107
- package/dist/devices/e2/MideaE2Device.d.ts +44 -44
- package/dist/devices/e2/MideaE2Device.js +129 -129
- 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.js +137 -137
- 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.js +106 -106
- 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 +108 -106
- package/dist/platformUtils.d.ts.map +1 -1
- package/dist/platformUtils.js +103 -101
- package/dist/platformUtils.js.map +1 -1
- package/dist/settings.d.ts +8 -8
- package/dist/settings.js +11 -11
- package/docs/ac.md +6 -0
- package/package.json +1 -1
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/***********************************************************************
|
|
2
|
-
* Midea Platform Fan Accessory class
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
-
*
|
|
6
|
-
* Based on https://github.com/homebridge/homebridge-plugin-template
|
|
7
|
-
*
|
|
8
|
-
* An instance of this class is created for each accessory the platform registers.
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
import { CharacteristicValue } from 'homebridge';
|
|
12
|
-
import { MideaAccessory, MideaPlatform } from '../platform';
|
|
13
|
-
import BaseAccessory from './BaseAccessory';
|
|
14
|
-
import { DeviceConfig } from '../platformUtils';
|
|
15
|
-
import MideaFADevice, { FAAttributes } from '../devices/fa/MideaFADevice';
|
|
16
|
-
export default class FanAccessory extends BaseAccessory<MideaFADevice> {
|
|
17
|
-
protected readonly device: MideaFADevice;
|
|
18
|
-
protected readonly configDev: DeviceConfig;
|
|
19
|
-
private service;
|
|
20
|
-
/*********************************************************************
|
|
21
|
-
* Constructor registers all the service types with Homebridge, registers
|
|
22
|
-
* a callback function with the MideaDevice class, and requests device status.
|
|
23
|
-
*/
|
|
24
|
-
constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaFADevice, configDev: DeviceConfig);
|
|
25
|
-
updateCharacteristics(attributes: Partial<FAAttributes>): Promise<void>;
|
|
26
|
-
getActive(): CharacteristicValue;
|
|
27
|
-
setActive(value: CharacteristicValue): Promise<void>;
|
|
28
|
-
getTargetFanState(): CharacteristicValue;
|
|
29
|
-
setTargetFanState(value: CharacteristicValue): Promise<void>;
|
|
30
|
-
getCurrentFanState(): CharacteristicValue;
|
|
31
|
-
getRotationSpeed(): CharacteristicValue;
|
|
32
|
-
setRotationSpeed(value: CharacteristicValue): Promise<void>;
|
|
33
|
-
getRotationDirection(): CharacteristicValue;
|
|
34
|
-
setRotationDirection(value: CharacteristicValue): Promise<void>;
|
|
35
|
-
getSwingMode(): CharacteristicValue;
|
|
36
|
-
setSwingMode(value: CharacteristicValue): Promise<void>;
|
|
37
|
-
getLockPhysicalControls(): CharacteristicValue;
|
|
38
|
-
setLockPhysicalControls(value: CharacteristicValue): Promise<void>;
|
|
39
|
-
}
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* Midea Platform Fan Accessory class
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
+
*
|
|
6
|
+
* Based on https://github.com/homebridge/homebridge-plugin-template
|
|
7
|
+
*
|
|
8
|
+
* An instance of this class is created for each accessory the platform registers.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import { CharacteristicValue } from 'homebridge';
|
|
12
|
+
import { MideaAccessory, MideaPlatform } from '../platform';
|
|
13
|
+
import BaseAccessory from './BaseAccessory';
|
|
14
|
+
import { DeviceConfig } from '../platformUtils';
|
|
15
|
+
import MideaFADevice, { FAAttributes } from '../devices/fa/MideaFADevice';
|
|
16
|
+
export default class FanAccessory extends BaseAccessory<MideaFADevice> {
|
|
17
|
+
protected readonly device: MideaFADevice;
|
|
18
|
+
protected readonly configDev: DeviceConfig;
|
|
19
|
+
private service;
|
|
20
|
+
/*********************************************************************
|
|
21
|
+
* Constructor registers all the service types with Homebridge, registers
|
|
22
|
+
* a callback function with the MideaDevice class, and requests device status.
|
|
23
|
+
*/
|
|
24
|
+
constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaFADevice, configDev: DeviceConfig);
|
|
25
|
+
updateCharacteristics(attributes: Partial<FAAttributes>): Promise<void>;
|
|
26
|
+
getActive(): CharacteristicValue;
|
|
27
|
+
setActive(value: CharacteristicValue): Promise<void>;
|
|
28
|
+
getTargetFanState(): CharacteristicValue;
|
|
29
|
+
setTargetFanState(value: CharacteristicValue): Promise<void>;
|
|
30
|
+
getCurrentFanState(): CharacteristicValue;
|
|
31
|
+
getRotationSpeed(): CharacteristicValue;
|
|
32
|
+
setRotationSpeed(value: CharacteristicValue): Promise<void>;
|
|
33
|
+
getRotationDirection(): CharacteristicValue;
|
|
34
|
+
setRotationDirection(value: CharacteristicValue): Promise<void>;
|
|
35
|
+
getSwingMode(): CharacteristicValue;
|
|
36
|
+
setSwingMode(value: CharacteristicValue): Promise<void>;
|
|
37
|
+
getLockPhysicalControls(): CharacteristicValue;
|
|
38
|
+
setLockPhysicalControls(value: CharacteristicValue): Promise<void>;
|
|
39
|
+
}
|
|
40
40
|
//# sourceMappingURL=FanAccessory.d.ts.map
|
|
@@ -1,124 +1,124 @@
|
|
|
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
|
-
class FanAccessory extends BaseAccessory_1.default {
|
|
8
|
-
/*********************************************************************
|
|
9
|
-
* Constructor registers all the service types with Homebridge, registers
|
|
10
|
-
* a callback function with the MideaDevice class, and requests device status.
|
|
11
|
-
*/
|
|
12
|
-
constructor(platform, accessory, device, configDev) {
|
|
13
|
-
super(platform, accessory, device, configDev);
|
|
14
|
-
this.device = device;
|
|
15
|
-
this.configDev = configDev;
|
|
16
|
-
this.service = this.accessory.getService(this.platform.Service.Fanv2) || this.accessory.addService(this.platform.Service.Fanv2);
|
|
17
|
-
this.service.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
|
|
18
|
-
// this.service
|
|
19
|
-
// .getCharacteristic(this.platform.Characteristic.TargetFanState)
|
|
20
|
-
// .onGet(this.getTargetFanState.bind(this))
|
|
21
|
-
// .onSet(this.setTargetFanState.bind(this));
|
|
22
|
-
this.service.getCharacteristic(this.platform.Characteristic.CurrentFanState).onGet(this.getCurrentFanState.bind(this));
|
|
23
|
-
this.service
|
|
24
|
-
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
25
|
-
.onGet(this.getRotationSpeed.bind(this))
|
|
26
|
-
.onSet(this.setRotationSpeed.bind(this));
|
|
27
|
-
// this.service
|
|
28
|
-
// .getCharacteristic(this.platform.Characteristic.RotationDirection)
|
|
29
|
-
// .onGet(this.getRotationDirection.bind(this))
|
|
30
|
-
// .onSet(this.setRotationDirection.bind(this));
|
|
31
|
-
// this.service
|
|
32
|
-
// .getCharacteristic(this.platform.Characteristic.SwingMode)
|
|
33
|
-
// .onGet(this.getSwingMode.bind(this))
|
|
34
|
-
// .onSet(this.setSwingMode.bind(this));
|
|
35
|
-
this.service
|
|
36
|
-
.getCharacteristic(this.platform.Characteristic.LockPhysicalControls)
|
|
37
|
-
.onGet(this.getLockPhysicalControls.bind(this))
|
|
38
|
-
.onSet(this.setLockPhysicalControls.bind(this));
|
|
39
|
-
}
|
|
40
|
-
async updateCharacteristics(attributes) {
|
|
41
|
-
let updateState = false;
|
|
42
|
-
for (const [k, v] of Object.entries(attributes)) {
|
|
43
|
-
this.platform.log.debug(`[${this.device.name}] Set attribute ${k} to: ${v}`);
|
|
44
|
-
switch (k) {
|
|
45
|
-
case 'power':
|
|
46
|
-
updateState = true;
|
|
47
|
-
break;
|
|
48
|
-
case 'mode':
|
|
49
|
-
this.service.updateCharacteristic(this.platform.Characteristic.TargetFanState, this.getTargetFanState());
|
|
50
|
-
break;
|
|
51
|
-
case 'fan_speed':
|
|
52
|
-
this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.getRotationSpeed());
|
|
53
|
-
break;
|
|
54
|
-
case 'child_lock':
|
|
55
|
-
this.service.updateCharacteristic(this.platform.Characteristic.LockPhysicalControls, this.getLockPhysicalControls());
|
|
56
|
-
break;
|
|
57
|
-
// case 'oscillate':
|
|
58
|
-
// case 'oscillation_angle':
|
|
59
|
-
// case 'oscillation_mode':
|
|
60
|
-
// case 'tilting_angle':
|
|
61
|
-
// this.service.updateCharacteristic(this.platform.Characteristic.SwingMode, this.getSwingMode());
|
|
62
|
-
// break;
|
|
63
|
-
default:
|
|
64
|
-
this.platform.log.debug(`[${this.device.name}] Attempt to set unsupported attribute ${k} to ${v}`);
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (updateState) {
|
|
69
|
-
this.service.updateCharacteristic(this.platform.Characteristic.Active, this.getActive());
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
getActive() {
|
|
73
|
-
return this.device.attributes.POWER ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
|
|
74
|
-
}
|
|
75
|
-
async setActive(value) {
|
|
76
|
-
await this.device.set_attribute({ POWER: value === this.platform.Characteristic.Active.ACTIVE });
|
|
77
|
-
}
|
|
78
|
-
getTargetFanState() {
|
|
79
|
-
return this.device.attributes.MODE;
|
|
80
|
-
}
|
|
81
|
-
async setTargetFanState(value) {
|
|
82
|
-
throw new Error('Method not implemented.');
|
|
83
|
-
}
|
|
84
|
-
getCurrentFanState() {
|
|
85
|
-
return this.device.attributes.POWER
|
|
86
|
-
? this.device.attributes.FAN_SPEED > 0
|
|
87
|
-
? this.platform.Characteristic.CurrentFanState.BLOWING_AIR
|
|
88
|
-
: this.platform.Characteristic.CurrentFanState.IDLE
|
|
89
|
-
: this.platform.Characteristic.CurrentFanState.INACTIVE;
|
|
90
|
-
}
|
|
91
|
-
getRotationSpeed() {
|
|
92
|
-
return this.device.attributes.FAN_SPEED;
|
|
93
|
-
}
|
|
94
|
-
async setRotationSpeed(value) {
|
|
95
|
-
await this.device.set_attribute({ FAN_SPEED: value });
|
|
96
|
-
}
|
|
97
|
-
getRotationDirection() {
|
|
98
|
-
throw new Error('Method not implemented.');
|
|
99
|
-
}
|
|
100
|
-
async setRotationDirection(value) {
|
|
101
|
-
throw new Error('Method not implemented.');
|
|
102
|
-
}
|
|
103
|
-
getSwingMode() {
|
|
104
|
-
return this.device.attributes.OSCILLATE
|
|
105
|
-
? this.platform.Characteristic.SwingMode.SWING_ENABLED
|
|
106
|
-
: this.platform.Characteristic.SwingMode.SWING_DISABLED;
|
|
107
|
-
}
|
|
108
|
-
async setSwingMode(value) {
|
|
109
|
-
await this.device.set_attribute({
|
|
110
|
-
OSCILLATE: value === this.platform.Characteristic.SwingMode.SWING_ENABLED,
|
|
111
|
-
OSCILLATION_MODE: value === this.platform.Characteristic.SwingMode.SWING_ENABLED ? 1 : 0,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
getLockPhysicalControls() {
|
|
115
|
-
return this.device.attributes.CHILD_LOCK
|
|
116
|
-
? this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED
|
|
117
|
-
: this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_DISABLED;
|
|
118
|
-
}
|
|
119
|
-
async setLockPhysicalControls(value) {
|
|
120
|
-
await this.device.set_attribute({ CHILD_LOCK: value === this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
exports.default = FanAccessory;
|
|
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
|
+
class FanAccessory extends BaseAccessory_1.default {
|
|
8
|
+
/*********************************************************************
|
|
9
|
+
* Constructor registers all the service types with Homebridge, registers
|
|
10
|
+
* a callback function with the MideaDevice class, and requests device status.
|
|
11
|
+
*/
|
|
12
|
+
constructor(platform, accessory, device, configDev) {
|
|
13
|
+
super(platform, accessory, device, configDev);
|
|
14
|
+
this.device = device;
|
|
15
|
+
this.configDev = configDev;
|
|
16
|
+
this.service = this.accessory.getService(this.platform.Service.Fanv2) || this.accessory.addService(this.platform.Service.Fanv2);
|
|
17
|
+
this.service.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
|
|
18
|
+
// this.service
|
|
19
|
+
// .getCharacteristic(this.platform.Characteristic.TargetFanState)
|
|
20
|
+
// .onGet(this.getTargetFanState.bind(this))
|
|
21
|
+
// .onSet(this.setTargetFanState.bind(this));
|
|
22
|
+
this.service.getCharacteristic(this.platform.Characteristic.CurrentFanState).onGet(this.getCurrentFanState.bind(this));
|
|
23
|
+
this.service
|
|
24
|
+
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
25
|
+
.onGet(this.getRotationSpeed.bind(this))
|
|
26
|
+
.onSet(this.setRotationSpeed.bind(this));
|
|
27
|
+
// this.service
|
|
28
|
+
// .getCharacteristic(this.platform.Characteristic.RotationDirection)
|
|
29
|
+
// .onGet(this.getRotationDirection.bind(this))
|
|
30
|
+
// .onSet(this.setRotationDirection.bind(this));
|
|
31
|
+
// this.service
|
|
32
|
+
// .getCharacteristic(this.platform.Characteristic.SwingMode)
|
|
33
|
+
// .onGet(this.getSwingMode.bind(this))
|
|
34
|
+
// .onSet(this.setSwingMode.bind(this));
|
|
35
|
+
this.service
|
|
36
|
+
.getCharacteristic(this.platform.Characteristic.LockPhysicalControls)
|
|
37
|
+
.onGet(this.getLockPhysicalControls.bind(this))
|
|
38
|
+
.onSet(this.setLockPhysicalControls.bind(this));
|
|
39
|
+
}
|
|
40
|
+
async updateCharacteristics(attributes) {
|
|
41
|
+
let updateState = false;
|
|
42
|
+
for (const [k, v] of Object.entries(attributes)) {
|
|
43
|
+
this.platform.log.debug(`[${this.device.name}] Set attribute ${k} to: ${v}`);
|
|
44
|
+
switch (k) {
|
|
45
|
+
case 'power':
|
|
46
|
+
updateState = true;
|
|
47
|
+
break;
|
|
48
|
+
case 'mode':
|
|
49
|
+
this.service.updateCharacteristic(this.platform.Characteristic.TargetFanState, this.getTargetFanState());
|
|
50
|
+
break;
|
|
51
|
+
case 'fan_speed':
|
|
52
|
+
this.service.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.getRotationSpeed());
|
|
53
|
+
break;
|
|
54
|
+
case 'child_lock':
|
|
55
|
+
this.service.updateCharacteristic(this.platform.Characteristic.LockPhysicalControls, this.getLockPhysicalControls());
|
|
56
|
+
break;
|
|
57
|
+
// case 'oscillate':
|
|
58
|
+
// case 'oscillation_angle':
|
|
59
|
+
// case 'oscillation_mode':
|
|
60
|
+
// case 'tilting_angle':
|
|
61
|
+
// this.service.updateCharacteristic(this.platform.Characteristic.SwingMode, this.getSwingMode());
|
|
62
|
+
// break;
|
|
63
|
+
default:
|
|
64
|
+
this.platform.log.debug(`[${this.device.name}] Attempt to set unsupported attribute ${k} to ${v}`);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (updateState) {
|
|
69
|
+
this.service.updateCharacteristic(this.platform.Characteristic.Active, this.getActive());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
getActive() {
|
|
73
|
+
return this.device.attributes.POWER ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
|
|
74
|
+
}
|
|
75
|
+
async setActive(value) {
|
|
76
|
+
await this.device.set_attribute({ POWER: value === this.platform.Characteristic.Active.ACTIVE });
|
|
77
|
+
}
|
|
78
|
+
getTargetFanState() {
|
|
79
|
+
return this.device.attributes.MODE;
|
|
80
|
+
}
|
|
81
|
+
async setTargetFanState(value) {
|
|
82
|
+
throw new Error('Method not implemented.');
|
|
83
|
+
}
|
|
84
|
+
getCurrentFanState() {
|
|
85
|
+
return this.device.attributes.POWER
|
|
86
|
+
? this.device.attributes.FAN_SPEED > 0
|
|
87
|
+
? this.platform.Characteristic.CurrentFanState.BLOWING_AIR
|
|
88
|
+
: this.platform.Characteristic.CurrentFanState.IDLE
|
|
89
|
+
: this.platform.Characteristic.CurrentFanState.INACTIVE;
|
|
90
|
+
}
|
|
91
|
+
getRotationSpeed() {
|
|
92
|
+
return this.device.attributes.FAN_SPEED;
|
|
93
|
+
}
|
|
94
|
+
async setRotationSpeed(value) {
|
|
95
|
+
await this.device.set_attribute({ FAN_SPEED: value });
|
|
96
|
+
}
|
|
97
|
+
getRotationDirection() {
|
|
98
|
+
throw new Error('Method not implemented.');
|
|
99
|
+
}
|
|
100
|
+
async setRotationDirection(value) {
|
|
101
|
+
throw new Error('Method not implemented.');
|
|
102
|
+
}
|
|
103
|
+
getSwingMode() {
|
|
104
|
+
return this.device.attributes.OSCILLATE
|
|
105
|
+
? this.platform.Characteristic.SwingMode.SWING_ENABLED
|
|
106
|
+
: this.platform.Characteristic.SwingMode.SWING_DISABLED;
|
|
107
|
+
}
|
|
108
|
+
async setSwingMode(value) {
|
|
109
|
+
await this.device.set_attribute({
|
|
110
|
+
OSCILLATE: value === this.platform.Characteristic.SwingMode.SWING_ENABLED,
|
|
111
|
+
OSCILLATION_MODE: value === this.platform.Characteristic.SwingMode.SWING_ENABLED ? 1 : 0,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
getLockPhysicalControls() {
|
|
115
|
+
return this.device.attributes.CHILD_LOCK
|
|
116
|
+
? this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED
|
|
117
|
+
: this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_DISABLED;
|
|
118
|
+
}
|
|
119
|
+
async setLockPhysicalControls(value) {
|
|
120
|
+
await this.device.set_attribute({ CHILD_LOCK: value === this.platform.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.default = FanAccessory;
|
|
124
124
|
//# sourceMappingURL=FanAccessory.js.map
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/***********************************************************************
|
|
2
|
-
* Midea Platform Front Load Washer Accessory class
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
-
*
|
|
6
|
-
* Based on https://github.com/homebridge/homebridge-plugin-template
|
|
7
|
-
*
|
|
8
|
-
* An instance of this class is created for each accessory the platform registers.
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
import { CharacteristicValue } from 'homebridge';
|
|
12
|
-
import { MideaAccessory, MideaPlatform } from '../platform';
|
|
13
|
-
import BaseAccessory from './BaseAccessory';
|
|
14
|
-
import { DeviceConfig } from '../platformUtils';
|
|
15
|
-
import MideaDBDevice, { DBAttributes } from '../devices/db/MideaDBDevice';
|
|
16
|
-
export default class FanAccessory extends BaseAccessory<MideaDBDevice> {
|
|
17
|
-
protected readonly device: MideaDBDevice;
|
|
18
|
-
protected readonly configDev: DeviceConfig;
|
|
19
|
-
private service;
|
|
20
|
-
/*********************************************************************
|
|
21
|
-
* Constructor registers all the service types with Homebridge, registers
|
|
22
|
-
* a callback function with the MideaDevice class, and requests device status.
|
|
23
|
-
*/
|
|
24
|
-
constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaDBDevice, configDev: DeviceConfig);
|
|
25
|
-
updateCharacteristics(attributes: Partial<DBAttributes>): Promise<void>;
|
|
26
|
-
getActive(): CharacteristicValue;
|
|
27
|
-
setActive(value: CharacteristicValue): Promise<void>;
|
|
28
|
-
getInUse(): CharacteristicValue;
|
|
29
|
-
getRemainingDuration(): CharacteristicValue;
|
|
30
|
-
}
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* Midea Platform Front Load Washer Accessory class
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
+
*
|
|
6
|
+
* Based on https://github.com/homebridge/homebridge-plugin-template
|
|
7
|
+
*
|
|
8
|
+
* An instance of this class is created for each accessory the platform registers.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import { CharacteristicValue } from 'homebridge';
|
|
12
|
+
import { MideaAccessory, MideaPlatform } from '../platform';
|
|
13
|
+
import BaseAccessory from './BaseAccessory';
|
|
14
|
+
import { DeviceConfig } from '../platformUtils';
|
|
15
|
+
import MideaDBDevice, { DBAttributes } from '../devices/db/MideaDBDevice';
|
|
16
|
+
export default class FanAccessory extends BaseAccessory<MideaDBDevice> {
|
|
17
|
+
protected readonly device: MideaDBDevice;
|
|
18
|
+
protected readonly configDev: DeviceConfig;
|
|
19
|
+
private service;
|
|
20
|
+
/*********************************************************************
|
|
21
|
+
* Constructor registers all the service types with Homebridge, registers
|
|
22
|
+
* a callback function with the MideaDevice class, and requests device status.
|
|
23
|
+
*/
|
|
24
|
+
constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaDBDevice, configDev: DeviceConfig);
|
|
25
|
+
updateCharacteristics(attributes: Partial<DBAttributes>): Promise<void>;
|
|
26
|
+
getActive(): CharacteristicValue;
|
|
27
|
+
setActive(value: CharacteristicValue): Promise<void>;
|
|
28
|
+
getInUse(): CharacteristicValue;
|
|
29
|
+
getRemainingDuration(): CharacteristicValue;
|
|
30
|
+
}
|
|
31
31
|
//# sourceMappingURL=FrontLoadWasherAccessory.d.ts.map
|
|
@@ -1,67 +1,67 @@
|
|
|
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
|
-
class FanAccessory extends BaseAccessory_1.default {
|
|
8
|
-
/*********************************************************************
|
|
9
|
-
* Constructor registers all the service types with Homebridge, registers
|
|
10
|
-
* a callback function with the MideaDevice class, and requests device status.
|
|
11
|
-
*/
|
|
12
|
-
constructor(platform, accessory, device, configDev) {
|
|
13
|
-
super(platform, accessory, device, configDev);
|
|
14
|
-
this.device = device;
|
|
15
|
-
this.configDev = configDev;
|
|
16
|
-
this.service = this.accessory.getService(this.platform.Service.Valve) || this.accessory.addService(this.platform.Service.Valve);
|
|
17
|
-
this.service.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
|
|
18
|
-
this.service.getCharacteristic(this.platform.Characteristic.InUse).onGet(this.getInUse.bind(this));
|
|
19
|
-
this.service
|
|
20
|
-
.getCharacteristic(this.platform.Characteristic.ValveType)
|
|
21
|
-
.onGet(() => this.platform.Characteristic.ValveType.GENERIC_VALVE);
|
|
22
|
-
this.service
|
|
23
|
-
.getCharacteristic(this.platform.Characteristic.RemainingDuration)
|
|
24
|
-
.setProps({ minValue: 0, maxValue: 60 * 60 * 8, minStep: 1 })
|
|
25
|
-
.onGet(this.getRemainingDuration.bind(this));
|
|
26
|
-
}
|
|
27
|
-
async updateCharacteristics(attributes) {
|
|
28
|
-
let updateState = false;
|
|
29
|
-
for (const [k, v] of Object.entries(attributes)) {
|
|
30
|
-
this.platform.log.debug(`[${this.device.name}] Set attribute ${k} to: ${v}`);
|
|
31
|
-
switch (k) {
|
|
32
|
-
case 'power':
|
|
33
|
-
updateState = true;
|
|
34
|
-
break;
|
|
35
|
-
case 'start':
|
|
36
|
-
updateState = true;
|
|
37
|
-
break;
|
|
38
|
-
case 'time_remaining':
|
|
39
|
-
case 'progress':
|
|
40
|
-
updateState = true;
|
|
41
|
-
break;
|
|
42
|
-
default:
|
|
43
|
-
this.platform.log.debug(`[${this.device.name}] Attempt to set unsupported attribute ${k} to ${v}`);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (updateState) {
|
|
48
|
-
this.service.updateCharacteristic(this.platform.Characteristic.Active, this.getActive());
|
|
49
|
-
this.service.updateCharacteristic(this.platform.Characteristic.InUse, this.getInUse());
|
|
50
|
-
this.service.updateCharacteristic(this.platform.Characteristic.RemainingDuration, this.getRemainingDuration());
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
getActive() {
|
|
54
|
-
return this.device.attributes.POWER ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
|
|
55
|
-
}
|
|
56
|
-
async setActive(value) {
|
|
57
|
-
await this.device.set_attribute({ POWER: value === this.platform.Characteristic.Active.ACTIVE });
|
|
58
|
-
}
|
|
59
|
-
getInUse() {
|
|
60
|
-
return this.device.attributes.START ? this.platform.Characteristic.InUse.IN_USE : this.platform.Characteristic.InUse.NOT_IN_USE;
|
|
61
|
-
}
|
|
62
|
-
getRemainingDuration() {
|
|
63
|
-
return this.device.attributes.TIME_REMAINING * 60; // in seconds
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.default = FanAccessory;
|
|
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
|
+
class FanAccessory extends BaseAccessory_1.default {
|
|
8
|
+
/*********************************************************************
|
|
9
|
+
* Constructor registers all the service types with Homebridge, registers
|
|
10
|
+
* a callback function with the MideaDevice class, and requests device status.
|
|
11
|
+
*/
|
|
12
|
+
constructor(platform, accessory, device, configDev) {
|
|
13
|
+
super(platform, accessory, device, configDev);
|
|
14
|
+
this.device = device;
|
|
15
|
+
this.configDev = configDev;
|
|
16
|
+
this.service = this.accessory.getService(this.platform.Service.Valve) || this.accessory.addService(this.platform.Service.Valve);
|
|
17
|
+
this.service.getCharacteristic(this.platform.Characteristic.Active).onGet(this.getActive.bind(this)).onSet(this.setActive.bind(this));
|
|
18
|
+
this.service.getCharacteristic(this.platform.Characteristic.InUse).onGet(this.getInUse.bind(this));
|
|
19
|
+
this.service
|
|
20
|
+
.getCharacteristic(this.platform.Characteristic.ValveType)
|
|
21
|
+
.onGet(() => this.platform.Characteristic.ValveType.GENERIC_VALVE);
|
|
22
|
+
this.service
|
|
23
|
+
.getCharacteristic(this.platform.Characteristic.RemainingDuration)
|
|
24
|
+
.setProps({ minValue: 0, maxValue: 60 * 60 * 8, minStep: 1 })
|
|
25
|
+
.onGet(this.getRemainingDuration.bind(this));
|
|
26
|
+
}
|
|
27
|
+
async updateCharacteristics(attributes) {
|
|
28
|
+
let updateState = false;
|
|
29
|
+
for (const [k, v] of Object.entries(attributes)) {
|
|
30
|
+
this.platform.log.debug(`[${this.device.name}] Set attribute ${k} to: ${v}`);
|
|
31
|
+
switch (k) {
|
|
32
|
+
case 'power':
|
|
33
|
+
updateState = true;
|
|
34
|
+
break;
|
|
35
|
+
case 'start':
|
|
36
|
+
updateState = true;
|
|
37
|
+
break;
|
|
38
|
+
case 'time_remaining':
|
|
39
|
+
case 'progress':
|
|
40
|
+
updateState = true;
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
this.platform.log.debug(`[${this.device.name}] Attempt to set unsupported attribute ${k} to ${v}`);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (updateState) {
|
|
48
|
+
this.service.updateCharacteristic(this.platform.Characteristic.Active, this.getActive());
|
|
49
|
+
this.service.updateCharacteristic(this.platform.Characteristic.InUse, this.getInUse());
|
|
50
|
+
this.service.updateCharacteristic(this.platform.Characteristic.RemainingDuration, this.getRemainingDuration());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
getActive() {
|
|
54
|
+
return this.device.attributes.POWER ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
|
|
55
|
+
}
|
|
56
|
+
async setActive(value) {
|
|
57
|
+
await this.device.set_attribute({ POWER: value === this.platform.Characteristic.Active.ACTIVE });
|
|
58
|
+
}
|
|
59
|
+
getInUse() {
|
|
60
|
+
return this.device.attributes.START ? this.platform.Characteristic.InUse.IN_USE : this.platform.Characteristic.InUse.NOT_IN_USE;
|
|
61
|
+
}
|
|
62
|
+
getRemainingDuration() {
|
|
63
|
+
return this.device.attributes.TIME_REMAINING * 60; // in seconds
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.default = FanAccessory;
|
|
67
67
|
//# sourceMappingURL=FrontLoadWasherAccessory.js.map
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
/***********************************************************************
|
|
2
|
-
* Midea Platform Gas Water Heater Accessory class
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
-
*
|
|
6
|
-
* Based on https://github.com/homebridge/homebridge-plugin-template
|
|
7
|
-
*
|
|
8
|
-
* An instance of this class is created for each accessory the platform registers.
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
import { CharacteristicValue } from 'homebridge';
|
|
12
|
-
import MideaE3Device, { E3Attributes } from '../devices/e3/MideaE3Device';
|
|
13
|
-
import BaseAccessory from './BaseAccessory';
|
|
14
|
-
import { MideaAccessory, MideaPlatform } from '../platform';
|
|
15
|
-
import { DeviceConfig } from '../platformUtils';
|
|
16
|
-
export default class GasWaterHeaterAccessory extends BaseAccessory<MideaE3Device> {
|
|
17
|
-
protected readonly device: MideaE3Device;
|
|
18
|
-
protected readonly configDev: DeviceConfig;
|
|
19
|
-
private service;
|
|
20
|
-
private burningStateService?;
|
|
21
|
-
private protectionService?;
|
|
22
|
-
private zeroColdWaterService?;
|
|
23
|
-
private zeroColdPulseService?;
|
|
24
|
-
private smartVolumeService?;
|
|
25
|
-
constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaE3Device, configDev: DeviceConfig);
|
|
26
|
-
/*********************************************************************
|
|
27
|
-
* Callback function called by MideaDevice whenever there is a change to
|
|
28
|
-
* any attribute value.
|
|
29
|
-
*/
|
|
30
|
-
protected updateCharacteristics(attributes: Partial<E3Attributes>): Promise<void>;
|
|
31
|
-
/*********************************************************************
|
|
32
|
-
* Callback functions for each Homebridge/HomeKit service
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
getActive(): CharacteristicValue;
|
|
36
|
-
setActive(value: CharacteristicValue): Promise<void>;
|
|
37
|
-
getCurrentHeaterCoolerState(): CharacteristicValue;
|
|
38
|
-
getTargetHeaterCoolerState(): CharacteristicValue;
|
|
39
|
-
setTargetHeaterCoolerState(value: CharacteristicValue): Promise<void>;
|
|
40
|
-
getCurrentTemperature(): CharacteristicValue;
|
|
41
|
-
getTargetTemperature(): CharacteristicValue;
|
|
42
|
-
setTargetTemperature(value: CharacteristicValue): Promise<void>;
|
|
43
|
-
getBurningState(): CharacteristicValue;
|
|
44
|
-
getProtection(): CharacteristicValue;
|
|
45
|
-
getZeroColdWater(): CharacteristicValue;
|
|
46
|
-
setZeroColdWater(value: CharacteristicValue): Promise<void>;
|
|
47
|
-
getZeroColdPulse(): CharacteristicValue;
|
|
48
|
-
setZeroColdPulse(value: CharacteristicValue): Promise<void>;
|
|
49
|
-
getSmartVolume(): CharacteristicValue;
|
|
50
|
-
setSmartVolume(value: CharacteristicValue): Promise<void>;
|
|
51
|
-
}
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* Midea Platform Gas Water Heater Accessory class
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2024 Kovalovszky Patrik, https://github.com/kovapatrik
|
|
5
|
+
*
|
|
6
|
+
* Based on https://github.com/homebridge/homebridge-plugin-template
|
|
7
|
+
*
|
|
8
|
+
* An instance of this class is created for each accessory the platform registers.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import { CharacteristicValue } from 'homebridge';
|
|
12
|
+
import MideaE3Device, { E3Attributes } from '../devices/e3/MideaE3Device';
|
|
13
|
+
import BaseAccessory from './BaseAccessory';
|
|
14
|
+
import { MideaAccessory, MideaPlatform } from '../platform';
|
|
15
|
+
import { DeviceConfig } from '../platformUtils';
|
|
16
|
+
export default class GasWaterHeaterAccessory extends BaseAccessory<MideaE3Device> {
|
|
17
|
+
protected readonly device: MideaE3Device;
|
|
18
|
+
protected readonly configDev: DeviceConfig;
|
|
19
|
+
private service;
|
|
20
|
+
private burningStateService?;
|
|
21
|
+
private protectionService?;
|
|
22
|
+
private zeroColdWaterService?;
|
|
23
|
+
private zeroColdPulseService?;
|
|
24
|
+
private smartVolumeService?;
|
|
25
|
+
constructor(platform: MideaPlatform, accessory: MideaAccessory, device: MideaE3Device, configDev: DeviceConfig);
|
|
26
|
+
/*********************************************************************
|
|
27
|
+
* Callback function called by MideaDevice whenever there is a change to
|
|
28
|
+
* any attribute value.
|
|
29
|
+
*/
|
|
30
|
+
protected updateCharacteristics(attributes: Partial<E3Attributes>): Promise<void>;
|
|
31
|
+
/*********************************************************************
|
|
32
|
+
* Callback functions for each Homebridge/HomeKit service
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
getActive(): CharacteristicValue;
|
|
36
|
+
setActive(value: CharacteristicValue): Promise<void>;
|
|
37
|
+
getCurrentHeaterCoolerState(): CharacteristicValue;
|
|
38
|
+
getTargetHeaterCoolerState(): CharacteristicValue;
|
|
39
|
+
setTargetHeaterCoolerState(value: CharacteristicValue): Promise<void>;
|
|
40
|
+
getCurrentTemperature(): CharacteristicValue;
|
|
41
|
+
getTargetTemperature(): CharacteristicValue;
|
|
42
|
+
setTargetTemperature(value: CharacteristicValue): Promise<void>;
|
|
43
|
+
getBurningState(): CharacteristicValue;
|
|
44
|
+
getProtection(): CharacteristicValue;
|
|
45
|
+
getZeroColdWater(): CharacteristicValue;
|
|
46
|
+
setZeroColdWater(value: CharacteristicValue): Promise<void>;
|
|
47
|
+
getZeroColdPulse(): CharacteristicValue;
|
|
48
|
+
setZeroColdPulse(value: CharacteristicValue): Promise<void>;
|
|
49
|
+
getSmartVolume(): CharacteristicValue;
|
|
50
|
+
setSmartVolume(value: CharacteristicValue): Promise<void>;
|
|
51
|
+
}
|
|
52
52
|
//# sourceMappingURL=GasWaterHeaterAccessory.d.ts.map
|