@homebridge-plugins/homebridge-smarthq 0.5.0-beta.3 → 0.5.0-beta.30
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/.github/ISSUE_TEMPLATE/config.yml +1 -1
- package/.github/copilot-instructions.md +90 -0
- package/.github/scripts/branch-helper.sh +41 -0
- package/.github/workflows/beta-release.yml +1 -1
- package/.github/workflows/release.yml +53 -17
- package/CHANGELOG.md +563 -18
- package/MATTER.md +304 -0
- package/README.md +15 -0
- package/config.schema.json +14 -5
- package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.d.ts.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.js +3 -1
- package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.js.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.d.ts.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.js +3 -1
- package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.js.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalPowerSvcManager.js +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalPowerSvcManager.js.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.d.ts +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.d.ts.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.js +12 -5
- package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.js.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.d.ts.map +1 -1
- package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.js +4 -2
- package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.js.map +1 -1
- package/dist/devices/OpalIceMaker/OpalDeviceBase.d.ts +3 -4
- package/dist/devices/OpalIceMaker/OpalDeviceBase.d.ts.map +1 -1
- package/dist/devices/OpalIceMaker/OpalDeviceBase.js +3 -18
- package/dist/devices/OpalIceMaker/OpalDeviceBase.js.map +1 -1
- package/dist/devices/advantium.d.ts +10 -0
- package/dist/devices/advantium.d.ts.map +1 -0
- package/dist/devices/advantium.js +75 -0
- package/dist/devices/advantium.js.map +1 -0
- package/dist/devices/airConditioner.d.ts +11 -2
- package/dist/devices/airConditioner.d.ts.map +1 -1
- package/dist/devices/airConditioner.js +108 -17
- package/dist/devices/airConditioner.js.map +1 -1
- package/dist/devices/beverageCenter.d.ts +10 -0
- package/dist/devices/beverageCenter.d.ts.map +1 -0
- package/dist/devices/beverageCenter.js +125 -0
- package/dist/devices/beverageCenter.js.map +1 -0
- package/dist/devices/clothesDryer.d.ts +21 -0
- package/dist/devices/clothesDryer.d.ts.map +1 -0
- package/dist/devices/clothesDryer.js +240 -0
- package/dist/devices/clothesDryer.js.map +1 -0
- package/dist/devices/clothesWasher.d.ts +21 -0
- package/dist/devices/clothesWasher.d.ts.map +1 -0
- package/dist/devices/clothesWasher.js +251 -0
- package/dist/devices/clothesWasher.js.map +1 -0
- package/dist/devices/coffeeMaker.d.ts +10 -0
- package/dist/devices/coffeeMaker.d.ts.map +1 -0
- package/dist/devices/coffeeMaker.js +79 -0
- package/dist/devices/coffeeMaker.js.map +1 -0
- package/dist/devices/device.d.ts +107 -13
- package/dist/devices/device.d.ts.map +1 -1
- package/dist/devices/device.js +386 -60
- package/dist/devices/device.js.map +1 -1
- package/dist/devices/dishwasher.d.ts +9 -3
- package/dist/devices/dishwasher.d.ts.map +1 -1
- package/dist/devices/dishwasher.js +142 -29
- package/dist/devices/dishwasher.js.map +1 -1
- package/dist/devices/hood.d.ts +41 -0
- package/dist/devices/hood.d.ts.map +1 -0
- package/dist/devices/hood.js +332 -0
- package/dist/devices/hood.js.map +1 -0
- package/dist/devices/microwave.d.ts +19 -0
- package/dist/devices/microwave.d.ts.map +1 -0
- package/dist/devices/microwave.js +144 -0
- package/dist/devices/microwave.js.map +1 -0
- package/dist/devices/oven.d.ts +9 -2
- package/dist/devices/oven.d.ts.map +1 -1
- package/dist/devices/oven.js +245 -43
- package/dist/devices/oven.js.map +1 -1
- package/dist/devices/refrigerator.d.ts +37 -2
- package/dist/devices/refrigerator.d.ts.map +1 -1
- package/dist/devices/refrigerator.js +548 -34
- package/dist/devices/refrigerator.js.map +1 -1
- package/dist/devices/waterFilter.d.ts +10 -0
- package/dist/devices/waterFilter.d.ts.map +1 -0
- package/dist/devices/waterFilter.js +67 -0
- package/dist/devices/waterFilter.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +19 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +158 -0
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/devices/waterSoftener.d.ts +10 -0
- package/dist/devices/waterSoftener.d.ts.map +1 -0
- package/dist/devices/waterSoftener.js +67 -0
- package/dist/devices/waterSoftener.js.map +1 -0
- package/dist/getAccessToken.d.ts.map +1 -1
- package/dist/getAccessToken.js +6 -0
- package/dist/getAccessToken.js.map +1 -1
- package/dist/platform.d.ts +25 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +548 -70
- package/dist/platform.js.map +1 -1
- package/dist/platform.test.d.ts +2 -0
- package/dist/platform.test.d.ts.map +1 -0
- package/dist/platform.test.js +80 -0
- package/dist/platform.test.js.map +1 -0
- package/dist/settings.d.ts +23 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +13 -0
- package/dist/settings.js.map +1 -1
- package/docs/assets/highlight.css +7 -0
- package/docs/assets/main.js +5 -5
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +248 -226
- package/docs/classes/SmartHQPlatform.html +51 -56
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +22 -12
- package/docs/interfaces/DeviceOptions.html +2 -3
- package/docs/interfaces/SmartHQPlatformConfig.html +6 -17
- package/docs/interfaces/SmartHqContext.html +6 -4
- package/docs/interfaces/SmartHqERDResponse.html +7 -8
- package/docs/interfaces/credentials.html +3 -4
- package/docs/interfaces/devicesConfig.html +8 -8
- package/docs/interfaces/options.html +7 -8
- package/docs/media/copilot-instructions.md +90 -0
- package/docs/modules.html +1 -2
- package/docs/variables/API_URL.html +1 -2
- package/docs/variables/ERD_CODES.html +1 -2
- package/docs/variables/ERD_TYPES.html +1 -2
- package/docs/variables/KEEPALIVE_TIMEOUT.html +1 -2
- package/docs/variables/LOGIN_URL.html +2 -3
- package/docs/variables/OAUTH2_CLIENT_ID.html +1 -2
- package/docs/variables/OAUTH2_CLIENT_SECRET.html +1 -2
- package/docs/variables/OAUTH2_REDIRECT_URI.html +1 -2
- package/docs/variables/PLATFORM_NAME.html +2 -3
- package/docs/variables/PLUGIN_NAME.html +2 -3
- package/docs/variables/SECURE_URL.html +2 -3
- package/docs/variables/default.html +1 -0
- package/package.json +22 -33
- package/typedoc.json +0 -4
- package/vitest.config.ts +6 -5
- package/.github/workflows/build.yml +0 -18
- package/.github/workflows/changerelease.yml +0 -11
- package/.github/workflows/labeler.yml +0 -9
- package/.github/workflows/release-drafter.yml +0 -14
- package/docs/assets/dmt/dmt-component-data.js +0 -1
- package/docs/assets/dmt/dmt-components.css +0 -20
- package/docs/assets/dmt/dmt-components.js +0 -67
- package/docs/assets/dmt/dmt-search.cmp +0 -0
- package/docs/assets/dmt/dmt-theme.css +0 -1
- package/docs/functions/default.html +0 -2
|
@@ -1,32 +1,161 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import { interval, skipWhile } from 'rxjs';
|
|
3
2
|
import { ERD_TYPES } from '../settings.js';
|
|
4
3
|
import { deviceBase } from './device.js';
|
|
5
4
|
export class SmartHQDishWasher extends deviceBase {
|
|
6
5
|
platform;
|
|
7
6
|
device;
|
|
8
|
-
// Service
|
|
9
|
-
DishWasher;
|
|
10
7
|
// Updates
|
|
11
8
|
SensorUpdateInProgress;
|
|
12
9
|
deviceStatus;
|
|
10
|
+
// Matter support override flag
|
|
11
|
+
useMatterOverride = false;
|
|
13
12
|
constructor(platform, accessory, device) {
|
|
14
13
|
super(platform, accessory, device);
|
|
15
14
|
this.platform = platform;
|
|
16
15
|
this.device = device;
|
|
16
|
+
// Check if we should use Matter protocol
|
|
17
|
+
this.useMatterOverride = device.useMatter ?? false;
|
|
17
18
|
this.debugLog(`Dishwasher Features: ${JSON.stringify(accessory.context.device.features)}`);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
this.debugLog(`Using protocol: ${this.useMatterOverride ? 'Matter' : 'HAP'}`);
|
|
20
|
+
// Initialize the appropriate protocol
|
|
21
|
+
if (this.useMatterOverride) {
|
|
22
|
+
this.initializeMatter();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.initializeHAP();
|
|
26
|
+
}
|
|
27
|
+
// Start periodic refresh
|
|
28
|
+
this.SensorUpdateInProgress = false;
|
|
29
|
+
interval(this.deviceRefreshRate * 10000)
|
|
30
|
+
.pipe(skipWhile(() => this.SensorUpdateInProgress))
|
|
31
|
+
.subscribe(async () => {
|
|
32
|
+
// await this.refreshStatus()
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Initialize Matter protocol
|
|
37
|
+
*/
|
|
38
|
+
initializeMatter() {
|
|
39
|
+
const { valid, api: matterAPI } = this.validateMatterAPI();
|
|
40
|
+
if (!valid) {
|
|
41
|
+
this.errorLog('Matter API not available or incomplete - falling back to HAP');
|
|
42
|
+
this.initializeHAP();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const serialNumber = this.device.applianceId || 'unknown';
|
|
46
|
+
this.matterUuid = matterAPI.uuid.generate(serialNumber);
|
|
47
|
+
// Create Matter accessory configuration with dishwasher-specific clusters
|
|
48
|
+
const matterAccessory = {
|
|
49
|
+
UUID: this.matterUuid,
|
|
50
|
+
displayName: this.device.nickname || 'SmartHQ Dishwasher',
|
|
51
|
+
serialNumber,
|
|
52
|
+
manufacturer: this.device.brand && this.device.brand !== 'Unknown' ? this.device.brand : 'GE Appliances',
|
|
53
|
+
model: this.device.model || 'SmartHQ',
|
|
54
|
+
firmwareRevision: this.deviceFirmwareVersion,
|
|
55
|
+
hardwareRevision: this.deviceFirmwareVersion,
|
|
56
|
+
deviceType: matterAPI.deviceTypes.DishwasherDevice,
|
|
57
|
+
clusters: {
|
|
58
|
+
// On/Off cluster for dishwasher power state
|
|
59
|
+
onOff: {
|
|
60
|
+
onOff: false,
|
|
61
|
+
},
|
|
62
|
+
// Operational State cluster for cycle status (maps to DISHWASHER_CYCLE)
|
|
63
|
+
operationalState: {
|
|
64
|
+
operationalState: 0, // 0=Stopped, 1=Running, 2=Paused
|
|
65
|
+
operationalError: { errorStateID: 0 },
|
|
66
|
+
phaseList: ['Washing', 'Rinsing', 'Drying'],
|
|
67
|
+
currentPhase: 0,
|
|
68
|
+
},
|
|
69
|
+
// Timer cluster for time remaining (maps to DISHWASHER_CYCLE_PHASE_TIME_REMAINING)
|
|
70
|
+
timer: {
|
|
71
|
+
timerState: 0, // 0=Stopped, 1=Running, 2=Paused
|
|
72
|
+
duration: 0,
|
|
73
|
+
remainingTime: 0,
|
|
74
|
+
},
|
|
75
|
+
// Dishwasher Mode cluster for cycle selection
|
|
76
|
+
dishwasherMode: {
|
|
77
|
+
supportedModes: [
|
|
78
|
+
{ label: 'Normal', mode: 0 },
|
|
79
|
+
{ label: 'Heavy', mode: 1 },
|
|
80
|
+
{ label: 'Light', mode: 2 },
|
|
81
|
+
{ label: 'Quick', mode: 3 },
|
|
82
|
+
],
|
|
83
|
+
currentMode: 0,
|
|
84
|
+
},
|
|
85
|
+
// Dishwasher Alarm cluster for cycle completion
|
|
86
|
+
dishwasherAlarm: {
|
|
87
|
+
mask: 0,
|
|
88
|
+
state: 0,
|
|
89
|
+
supported: 1, // Bit 0: Cycle complete
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
handlers: {
|
|
93
|
+
onOff: {
|
|
94
|
+
on: async () => {
|
|
95
|
+
await this.writeErd(ERD_TYPES.DISHWASHER_CYCLE, true);
|
|
96
|
+
},
|
|
97
|
+
off: async () => {
|
|
98
|
+
await this.writeErd(ERD_TYPES.DISHWASHER_CYCLE, false);
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
// Register Matter accessory
|
|
104
|
+
matterAPI.registerAccessory(matterAccessory);
|
|
105
|
+
this.infoLog('Created Matter Dishwasher with operational state, timer, mode selection, and alarm clusters');
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Initialize HAP (HomeKit) protocol
|
|
109
|
+
*/
|
|
110
|
+
initializeHAP() {
|
|
111
|
+
// Dishwasher Running State (Valve for active/inactive)
|
|
112
|
+
const dishwasherValve = this.accessory.getService('Dishwasher') ?? this.accessory.addService(this.platform.Service.Valve, 'Dishwasher', 'Dishwasher');
|
|
113
|
+
dishwasherValve.setCharacteristic(this.platform.Characteristic.Name, 'Dishwasher');
|
|
114
|
+
dishwasherValve.setCharacteristic(this.platform.Characteristic.ValveType, this.platform.Characteristic.ValveType.GENERIC_VALVE);
|
|
115
|
+
dishwasherValve
|
|
116
|
+
.getCharacteristic(this.platform.Characteristic.Active)
|
|
117
|
+
.onGet(async () => {
|
|
118
|
+
try {
|
|
119
|
+
const r = await this.readErd(ERD_TYPES.DISHWASHER_CYCLE);
|
|
120
|
+
return r && Number.parseInt(r) !== 0 ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
this.warnLog?.(`Dishwasher Active error: ${error?.message ?? error}`);
|
|
124
|
+
return this.platform.Characteristic.Active.INACTIVE;
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
.onSet(async (value) => {
|
|
128
|
+
try {
|
|
129
|
+
await this.writeErd(ERD_TYPES.DISHWASHER_CYCLE, value === this.platform.Characteristic.Active.ACTIVE);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
this.warnLog?.(`Dishwasher Active set error: ${error?.message ?? error}`);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
dishwasherValve
|
|
136
|
+
.getCharacteristic(this.platform.Characteristic.InUse)
|
|
137
|
+
.onGet(async () => {
|
|
138
|
+
try {
|
|
139
|
+
const r = await this.readErd(ERD_TYPES.DISHWASHER_CYCLE);
|
|
140
|
+
return r && Number.parseInt(r) !== 0 ? this.platform.Characteristic.InUse.IN_USE : this.platform.Characteristic.InUse.NOT_IN_USE;
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
this.warnLog?.(`Dishwasher InUse error: ${error?.message ?? error}`);
|
|
144
|
+
return this.platform.Characteristic.InUse.NOT_IN_USE;
|
|
28
145
|
}
|
|
29
146
|
});
|
|
147
|
+
// Dishwasher Door Sensor
|
|
148
|
+
const doorSensor = this.accessory.getService('Dishwasher Door') ?? this.accessory.addService(this.platform.Service.ContactSensor, 'Dishwasher Door', 'DishwasherDoor');
|
|
149
|
+
doorSensor.setCharacteristic(this.platform.Characteristic.Name, 'Dishwasher Door');
|
|
150
|
+
doorSensor
|
|
151
|
+
.getCharacteristic(this.platform.Characteristic.ContactSensorState)
|
|
152
|
+
.onGet(async () => {
|
|
153
|
+
const r = await this.readErd(ERD_TYPES.LAUNDRY_DOOR);
|
|
154
|
+
// 0=closed (detected), 1=open (not detected)
|
|
155
|
+
return r && Number.parseInt(r) === 1
|
|
156
|
+
? this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
157
|
+
: this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED;
|
|
158
|
+
});
|
|
30
159
|
// this is subject we use to track when we need to POST changes to the SmartHQ API
|
|
31
160
|
this.SensorUpdateInProgress = false;
|
|
32
161
|
// Retrieve initial values and updateHomekit
|
|
@@ -38,21 +167,5 @@ export class SmartHQDishWasher extends deviceBase {
|
|
|
38
167
|
// await this.refreshStatus()
|
|
39
168
|
});
|
|
40
169
|
}
|
|
41
|
-
async readErd(erd) {
|
|
42
|
-
const d = await axios
|
|
43
|
-
.get(`/appliance/${this.accessory.context.device.applianceId}/erd/${erd}`);
|
|
44
|
-
return String(d.data.value);
|
|
45
|
-
}
|
|
46
|
-
async writeErd(erd, value) {
|
|
47
|
-
await axios
|
|
48
|
-
.post(`/appliance/${this.accessory.context.device.applianceId}/erd/${erd}`, {
|
|
49
|
-
kind: 'appliance#erdListEntry',
|
|
50
|
-
userId: this.accessory.context.userId,
|
|
51
|
-
applianceId: this.accessory.context.device.applianceId,
|
|
52
|
-
erd,
|
|
53
|
-
value: typeof value === 'boolean' ? (value ? '01' : '00') : value,
|
|
54
|
-
});
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
170
|
}
|
|
58
171
|
//# sourceMappingURL=dishwasher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dishwasher.js","sourceRoot":"","sources":["../../src/devices/dishwasher.ts"],"names":[],"mappings":"AASA,OAAO,
|
|
1
|
+
{"version":3,"file":"dishwasher.js","sourceRoot":"","sources":["../../src/devices/dishwasher.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IASpC;IAEA;IAVX,UAAU;IACV,sBAAsB,CAAU;IAChC,YAAY,CAAK;IAEjB,+BAA+B;IACvB,iBAAiB,GAAY,KAAK,CAAA;IAE1C,YACW,QAAyB,EAClC,SAA4C,EACnC,MAAgD;QAEzD,KAAK,CAAC,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AAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAC,gBAAgB,CAAA;QACtE,CAAC,CAAC,CAAA;QAEJ,kFAAkF;QAClF,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAA;QAEnC,4CAA4C;QAC5C,uBAAuB;QAEvB,2BAA2B;QAC3B,QAAQ,CAAC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;aACrC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;aAClD,SAAS,CAAC,KAAK,IAAI,EAAE;YACpB,6BAA6B;QAC/B,CAAC,CAAC,CAAA;IACN,CAAC;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CharacteristicValue, PlatformAccessory } from 'homebridge';
|
|
2
|
+
import type { SmartHQPlatform } from '../platform.js';
|
|
3
|
+
import type { devicesConfig, SmartHqContext } from '../settings.js';
|
|
4
|
+
import { deviceBase } from './device.js';
|
|
5
|
+
export declare class SmartHQHood extends deviceBase {
|
|
6
|
+
protected readonly platform: SmartHQPlatform;
|
|
7
|
+
protected readonly accessory: PlatformAccessory<SmartHqContext>;
|
|
8
|
+
protected readonly device: SmartHqContext['device'] & devicesConfig;
|
|
9
|
+
private readonly FAN_SVC_NAME;
|
|
10
|
+
private readonly LIGHT_SVC_NAME;
|
|
11
|
+
private fanSvc;
|
|
12
|
+
private lightSvc;
|
|
13
|
+
private useMatterOverride;
|
|
14
|
+
constructor(platform: SmartHQPlatform, accessory: PlatformAccessory<SmartHqContext>, device: SmartHqContext['device'] & devicesConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Initialize Matter protocol
|
|
17
|
+
*/
|
|
18
|
+
private initializeMatter;
|
|
19
|
+
/**
|
|
20
|
+
* Initialize HAP (HomeKit) protocol
|
|
21
|
+
*/
|
|
22
|
+
private initializeHAP;
|
|
23
|
+
private getFanSpeed;
|
|
24
|
+
private setFanSpeed;
|
|
25
|
+
private getLightLevel;
|
|
26
|
+
private setLightLevel;
|
|
27
|
+
private fanSpeedToRotationSpeed;
|
|
28
|
+
private rotationSpeedToFanSpeed;
|
|
29
|
+
private lightLevelToBrightness;
|
|
30
|
+
private brightnessToLightLevel;
|
|
31
|
+
handleGetFanActive(): Promise<CharacteristicValue>;
|
|
32
|
+
handleSetFanActive(value: CharacteristicValue): Promise<void>;
|
|
33
|
+
handleGetFanRotationSpeed(): Promise<CharacteristicValue>;
|
|
34
|
+
handleSetFanRotationSpeed(value: CharacteristicValue): Promise<void>;
|
|
35
|
+
handleGetLightOn(): Promise<CharacteristicValue>;
|
|
36
|
+
handleSetLightOn(value: CharacteristicValue): Promise<void>;
|
|
37
|
+
handleGetLightBrightness(): Promise<CharacteristicValue>;
|
|
38
|
+
handleSetLightBrightness(value: CharacteristicValue): Promise<void>;
|
|
39
|
+
refreshState(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=hood.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hood.d.ts","sourceRoot":"","sources":["../../src/devices/hood.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAW,MAAM,YAAY,CAAA;AAEjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAKnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAgBxC,qBAAa,WAAY,SAAQ,UAAU;IAUvC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe;IAC5C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAAC;IAC/D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,aAAa;IAXrE,OAAO,CAAC,QAAQ,CAAC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eed) {
|
|
6
|
+
FanSpeed["OFF"] = "00";
|
|
7
|
+
FanSpeed["LOW"] = "01";
|
|
8
|
+
FanSpeed["MEDIUM"] = "02";
|
|
9
|
+
FanSpeed["HIGH"] = "03";
|
|
10
|
+
FanSpeed["BOOST"] = "04";
|
|
11
|
+
})(FanSpeed || (FanSpeed = {}));
|
|
12
|
+
var LightLevel;
|
|
13
|
+
(function (LightLevel) {
|
|
14
|
+
LightLevel["OFF"] = "00";
|
|
15
|
+
LightLevel["DIM"] = "01";
|
|
16
|
+
LightLevel["HIGH"] = "02";
|
|
17
|
+
})(LightLevel || (LightLevel = {}));
|
|
18
|
+
export class SmartHQHood extends deviceBase {
|
|
19
|
+
platform;
|
|
20
|
+
accessory;
|
|
21
|
+
device;
|
|
22
|
+
FAN_SVC_NAME = 'HOOD_FAN';
|
|
23
|
+
LIGHT_SVC_NAME = 'HOOD_LIGHT';
|
|
24
|
+
fanSvc;
|
|
25
|
+
lightSvc;
|
|
26
|
+
// Matter support override flag
|
|
27
|
+
useMatterOverride = false;
|
|
28
|
+
constructor(platform, accessory, device) {
|
|
29
|
+
super(platform, accessory, device);
|
|
30
|
+
this.platform = platform;
|
|
31
|
+
this.accessory = accessory;
|
|
32
|
+
this.device = device;
|
|
33
|
+
// Check if we should use Matter protocol
|
|
34
|
+
this.useMatterOverride = device.useMatter ?? false;
|
|
35
|
+
this.debugLog(`Hood Features: ${JSON.stringify(accessory.context.device.features)}`);
|
|
36
|
+
this.debugLog(`Using protocol: ${this.useMatterOverride ? 'Matter' : 'HAP'}`);
|
|
37
|
+
// Initialize the appropriate protocol
|
|
38
|
+
if (this.useMatterOverride) {
|
|
39
|
+
this.initializeMatter();
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.initializeHAP();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Initialize Matter protocol
|
|
47
|
+
*/
|
|
48
|
+
initializeMatter() {
|
|
49
|
+
const { valid, api: matterAPI } = this.validateMatterAPI();
|
|
50
|
+
if (!valid) {
|
|
51
|
+
this.errorLog('Matter API not available or incomplete - falling back to HAP');
|
|
52
|
+
this.initializeHAP();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const serialNumber = this.device.applianceId || 'unknown';
|
|
56
|
+
this.matterUuid = matterAPI.uuid.generate(serialNumber);
|
|
57
|
+
const matterAccessory = {
|
|
58
|
+
UUID: this.matterUuid,
|
|
59
|
+
displayName: this.device.nickname || 'SmartHQ Hood',
|
|
60
|
+
serialNumber,
|
|
61
|
+
manufacturer: this.device.brand && this.device.brand !== 'Unknown' ? this.device.brand : 'GE Appliances',
|
|
62
|
+
model: this.device.model || 'SmartHQ',
|
|
63
|
+
firmwareRevision: this.deviceFirmwareVersion,
|
|
64
|
+
hardwareRevision: this.deviceFirmwareVersion,
|
|
65
|
+
deviceType: matterAPI.deviceTypes.CookTop, // Hood is part of cooktop
|
|
66
|
+
clusters: {
|
|
67
|
+
// Fan Control cluster for hood fan
|
|
68
|
+
fanControl: {
|
|
69
|
+
fanMode: 0, // 0=Off, 1=Low, 2=Medium, 3=High, 4=Boost
|
|
70
|
+
fanModeSequence: 4,
|
|
71
|
+
percentSetting: 0,
|
|
72
|
+
percentCurrent: 0,
|
|
73
|
+
},
|
|
74
|
+
// On/Off cluster for light
|
|
75
|
+
onOff: {
|
|
76
|
+
onOff: false,
|
|
77
|
+
},
|
|
78
|
+
// Level Control for light dimming
|
|
79
|
+
levelControl: {
|
|
80
|
+
currentLevel: 0,
|
|
81
|
+
minLevel: 0,
|
|
82
|
+
maxLevel: 254,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
handlers: {},
|
|
86
|
+
};
|
|
87
|
+
matterAPI.registerAccessory(matterAccessory);
|
|
88
|
+
this.infoLog('Created Matter Hood with fan control and dimmable light clusters');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Initialize HAP (HomeKit) protocol
|
|
92
|
+
*/
|
|
93
|
+
initializeHAP() {
|
|
94
|
+
this.fanSvc = this.accessory.getService(this.FAN_SVC_NAME)
|
|
95
|
+
?? this.accessory.addService(this.platform.Service.Fanv2, `${this.accessory.displayName} Fan`, this.FAN_SVC_NAME);
|
|
96
|
+
this.lightSvc = this.accessory.getService(this.LIGHT_SVC_NAME)
|
|
97
|
+
?? this.accessory.addService(this.platform.Service.Lightbulb, `${this.accessory.displayName} Light`, this.LIGHT_SVC_NAME);
|
|
98
|
+
const fanSwitchSvc = this.accessory.getService('HOOD_FAN_SWITCH');
|
|
99
|
+
if (fanSwitchSvc) {
|
|
100
|
+
this.accessory.removeService(fanSwitchSvc);
|
|
101
|
+
}
|
|
102
|
+
const lightSwitchSvc = this.accessory.getService('HOOD_LIGHT_SWITCH');
|
|
103
|
+
if (lightSwitchSvc) {
|
|
104
|
+
this.accessory.removeService(lightSwitchSvc);
|
|
105
|
+
}
|
|
106
|
+
this.fanSvc
|
|
107
|
+
.getCharacteristic(this.platform.Characteristic.Active)
|
|
108
|
+
.onGet(this.handleGetFanActive.bind(this))
|
|
109
|
+
.onSet(this.handleSetFanActive.bind(this));
|
|
110
|
+
this.fanSvc
|
|
111
|
+
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
112
|
+
.setProps({
|
|
113
|
+
minValue: 0,
|
|
114
|
+
maxValue: 100,
|
|
115
|
+
minStep: 25,
|
|
116
|
+
})
|
|
117
|
+
.onGet(this.handleGetFanRotationSpeed.bind(this))
|
|
118
|
+
.onSet(this.handleSetFanRotationSpeed.bind(this));
|
|
119
|
+
this.lightSvc
|
|
120
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
121
|
+
.onGet(this.handleGetLightOn.bind(this))
|
|
122
|
+
.onSet(this.handleSetLightOn.bind(this));
|
|
123
|
+
this.lightSvc
|
|
124
|
+
.getCharacteristic(this.platform.Characteristic.Brightness)
|
|
125
|
+
.setProps({
|
|
126
|
+
minValue: 0,
|
|
127
|
+
maxValue: 100,
|
|
128
|
+
minStep: 50,
|
|
129
|
+
})
|
|
130
|
+
.onGet(this.handleGetLightBrightness.bind(this))
|
|
131
|
+
.onSet(this.handleSetLightBrightness.bind(this));
|
|
132
|
+
interval(this.deviceRefreshRate * 1000)
|
|
133
|
+
.pipe(startWith(0))
|
|
134
|
+
.subscribe(this.refreshState.bind(this));
|
|
135
|
+
}
|
|
136
|
+
async getFanSpeed() {
|
|
137
|
+
const value = await this.readErd(ERD_TYPES.HOOD_FAN_SPEED);
|
|
138
|
+
if (!value) {
|
|
139
|
+
throw new Error('Failed to get fan speed: ERD not available');
|
|
140
|
+
}
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
async setFanSpeed(value) {
|
|
144
|
+
await this.writeErd(ERD_TYPES.HOOD_FAN_SPEED, value);
|
|
145
|
+
}
|
|
146
|
+
async getLightLevel() {
|
|
147
|
+
const value = await this.readErd(ERD_TYPES.HOOD_LIGHT_LEVEL);
|
|
148
|
+
if (!value) {
|
|
149
|
+
throw new Error('Failed to get light level: ERD not available');
|
|
150
|
+
}
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
153
|
+
async setLightLevel(value) {
|
|
154
|
+
await this.writeErd(ERD_TYPES.HOOD_LIGHT_LEVEL, value);
|
|
155
|
+
}
|
|
156
|
+
fanSpeedToRotationSpeed(fanSpeed) {
|
|
157
|
+
switch (fanSpeed) {
|
|
158
|
+
case FanSpeed.OFF:
|
|
159
|
+
return 0;
|
|
160
|
+
case FanSpeed.LOW:
|
|
161
|
+
return 25;
|
|
162
|
+
case FanSpeed.MEDIUM:
|
|
163
|
+
return 50;
|
|
164
|
+
case FanSpeed.HIGH:
|
|
165
|
+
return 75;
|
|
166
|
+
case FanSpeed.BOOST:
|
|
167
|
+
return 100;
|
|
168
|
+
default:
|
|
169
|
+
return 0;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
rotationSpeedToFanSpeed(rotationSpeed) {
|
|
173
|
+
if (rotationSpeed === 0) {
|
|
174
|
+
return FanSpeed.OFF;
|
|
175
|
+
}
|
|
176
|
+
if (rotationSpeed <= 25) {
|
|
177
|
+
return FanSpeed.LOW;
|
|
178
|
+
}
|
|
179
|
+
if (rotationSpeed <= 50) {
|
|
180
|
+
return FanSpeed.MEDIUM;
|
|
181
|
+
}
|
|
182
|
+
if (rotationSpeed <= 75) {
|
|
183
|
+
return FanSpeed.HIGH;
|
|
184
|
+
}
|
|
185
|
+
return FanSpeed.BOOST;
|
|
186
|
+
}
|
|
187
|
+
lightLevelToBrightness(lightLevel) {
|
|
188
|
+
switch (lightLevel) {
|
|
189
|
+
case LightLevel.OFF:
|
|
190
|
+
return 0;
|
|
191
|
+
case LightLevel.DIM:
|
|
192
|
+
return 50;
|
|
193
|
+
case LightLevel.HIGH:
|
|
194
|
+
return 100;
|
|
195
|
+
default:
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
brightnessToLightLevel(brightness) {
|
|
200
|
+
if (brightness === 0) {
|
|
201
|
+
return LightLevel.OFF;
|
|
202
|
+
}
|
|
203
|
+
if (brightness <= 50) {
|
|
204
|
+
return LightLevel.DIM;
|
|
205
|
+
}
|
|
206
|
+
return LightLevel.HIGH;
|
|
207
|
+
}
|
|
208
|
+
handleGetFanActive() {
|
|
209
|
+
return this.getFanSpeed()
|
|
210
|
+
.then((fanSpeed) => {
|
|
211
|
+
const isActive = fanSpeed !== FanSpeed.OFF;
|
|
212
|
+
const value = isActive ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
|
|
213
|
+
this.debugLog(`Get fan active: ${isActive}`);
|
|
214
|
+
return value;
|
|
215
|
+
})
|
|
216
|
+
.catch((err) => {
|
|
217
|
+
this.errorLog(`handleGetFanActive failed: ${err.message}`);
|
|
218
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
handleSetFanActive(value) {
|
|
222
|
+
const isActive = value === this.platform.Characteristic.Active.ACTIVE;
|
|
223
|
+
const fanSpeed = isActive ? FanSpeed.LOW : FanSpeed.OFF;
|
|
224
|
+
this.debugLog(`Set fan active: ${isActive}`);
|
|
225
|
+
return this.setFanSpeed(fanSpeed)
|
|
226
|
+
.then(() => {
|
|
227
|
+
const rotationSpeed = isActive ? 25 : 0;
|
|
228
|
+
this.fanSvc.updateCharacteristic(this.platform.Characteristic.RotationSpeed, rotationSpeed);
|
|
229
|
+
})
|
|
230
|
+
.catch((err) => {
|
|
231
|
+
this.errorLog(`handleSetFanActive failed: ${err.message}`);
|
|
232
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
handleGetFanRotationSpeed() {
|
|
236
|
+
return this.getFanSpeed()
|
|
237
|
+
.then((fanSpeed) => {
|
|
238
|
+
const rotationSpeed = this.fanSpeedToRotationSpeed(fanSpeed);
|
|
239
|
+
this.debugLog(`Get fan rotation speed: ${rotationSpeed}% (${fanSpeed})`);
|
|
240
|
+
return rotationSpeed;
|
|
241
|
+
})
|
|
242
|
+
.catch((err) => {
|
|
243
|
+
this.errorLog(`handleGetFanRotationSpeed failed: ${err.message}`);
|
|
244
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
handleSetFanRotationSpeed(value) {
|
|
248
|
+
const rotationSpeed = value;
|
|
249
|
+
const fanSpeed = this.rotationSpeedToFanSpeed(rotationSpeed);
|
|
250
|
+
this.debugLog(`Set fan rotation speed: ${rotationSpeed}% -> ${fanSpeed}`);
|
|
251
|
+
return this.setFanSpeed(fanSpeed)
|
|
252
|
+
.then(() => {
|
|
253
|
+
this.fanSvc.updateCharacteristic(this.platform.Characteristic.RotationSpeed, rotationSpeed);
|
|
254
|
+
})
|
|
255
|
+
.catch((err) => {
|
|
256
|
+
this.errorLog(`handleSetFanRotationSpeed failed: ${err.message}`);
|
|
257
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
handleGetLightOn() {
|
|
261
|
+
return this.getLightLevel()
|
|
262
|
+
.then((lightLevel) => {
|
|
263
|
+
const isOn = lightLevel !== LightLevel.OFF;
|
|
264
|
+
this.debugLog(`Get light on: ${isOn}`);
|
|
265
|
+
return isOn;
|
|
266
|
+
})
|
|
267
|
+
.catch((err) => {
|
|
268
|
+
this.errorLog(`handleGetLightOn failed: ${err.message}`);
|
|
269
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
handleSetLightOn(value) {
|
|
273
|
+
const isOn = value;
|
|
274
|
+
const lightLevel = isOn ? LightLevel.DIM : LightLevel.OFF;
|
|
275
|
+
this.debugLog(`Set light on: ${isOn}`);
|
|
276
|
+
return this.setLightLevel(lightLevel)
|
|
277
|
+
.then(() => {
|
|
278
|
+
const brightness = isOn ? 50 : 0;
|
|
279
|
+
this.lightSvc.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
|
|
280
|
+
})
|
|
281
|
+
.catch((err) => {
|
|
282
|
+
this.errorLog(`handleSetLightOn failed: ${err.message}`);
|
|
283
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
handleGetLightBrightness() {
|
|
287
|
+
return this.getLightLevel()
|
|
288
|
+
.then((lightLevel) => {
|
|
289
|
+
const brightness = this.lightLevelToBrightness(lightLevel);
|
|
290
|
+
this.debugLog(`Get light brightness: ${brightness}% (${lightLevel})`);
|
|
291
|
+
return brightness;
|
|
292
|
+
})
|
|
293
|
+
.catch((err) => {
|
|
294
|
+
this.errorLog(`handleGetLightBrightness failed: ${err.message}`);
|
|
295
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
handleSetLightBrightness(value) {
|
|
299
|
+
const brightness = value;
|
|
300
|
+
const lightLevel = this.brightnessToLightLevel(brightness);
|
|
301
|
+
this.debugLog(`Set light brightness: ${brightness}% -> ${lightLevel}`);
|
|
302
|
+
return this.setLightLevel(lightLevel)
|
|
303
|
+
.then(() => {
|
|
304
|
+
this.lightSvc.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
|
|
305
|
+
})
|
|
306
|
+
.catch((err) => {
|
|
307
|
+
this.errorLog(`handleSetLightBrightness failed: ${err.message}`);
|
|
308
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
refreshState() {
|
|
312
|
+
return Promise.all([
|
|
313
|
+
this.getFanSpeed(),
|
|
314
|
+
this.getLightLevel(),
|
|
315
|
+
])
|
|
316
|
+
.then(([fanSpeed, lightLevel]) => {
|
|
317
|
+
const isActive = fanSpeed !== FanSpeed.OFF;
|
|
318
|
+
const rotationSpeed = this.fanSpeedToRotationSpeed(fanSpeed);
|
|
319
|
+
const isOn = lightLevel !== LightLevel.OFF;
|
|
320
|
+
const brightness = this.lightLevelToBrightness(lightLevel);
|
|
321
|
+
this.fanSvc.updateCharacteristic(this.platform.Characteristic.Active, isActive ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE);
|
|
322
|
+
this.fanSvc.updateCharacteristic(this.platform.Characteristic.RotationSpeed, rotationSpeed);
|
|
323
|
+
this.lightSvc.updateCharacteristic(this.platform.Characteristic.On, isOn);
|
|
324
|
+
this.lightSvc.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
|
|
325
|
+
this.debugLog(`State refreshed - Fan: ${fanSpeed} (${rotationSpeed}%), Light: ${lightLevel} (${brightness}%)`);
|
|
326
|
+
})
|
|
327
|
+
.catch((err) => {
|
|
328
|
+
this.errorLog(`Failed to refresh state: ${err.message}`);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=hood.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hood.js","sourceRoot":"","sources":["../../src/devices/hood.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,IAAK,QAMJ;AAND,WAAK,QAAQ;IACX,sBAAU,CAAA;IACV,sBAAU,CAAA;IACV,yBAAa,CAAA;IACb,uBAAW,CAAA;IACX,wBAAY,CAAA;AACd,CAAC,EANI,QAAQ,KAAR,QAAQ,QAMZ;AAED,IAAK,UAIJ;AAJD,WAAK,UAAU;IACb,wBAAU,CAAA;IACV,wBAAU,CAAA;IACV,yBAAW,CAAA;AACb,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,OAAO,WAAY,SAAQ,UAAU;IAUpB;IACA;IACA;IAXJ,YAAY,GAAG,UAAU,CAAA;IACzB,cAAc,GAAG,YAAY,CAAA;IACtC,MAAM,CAAU;IAChB,QAAQ,CAAU;IAE1B,+BAA+B;IACvB,iBAAiB,GAAY,KAAK,CAAA;IAE1C,YACqB,QAAyB,EACzB,SAA4C,EAC5C,MAAgD;QAEnE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;QAJf,aAAQ,GAAR,QA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AC,QAAQ,CACrG,CAAA;YACD,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;YAE3F,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;YACzE,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;YAEvF,IAAI,CAAC,QAAQ,CAAC,0BAA0B,QAAQ,KAAK,aAAa,cAAc,UAAU,KAAK,UAAU,IAAI,CAAC,CAAA;QAChH,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,IAAI,CAAC,QAAQ,CAAC,4BAA4B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACN,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PlatformAccessory } from 'homebridge';
|
|
2
|
+
import type { SmartHQPlatform } from '../platform.js';
|
|
3
|
+
import type { devicesConfig, SmartHqContext } from '../settings.js';
|
|
4
|
+
import { deviceBase } from './device.js';
|
|
5
|
+
export declare class SmartHQMicrowave extends deviceBase {
|
|
6
|
+
readonly platform: SmartHQPlatform;
|
|
7
|
+
readonly device: SmartHqContext['device'] & devicesConfig;
|
|
8
|
+
private useMatterOverride;
|
|
9
|
+
constructor(platform: SmartHQPlatform, accessory: PlatformAccessory<SmartHqContext>, device: SmartHqContext['device'] & devicesConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Initialize Matter protocol
|
|
12
|
+
*/
|
|
13
|
+
private initializeMatter;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize HAP (HomeKit) protocol
|
|
16
|
+
*/
|
|
17
|
+
private initializeHAP;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=microwave.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microwave.d.ts","sourceRoot":"","sources":["../../src/devices/microwave.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,qBAAa,gBAAiB,SAAQ,UAAU;IAK5C,QAAQ,CAAC,QAAQ,EAAE,eAAe;IAElC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,aAAa;IAL3D,OAAO,CAAC,iBAAiB,CAAiB;gBAG/B,QAAQ,EAAE,eAAe,EAClC,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAAC,EACnC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,aAAa;IAkB3D;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA6CxB;;OAEG;IACH,OAAO,CAAC,aAAa;CAsEtB"}
|