@homebridge-plugins/homebridge-smarthq 0.5.0-beta.4 → 0.5.0-beta.40

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.
Files changed (145) hide show
  1. package/.github/ISSUE_TEMPLATE/config.yml +1 -1
  2. package/.github/copilot-instructions.md +361 -0
  3. package/.github/scripts/branch-helper.sh +41 -0
  4. package/.github/workflows/beta-release.yml +1 -1
  5. package/.github/workflows/release.yml +53 -17
  6. package/CHANGELOG.md +563 -18
  7. package/MATTER.md +304 -0
  8. package/README.md +15 -0
  9. package/config.schema.json +24 -5
  10. package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.d.ts.map +1 -1
  11. package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.js +3 -1
  12. package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.js.map +1 -1
  13. package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.d.ts.map +1 -1
  14. package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.js +3 -1
  15. package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.js.map +1 -1
  16. package/dist/devices/OpalIceMaker/Managers/OpalPowerSvcManager.js +1 -1
  17. package/dist/devices/OpalIceMaker/Managers/OpalPowerSvcManager.js.map +1 -1
  18. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.d.ts +1 -1
  19. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.d.ts.map +1 -1
  20. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.js +12 -5
  21. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.js.map +1 -1
  22. package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.d.ts.map +1 -1
  23. package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.js +4 -2
  24. package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.js.map +1 -1
  25. package/dist/devices/OpalIceMaker/OpalDeviceBase.d.ts +3 -4
  26. package/dist/devices/OpalIceMaker/OpalDeviceBase.d.ts.map +1 -1
  27. package/dist/devices/OpalIceMaker/OpalDeviceBase.js +3 -18
  28. package/dist/devices/OpalIceMaker/OpalDeviceBase.js.map +1 -1
  29. package/dist/devices/advantium.d.ts +10 -0
  30. package/dist/devices/advantium.d.ts.map +1 -0
  31. package/dist/devices/advantium.js +75 -0
  32. package/dist/devices/advantium.js.map +1 -0
  33. package/dist/devices/airConditioner.d.ts +11 -2
  34. package/dist/devices/airConditioner.d.ts.map +1 -1
  35. package/dist/devices/airConditioner.js +111 -17
  36. package/dist/devices/airConditioner.js.map +1 -1
  37. package/dist/devices/beverageCenter.d.ts +10 -0
  38. package/dist/devices/beverageCenter.d.ts.map +1 -0
  39. package/dist/devices/beverageCenter.js +125 -0
  40. package/dist/devices/beverageCenter.js.map +1 -0
  41. package/dist/devices/clothesDryer.d.ts +21 -0
  42. package/dist/devices/clothesDryer.d.ts.map +1 -0
  43. package/dist/devices/clothesDryer.js +273 -0
  44. package/dist/devices/clothesDryer.js.map +1 -0
  45. package/dist/devices/clothesWasher.d.ts +21 -0
  46. package/dist/devices/clothesWasher.d.ts.map +1 -0
  47. package/dist/devices/clothesWasher.js +284 -0
  48. package/dist/devices/clothesWasher.js.map +1 -0
  49. package/dist/devices/coffeeMaker.d.ts +10 -0
  50. package/dist/devices/coffeeMaker.d.ts.map +1 -0
  51. package/dist/devices/coffeeMaker.js +79 -0
  52. package/dist/devices/coffeeMaker.js.map +1 -0
  53. package/dist/devices/device.d.ts +108 -13
  54. package/dist/devices/device.d.ts.map +1 -1
  55. package/dist/devices/device.js +381 -60
  56. package/dist/devices/device.js.map +1 -1
  57. package/dist/devices/dishwasher.d.ts +9 -3
  58. package/dist/devices/dishwasher.d.ts.map +1 -1
  59. package/dist/devices/dishwasher.js +164 -29
  60. package/dist/devices/dishwasher.js.map +1 -1
  61. package/dist/devices/hood.d.ts +41 -0
  62. package/dist/devices/hood.d.ts.map +1 -0
  63. package/dist/devices/hood.js +336 -0
  64. package/dist/devices/hood.js.map +1 -0
  65. package/dist/devices/microwave.d.ts +19 -0
  66. package/dist/devices/microwave.d.ts.map +1 -0
  67. package/dist/devices/microwave.js +147 -0
  68. package/dist/devices/microwave.js.map +1 -0
  69. package/dist/devices/oven.d.ts +9 -2
  70. package/dist/devices/oven.d.ts.map +1 -1
  71. package/dist/devices/oven.js +267 -43
  72. package/dist/devices/oven.js.map +1 -1
  73. package/dist/devices/refrigerator.d.ts +37 -2
  74. package/dist/devices/refrigerator.d.ts.map +1 -1
  75. package/dist/devices/refrigerator.js +583 -34
  76. package/dist/devices/refrigerator.js.map +1 -1
  77. package/dist/devices/waterFilter.d.ts +10 -0
  78. package/dist/devices/waterFilter.d.ts.map +1 -0
  79. package/dist/devices/waterFilter.js +67 -0
  80. package/dist/devices/waterFilter.js.map +1 -0
  81. package/dist/devices/waterHeater.d.ts +19 -0
  82. package/dist/devices/waterHeater.d.ts.map +1 -0
  83. package/dist/devices/waterHeater.js +161 -0
  84. package/dist/devices/waterHeater.js.map +1 -0
  85. package/dist/devices/waterSoftener.d.ts +10 -0
  86. package/dist/devices/waterSoftener.d.ts.map +1 -0
  87. package/dist/devices/waterSoftener.js +67 -0
  88. package/dist/devices/waterSoftener.js.map +1 -0
  89. package/dist/getAccessToken.d.ts.map +1 -1
  90. package/dist/getAccessToken.js +190 -2
  91. package/dist/getAccessToken.js.map +1 -1
  92. package/dist/platform.d.ts +32 -1
  93. package/dist/platform.d.ts.map +1 -1
  94. package/dist/platform.js +853 -151
  95. package/dist/platform.js.map +1 -1
  96. package/dist/platform.test.d.ts +2 -0
  97. package/dist/platform.test.d.ts.map +1 -0
  98. package/dist/platform.test.js +80 -0
  99. package/dist/platform.test.js.map +1 -0
  100. package/dist/settings.d.ts +24 -0
  101. package/dist/settings.d.ts.map +1 -1
  102. package/dist/settings.js +13 -0
  103. package/dist/settings.js.map +1 -1
  104. package/docs/assets/highlight.css +7 -0
  105. package/docs/assets/main.js +5 -5
  106. package/docs/assets/navigation.js +1 -0
  107. package/docs/assets/search.js +1 -0
  108. package/docs/assets/style.css +248 -226
  109. package/docs/classes/SmartHQPlatform.html +54 -56
  110. package/docs/hierarchy.html +1 -0
  111. package/docs/index.html +22 -12
  112. package/docs/interfaces/DeviceOptions.html +2 -3
  113. package/docs/interfaces/SmartHQPlatformConfig.html +6 -17
  114. package/docs/interfaces/SmartHqContext.html +6 -4
  115. package/docs/interfaces/SmartHqERDResponse.html +7 -8
  116. package/docs/interfaces/credentials.html +3 -4
  117. package/docs/interfaces/devicesConfig.html +9 -8
  118. package/docs/interfaces/options.html +7 -8
  119. package/docs/media/copilot-instructions.md +361 -0
  120. package/docs/modules.html +1 -2
  121. package/docs/variables/API_URL.html +1 -2
  122. package/docs/variables/ERD_CODES.html +1 -2
  123. package/docs/variables/ERD_TYPES.html +1 -2
  124. package/docs/variables/KEEPALIVE_TIMEOUT.html +1 -2
  125. package/docs/variables/LOGIN_URL.html +2 -3
  126. package/docs/variables/OAUTH2_CLIENT_ID.html +1 -2
  127. package/docs/variables/OAUTH2_CLIENT_SECRET.html +1 -2
  128. package/docs/variables/OAUTH2_REDIRECT_URI.html +1 -2
  129. package/docs/variables/PLATFORM_NAME.html +2 -3
  130. package/docs/variables/PLUGIN_NAME.html +2 -3
  131. package/docs/variables/SECURE_URL.html +2 -3
  132. package/docs/variables/default.html +1 -0
  133. package/package.json +22 -33
  134. package/typedoc.json +0 -4
  135. package/vitest.config.ts +6 -5
  136. package/.github/workflows/build.yml +0 -18
  137. package/.github/workflows/changerelease.yml +0 -11
  138. package/.github/workflows/labeler.yml +0 -9
  139. package/.github/workflows/release-drafter.yml +0 -14
  140. package/docs/assets/dmt/dmt-component-data.js +0 -1
  141. package/docs/assets/dmt/dmt-components.css +0 -20
  142. package/docs/assets/dmt/dmt-components.js +0 -67
  143. package/docs/assets/dmt/dmt-search.cmp +0 -0
  144. package/docs/assets/dmt/dmt-theme.css +0 -1
  145. package/docs/functions/default.html +0 -2
@@ -1,31 +1,182 @@
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
- accessory.context.device.features.forEach((feature) => {
19
- switch (feature) {
20
- case 'DISHWASHER_V1_FOUNDATION': {
21
- const dishwasher = this.accessory.getService(accessory.displayName) ?? this.accessory.addService(this.platform.Service.Lightbulb, accessory.displayName, 'Dishwasher');
22
- dishwasher
23
- .getCharacteristic(this.platform.Characteristic.On)
24
- .onGet(() => this.readErd(ERD_TYPES.DISHWASHER_CYCLE).then(r => Number.parseInt(r) !== 0))
25
- .onSet(value => this.writeErd(ERD_TYPES.DISHWASHER_CYCLE, value));
26
- break;
27
- }
19
+ this.debugLog(`Using protocol: ${this.useMatterOverride ? 'Matter' : 'HAP'}`);
20
+ // Initialize the appropriate protocol
21
+ if (this.useMatterOverride) {
22
+ this.initializeMatter().catch((error) => {
23
+ this.errorLog(`Failed to initialize Matter: ${error}`);
24
+ });
25
+ }
26
+ else {
27
+ this.initializeHAP();
28
+ }
29
+ // Start periodic refresh
30
+ this.SensorUpdateInProgress = false;
31
+ interval(this.deviceRefreshRate * 10000)
32
+ .pipe(skipWhile(() => this.SensorUpdateInProgress))
33
+ .subscribe(async () => {
34
+ // await this.refreshStatus()
35
+ });
36
+ }
37
+ /**
38
+ * Initialize Matter protocol
39
+ */
40
+ async initializeMatter() {
41
+ const { valid, api: matterAPI } = this.validateMatterAPI();
42
+ if (!valid) {
43
+ if (this.device.matterOnly) {
44
+ this.errorLog('Matter API not available or incomplete - accessory will NOT be published (matterOnly mode enabled)');
45
+ this.errorLog('Reason: Matter API validation failed');
46
+ return;
47
+ }
48
+ this.errorLog('Matter API not available or incomplete - falling back to HAP');
49
+ this.initializeHAP();
50
+ return;
51
+ }
52
+ // Check if DishwasherDevice device type is available
53
+ if (!matterAPI.deviceTypes.DishwasherDevice) {
54
+ if (this.device.matterOnly) {
55
+ this.errorLog('Matter DishwasherDevice device type not available - accessory will NOT be published (matterOnly mode enabled)');
56
+ this.errorLog('Reason: Required Matter device type "DishwasherDevice" is not available in this Homebridge version');
57
+ this.errorLog(`Available Matter device types: ${Object.keys(matterAPI.deviceTypes).join(', ')}`);
58
+ return;
59
+ }
60
+ this.warnLog('Matter DishwasherDevice device type not available in this Homebridge version - falling back to HAP');
61
+ this.warnLog(`Available Matter device types: ${Object.keys(matterAPI.deviceTypes).join(', ')}`);
62
+ this.useMatterOverride = false;
63
+ this.initializeHAP();
64
+ return;
65
+ }
66
+ const serialNumber = this.device.applianceId || 'unknown';
67
+ this.matterUuid = matterAPI.uuid.generate(serialNumber);
68
+ // Create Matter accessory configuration with dishwasher-specific clusters
69
+ const matterAccessory = {
70
+ UUID: this.matterUuid,
71
+ displayName: this.device.nickname || 'SmartHQ Dishwasher',
72
+ serialNumber,
73
+ manufacturer: this.device.brand && this.device.brand !== 'Unknown' ? this.device.brand : 'GE Appliances',
74
+ model: this.device.model || 'SmartHQ',
75
+ firmwareRevision: this.deviceFirmwareVersion,
76
+ hardwareRevision: this.deviceFirmwareVersion,
77
+ deviceType: matterAPI.deviceTypes.DishwasherDevice,
78
+ clusters: {
79
+ // On/Off cluster for dishwasher power state
80
+ onOff: {
81
+ onOff: false,
82
+ },
83
+ // Operational State cluster for cycle status (maps to DISHWASHER_CYCLE)
84
+ operationalState: {
85
+ operationalState: 0, // 0=Stopped, 1=Running, 2=Paused
86
+ operationalError: { errorStateID: 0 },
87
+ phaseList: ['Washing', 'Rinsing', 'Drying'],
88
+ currentPhase: 0,
89
+ },
90
+ // Timer cluster for time remaining (maps to DISHWASHER_CYCLE_PHASE_TIME_REMAINING)
91
+ timer: {
92
+ timerState: 0, // 0=Stopped, 1=Running, 2=Paused
93
+ duration: 0,
94
+ remainingTime: 0,
95
+ },
96
+ // Dishwasher Mode cluster for cycle selection
97
+ dishwasherMode: {
98
+ supportedModes: [
99
+ { label: 'Normal', mode: 0 },
100
+ { label: 'Heavy', mode: 1 },
101
+ { label: 'Light', mode: 2 },
102
+ { label: 'Quick', mode: 3 },
103
+ ],
104
+ currentMode: 0,
105
+ },
106
+ // Dishwasher Alarm cluster for cycle completion
107
+ dishwasherAlarm: {
108
+ mask: 0,
109
+ state: 0,
110
+ supported: 1, // Bit 0: Cycle complete
111
+ },
112
+ },
113
+ handlers: {
114
+ onOff: {
115
+ on: async () => {
116
+ await this.writeErd(ERD_TYPES.DISHWASHER_CYCLE, true);
117
+ },
118
+ off: async () => {
119
+ await this.writeErd(ERD_TYPES.DISHWASHER_CYCLE, false);
120
+ },
121
+ },
122
+ },
123
+ };
124
+ // Register Matter accessory as external device
125
+ await matterAPI.registerPlatformAccessories('@homebridge-plugins/homebridge-smarthq', 'SmartHQ', [matterAccessory]);
126
+ this.matterRegistered = true;
127
+ this.infoLog('Registered Matter Dishwasher as external accessory with operational state, timer, mode selection, and alarm clusters');
128
+ }
129
+ /**
130
+ * Initialize HAP (HomeKit) protocol
131
+ */
132
+ initializeHAP() {
133
+ // Dishwasher Running State (Valve for active/inactive)
134
+ const dishwasherValve = this.accessory.getService('Dishwasher') ?? this.accessory.addService(this.platform.Service.Valve, 'Dishwasher', 'Dishwasher');
135
+ dishwasherValve.setCharacteristic(this.platform.Characteristic.Name, 'Dishwasher');
136
+ dishwasherValve.setCharacteristic(this.platform.Characteristic.ValveType, this.platform.Characteristic.ValveType.GENERIC_VALVE);
137
+ dishwasherValve
138
+ .getCharacteristic(this.platform.Characteristic.Active)
139
+ .onGet(async () => {
140
+ try {
141
+ const r = await this.readErd(ERD_TYPES.DISHWASHER_CYCLE);
142
+ return r && Number.parseInt(r) !== 0 ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
28
143
  }
144
+ catch (error) {
145
+ this.warnLog?.(`Dishwasher Active error: ${error?.message ?? error}`);
146
+ return this.platform.Characteristic.Active.INACTIVE;
147
+ }
148
+ })
149
+ .onSet(async (value) => {
150
+ try {
151
+ await this.writeErd(ERD_TYPES.DISHWASHER_CYCLE, value === this.platform.Characteristic.Active.ACTIVE);
152
+ }
153
+ catch (error) {
154
+ this.warnLog?.(`Dishwasher Active set error: ${error?.message ?? error}`);
155
+ }
156
+ });
157
+ dishwasherValve
158
+ .getCharacteristic(this.platform.Characteristic.InUse)
159
+ .onGet(async () => {
160
+ try {
161
+ const r = await this.readErd(ERD_TYPES.DISHWASHER_CYCLE);
162
+ return r && Number.parseInt(r) !== 0 ? this.platform.Characteristic.InUse.IN_USE : this.platform.Characteristic.InUse.NOT_IN_USE;
163
+ }
164
+ catch (error) {
165
+ this.warnLog?.(`Dishwasher InUse error: ${error?.message ?? error}`);
166
+ return this.platform.Characteristic.InUse.NOT_IN_USE;
167
+ }
168
+ });
169
+ // Dishwasher Door Sensor
170
+ const doorSensor = this.accessory.getService('Dishwasher Door') ?? this.accessory.addService(this.platform.Service.ContactSensor, 'Dishwasher Door', 'DishwasherDoor');
171
+ doorSensor.setCharacteristic(this.platform.Characteristic.Name, 'Dishwasher Door');
172
+ doorSensor
173
+ .getCharacteristic(this.platform.Characteristic.ContactSensorState)
174
+ .onGet(async () => {
175
+ const r = await this.readErd(ERD_TYPES.LAUNDRY_DOOR);
176
+ // 0=closed (detected), 1=open (not detected)
177
+ return r && Number.parseInt(r) === 1
178
+ ? this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
179
+ : this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED;
29
180
  });
30
181
  // this is subject we use to track when we need to POST changes to the SmartHQ API
31
182
  this.SensorUpdateInProgress = false;
@@ -38,21 +189,5 @@ export class SmartHQDishWasher extends deviceBase {
38
189
  // await this.refreshStatus()
39
190
  });
40
191
  }
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
192
  }
58
193
  //# sourceMappingURL=dishwasher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dishwasher.js","sourceRoot":"","sources":["../../src/devices/dishwasher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,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;IAapC;IAEA;IAdX,UAAU;IACF,UAAU,CAIjB;IAED,UAAU;IACV,sBAAsB,CAAU;IAChC,YAAY,CAAK;IAEjB,YACW,QAAyB,EAClC,SAA4C,EACnC,MAAgD;QAEzD,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;QAJzB,aAAQ,GAAR,QAAQ,CAAiB;QAEzB,WAAM,GAAN,MAAM,CAA0C;QAIzD,IAAI,CAAC,QAAQ,CAAC,wBAAwB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAA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;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,YAAY,CAAa;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,QAAQ,CAAU;IAG1B,OAAO,CAAC,iBAAiB,CAAiB;gBAGrB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAAC,EAC5C,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,aAAa;IAoBrE;;OAEG;YACW,gBAAgB;IAoD9B;;OAEG;IACH,OAAO,CAAC,aAAa;YA4DP,WAAW;YAQX,WAAW;YAIX,aAAa;YAQb,aAAa;IAI3B,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,sBAAsB;IAU9B,kBAAkB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAclD,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB7D,yBAAyB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAazD,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBpE,gBAAgB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAahD,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB3D,wBAAwB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAaxD,wBAAwB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBnE,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CA2B9B"}
@@ -0,0 +1,336 @@
1
+ import { interval, startWith } from 'rxjs';
2
+ import { ERD_TYPES } from '../settings.js';
3
+ import { deviceBase } from './device.js';
4
+ var FanSpeed;
5
+ (function (FanSpeed) {
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().catch((error) => {
40
+ this.errorLog(`Failed to initialize Matter: ${error}`);
41
+ });
42
+ }
43
+ else {
44
+ this.initializeHAP();
45
+ }
46
+ }
47
+ /**
48
+ * Initialize Matter protocol
49
+ */
50
+ async initializeMatter() {
51
+ const { valid, api: matterAPI } = this.validateMatterAPI();
52
+ if (!valid) {
53
+ this.errorLog('Matter API not available or incomplete - falling back to HAP');
54
+ this.initializeHAP();
55
+ return;
56
+ }
57
+ const serialNumber = this.device.applianceId || 'unknown';
58
+ this.matterUuid = matterAPI.uuid.generate(serialNumber);
59
+ const matterAccessory = {
60
+ UUID: this.matterUuid,
61
+ displayName: this.device.nickname || 'SmartHQ Hood',
62
+ serialNumber,
63
+ manufacturer: this.device.brand && this.device.brand !== 'Unknown' ? this.device.brand : 'GE Appliances',
64
+ model: this.device.model || 'SmartHQ',
65
+ firmwareRevision: this.deviceFirmwareVersion,
66
+ hardwareRevision: this.deviceFirmwareVersion,
67
+ deviceType: matterAPI.deviceTypes.CookTop, // Hood is part of cooktop
68
+ clusters: {
69
+ // Fan Control cluster for hood fan
70
+ fanControl: {
71
+ fanMode: 0, // 0=Off, 1=Low, 2=Medium, 3=High, 4=Boost
72
+ fanModeSequence: 4,
73
+ percentSetting: 0,
74
+ percentCurrent: 0,
75
+ },
76
+ // On/Off cluster for light
77
+ onOff: {
78
+ onOff: false,
79
+ },
80
+ // Level Control for light dimming
81
+ levelControl: {
82
+ currentLevel: 0,
83
+ minLevel: 0,
84
+ maxLevel: 254,
85
+ },
86
+ },
87
+ handlers: {},
88
+ };
89
+ await matterAPI.registerPlatformAccessories('@homebridge-plugins/homebridge-smarthq', 'SmartHQ', [matterAccessory]);
90
+ this.matterRegistered = true;
91
+ this.infoLog('Registered Matter Hood as external accessory with fan control and dimmable light clusters');
92
+ }
93
+ /**
94
+ * Initialize HAP (HomeKit) protocol
95
+ */
96
+ initializeHAP() {
97
+ this.fanSvc = this.accessory.getService(this.FAN_SVC_NAME)
98
+ ?? this.accessory.addService(this.platform.Service.Fanv2, `${this.accessory.displayName} Fan`, this.FAN_SVC_NAME);
99
+ this.lightSvc = this.accessory.getService(this.LIGHT_SVC_NAME)
100
+ ?? this.accessory.addService(this.platform.Service.Lightbulb, `${this.accessory.displayName} Light`, this.LIGHT_SVC_NAME);
101
+ const fanSwitchSvc = this.accessory.getService('HOOD_FAN_SWITCH');
102
+ if (fanSwitchSvc) {
103
+ this.accessory.removeService(fanSwitchSvc);
104
+ }
105
+ const lightSwitchSvc = this.accessory.getService('HOOD_LIGHT_SWITCH');
106
+ if (lightSwitchSvc) {
107
+ this.accessory.removeService(lightSwitchSvc);
108
+ }
109
+ this.fanSvc
110
+ .getCharacteristic(this.platform.Characteristic.Active)
111
+ .onGet(this.handleGetFanActive.bind(this))
112
+ .onSet(this.handleSetFanActive.bind(this));
113
+ this.fanSvc
114
+ .getCharacteristic(this.platform.Characteristic.RotationSpeed)
115
+ .setProps({
116
+ minValue: 0,
117
+ maxValue: 100,
118
+ minStep: 25,
119
+ })
120
+ .onGet(this.handleGetFanRotationSpeed.bind(this))
121
+ .onSet(this.handleSetFanRotationSpeed.bind(this));
122
+ this.lightSvc
123
+ .getCharacteristic(this.platform.Characteristic.On)
124
+ .onGet(this.handleGetLightOn.bind(this))
125
+ .onSet(this.handleSetLightOn.bind(this));
126
+ this.lightSvc
127
+ .getCharacteristic(this.platform.Characteristic.Brightness)
128
+ .setProps({
129
+ minValue: 0,
130
+ maxValue: 100,
131
+ minStep: 50,
132
+ })
133
+ .onGet(this.handleGetLightBrightness.bind(this))
134
+ .onSet(this.handleSetLightBrightness.bind(this));
135
+ interval(this.deviceRefreshRate * 1000)
136
+ .pipe(startWith(0))
137
+ .subscribe(this.refreshState.bind(this));
138
+ }
139
+ async getFanSpeed() {
140
+ const value = await this.readErd(ERD_TYPES.HOOD_FAN_SPEED);
141
+ if (!value) {
142
+ throw new Error('Failed to get fan speed: ERD not available');
143
+ }
144
+ return value;
145
+ }
146
+ async setFanSpeed(value) {
147
+ await this.writeErd(ERD_TYPES.HOOD_FAN_SPEED, value);
148
+ }
149
+ async getLightLevel() {
150
+ const value = await this.readErd(ERD_TYPES.HOOD_LIGHT_LEVEL);
151
+ if (!value) {
152
+ throw new Error('Failed to get light level: ERD not available');
153
+ }
154
+ return value;
155
+ }
156
+ async setLightLevel(value) {
157
+ await this.writeErd(ERD_TYPES.HOOD_LIGHT_LEVEL, value);
158
+ }
159
+ fanSpeedToRotationSpeed(fanSpeed) {
160
+ switch (fanSpeed) {
161
+ case FanSpeed.OFF:
162
+ return 0;
163
+ case FanSpeed.LOW:
164
+ return 25;
165
+ case FanSpeed.MEDIUM:
166
+ return 50;
167
+ case FanSpeed.HIGH:
168
+ return 75;
169
+ case FanSpeed.BOOST:
170
+ return 100;
171
+ default:
172
+ return 0;
173
+ }
174
+ }
175
+ rotationSpeedToFanSpeed(rotationSpeed) {
176
+ if (rotationSpeed === 0) {
177
+ return FanSpeed.OFF;
178
+ }
179
+ if (rotationSpeed <= 25) {
180
+ return FanSpeed.LOW;
181
+ }
182
+ if (rotationSpeed <= 50) {
183
+ return FanSpeed.MEDIUM;
184
+ }
185
+ if (rotationSpeed <= 75) {
186
+ return FanSpeed.HIGH;
187
+ }
188
+ return FanSpeed.BOOST;
189
+ }
190
+ lightLevelToBrightness(lightLevel) {
191
+ switch (lightLevel) {
192
+ case LightLevel.OFF:
193
+ return 0;
194
+ case LightLevel.DIM:
195
+ return 50;
196
+ case LightLevel.HIGH:
197
+ return 100;
198
+ default:
199
+ return 0;
200
+ }
201
+ }
202
+ brightnessToLightLevel(brightness) {
203
+ if (brightness === 0) {
204
+ return LightLevel.OFF;
205
+ }
206
+ if (brightness <= 50) {
207
+ return LightLevel.DIM;
208
+ }
209
+ return LightLevel.HIGH;
210
+ }
211
+ handleGetFanActive() {
212
+ return this.getFanSpeed()
213
+ .then((fanSpeed) => {
214
+ const isActive = fanSpeed !== FanSpeed.OFF;
215
+ const value = isActive ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
216
+ this.debugLog(`Get fan active: ${isActive}`);
217
+ return value;
218
+ })
219
+ .catch((err) => {
220
+ this.errorLog(`handleGetFanActive failed: ${err.message}`);
221
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
222
+ });
223
+ }
224
+ handleSetFanActive(value) {
225
+ const isActive = value === this.platform.Characteristic.Active.ACTIVE;
226
+ const fanSpeed = isActive ? FanSpeed.LOW : FanSpeed.OFF;
227
+ this.debugLog(`Set fan active: ${isActive}`);
228
+ return this.setFanSpeed(fanSpeed)
229
+ .then(() => {
230
+ const rotationSpeed = isActive ? 25 : 0;
231
+ this.fanSvc.updateCharacteristic(this.platform.Characteristic.RotationSpeed, rotationSpeed);
232
+ })
233
+ .catch((err) => {
234
+ this.errorLog(`handleSetFanActive failed: ${err.message}`);
235
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
236
+ });
237
+ }
238
+ handleGetFanRotationSpeed() {
239
+ return this.getFanSpeed()
240
+ .then((fanSpeed) => {
241
+ const rotationSpeed = this.fanSpeedToRotationSpeed(fanSpeed);
242
+ this.debugLog(`Get fan rotation speed: ${rotationSpeed}% (${fanSpeed})`);
243
+ return rotationSpeed;
244
+ })
245
+ .catch((err) => {
246
+ this.errorLog(`handleGetFanRotationSpeed failed: ${err.message}`);
247
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
248
+ });
249
+ }
250
+ handleSetFanRotationSpeed(value) {
251
+ const rotationSpeed = value;
252
+ const fanSpeed = this.rotationSpeedToFanSpeed(rotationSpeed);
253
+ this.debugLog(`Set fan rotation speed: ${rotationSpeed}% -> ${fanSpeed}`);
254
+ return this.setFanSpeed(fanSpeed)
255
+ .then(() => {
256
+ this.fanSvc.updateCharacteristic(this.platform.Characteristic.RotationSpeed, rotationSpeed);
257
+ })
258
+ .catch((err) => {
259
+ this.errorLog(`handleSetFanRotationSpeed failed: ${err.message}`);
260
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
261
+ });
262
+ }
263
+ handleGetLightOn() {
264
+ return this.getLightLevel()
265
+ .then((lightLevel) => {
266
+ const isOn = lightLevel !== LightLevel.OFF;
267
+ this.debugLog(`Get light on: ${isOn}`);
268
+ return isOn;
269
+ })
270
+ .catch((err) => {
271
+ this.errorLog(`handleGetLightOn failed: ${err.message}`);
272
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
273
+ });
274
+ }
275
+ handleSetLightOn(value) {
276
+ const isOn = value;
277
+ const lightLevel = isOn ? LightLevel.DIM : LightLevel.OFF;
278
+ this.debugLog(`Set light on: ${isOn}`);
279
+ return this.setLightLevel(lightLevel)
280
+ .then(() => {
281
+ const brightness = isOn ? 50 : 0;
282
+ this.lightSvc.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
283
+ })
284
+ .catch((err) => {
285
+ this.errorLog(`handleSetLightOn failed: ${err.message}`);
286
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
287
+ });
288
+ }
289
+ handleGetLightBrightness() {
290
+ return this.getLightLevel()
291
+ .then((lightLevel) => {
292
+ const brightness = this.lightLevelToBrightness(lightLevel);
293
+ this.debugLog(`Get light brightness: ${brightness}% (${lightLevel})`);
294
+ return brightness;
295
+ })
296
+ .catch((err) => {
297
+ this.errorLog(`handleGetLightBrightness failed: ${err.message}`);
298
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
299
+ });
300
+ }
301
+ handleSetLightBrightness(value) {
302
+ const brightness = value;
303
+ const lightLevel = this.brightnessToLightLevel(brightness);
304
+ this.debugLog(`Set light brightness: ${brightness}% -> ${lightLevel}`);
305
+ return this.setLightLevel(lightLevel)
306
+ .then(() => {
307
+ this.lightSvc.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
308
+ })
309
+ .catch((err) => {
310
+ this.errorLog(`handleSetLightBrightness failed: ${err.message}`);
311
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
312
+ });
313
+ }
314
+ refreshState() {
315
+ return Promise.all([
316
+ this.getFanSpeed(),
317
+ this.getLightLevel(),
318
+ ])
319
+ .then(([fanSpeed, lightLevel]) => {
320
+ // Treat undefined values as OFF to prevent incorrect "on" states
321
+ const isActive = fanSpeed !== undefined && fanSpeed !== FanSpeed.OFF;
322
+ const rotationSpeed = this.fanSpeedToRotationSpeed(fanSpeed);
323
+ const isOn = lightLevel !== undefined && lightLevel !== LightLevel.OFF;
324
+ const brightness = this.lightLevelToBrightness(lightLevel);
325
+ this.fanSvc.updateCharacteristic(this.platform.Characteristic.Active, isActive ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE);
326
+ this.fanSvc.updateCharacteristic(this.platform.Characteristic.RotationSpeed, rotationSpeed);
327
+ this.lightSvc.updateCharacteristic(this.platform.Characteristic.On, isOn);
328
+ this.lightSvc.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
329
+ this.debugLog(`State refreshed - Fan: ${fanSpeed} (${rotationSpeed}%), Light: ${lightLevel} (${brightness}%)`);
330
+ })
331
+ .catch((err) => {
332
+ this.errorLog(`Failed to refresh state: ${err.message}`);
333
+ });
334
+ }
335
+ }
336
+ //# 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,QAAQ,CAAiB;QACzB,cAAS,GAAT,SAAS,CAAmC;QAC5C,WAAM,GAAN,MAAM,CAA0C;QAInE,yCAAyC;QACzC,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,SAAS,IAAI,KAAK,CAAA;QAElD,IAAI,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,SAAS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