homebridge 2.0.0-beta.39 → 2.0.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.
- package/dist/childBridgeFork.d.ts +0 -5
- package/dist/childBridgeFork.d.ts.map +1 -1
- package/dist/childBridgeFork.js +4 -9
- package/dist/childBridgeFork.js.map +1 -1
- package/dist/childBridgeService.d.ts +7 -0
- package/dist/childBridgeService.d.ts.map +1 -1
- package/dist/childBridgeService.js.map +1 -1
- package/dist/index.d.ts +24 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/ipcService.d.ts +2 -4
- package/dist/ipcService.d.ts.map +1 -1
- package/dist/ipcService.js +0 -2
- package/dist/ipcService.js.map +1 -1
- package/dist/matter/ChildBridgeMatterManager.d.ts +2 -2
- package/dist/matter/ChildBridgeMatterManager.d.ts.map +1 -1
- package/dist/matter/ChildBridgeMatterManager.js +10 -8
- package/dist/matter/ChildBridgeMatterManager.js.map +1 -1
- package/dist/matter/MatterBridgeManager.d.ts +0 -4
- package/dist/matter/MatterBridgeManager.d.ts.map +1 -1
- package/dist/matter/MatterBridgeManager.js +0 -13
- package/dist/matter/MatterBridgeManager.js.map +1 -1
- package/dist/matter/behaviors/ColorControlBehavior.d.ts +6 -7
- package/dist/matter/behaviors/ColorControlBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/ColorControlBehavior.js +146 -83
- package/dist/matter/behaviors/ColorControlBehavior.js.map +1 -1
- package/dist/matter/behaviors/DoorLockBehavior.d.ts +2 -3
- package/dist/matter/behaviors/DoorLockBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/DoorLockBehavior.js +46 -24
- package/dist/matter/behaviors/DoorLockBehavior.js.map +1 -1
- package/dist/matter/behaviors/DoorLockBehavior.spec.js +24 -12
- package/dist/matter/behaviors/DoorLockBehavior.spec.js.map +1 -1
- package/dist/matter/behaviors/FanControlBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/FanControlBehavior.js +41 -15
- package/dist/matter/behaviors/FanControlBehavior.js.map +1 -1
- package/dist/matter/behaviors/IdentifyBehavior.d.ts +1 -2
- package/dist/matter/behaviors/IdentifyBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/IdentifyBehavior.js +20 -6
- package/dist/matter/behaviors/IdentifyBehavior.js.map +1 -1
- package/dist/matter/behaviors/IdentifyBehavior.spec.js +3 -3
- package/dist/matter/behaviors/IdentifyBehavior.spec.js.map +1 -1
- package/dist/matter/behaviors/LevelControlBehavior.d.ts +5 -6
- package/dist/matter/behaviors/LevelControlBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/LevelControlBehavior.js +100 -37
- package/dist/matter/behaviors/LevelControlBehavior.js.map +1 -1
- package/dist/matter/behaviors/LevelControlBehavior.spec.js +15 -10
- package/dist/matter/behaviors/LevelControlBehavior.spec.js.map +1 -1
- package/dist/matter/behaviors/OnOffBehavior.d.ts +3 -4
- package/dist/matter/behaviors/OnOffBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/OnOffBehavior.js +64 -32
- package/dist/matter/behaviors/OnOffBehavior.js.map +1 -1
- package/dist/matter/behaviors/OnOffBehavior.spec.js +27 -15
- package/dist/matter/behaviors/OnOffBehavior.spec.js.map +1 -1
- package/dist/matter/behaviors/RvcCleanModeBehavior.d.ts +1 -1
- package/dist/matter/behaviors/RvcCleanModeBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/RvcCleanModeBehavior.js +20 -6
- package/dist/matter/behaviors/RvcCleanModeBehavior.js.map +1 -1
- package/dist/matter/behaviors/RvcCleanModeBehavior.spec.js +3 -2
- package/dist/matter/behaviors/RvcCleanModeBehavior.spec.js.map +1 -1
- package/dist/matter/behaviors/RvcOperationalStateBehavior.d.ts +3 -4
- package/dist/matter/behaviors/RvcOperationalStateBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/RvcOperationalStateBehavior.js +60 -23
- package/dist/matter/behaviors/RvcOperationalStateBehavior.js.map +1 -1
- package/dist/matter/behaviors/RvcRunModeBehavior.d.ts +1 -1
- package/dist/matter/behaviors/RvcRunModeBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/RvcRunModeBehavior.js +20 -6
- package/dist/matter/behaviors/RvcRunModeBehavior.js.map +1 -1
- package/dist/matter/behaviors/RvcRunModeBehavior.spec.js +3 -2
- package/dist/matter/behaviors/RvcRunModeBehavior.spec.js.map +1 -1
- package/dist/matter/behaviors/ServiceAreaBehavior.d.ts +2 -3
- package/dist/matter/behaviors/ServiceAreaBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/ServiceAreaBehavior.js +38 -12
- package/dist/matter/behaviors/ServiceAreaBehavior.js.map +1 -1
- package/dist/matter/behaviors/ServiceAreaBehavior.spec.js +3 -2
- package/dist/matter/behaviors/ServiceAreaBehavior.spec.js.map +1 -1
- package/dist/matter/behaviors/ThermostatBehavior.d.ts +1 -2
- package/dist/matter/behaviors/ThermostatBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/ThermostatBehavior.js +82 -34
- package/dist/matter/behaviors/ThermostatBehavior.js.map +1 -1
- package/dist/matter/behaviors/WindowCoveringBehavior.d.ts +5 -6
- package/dist/matter/behaviors/WindowCoveringBehavior.d.ts.map +1 -1
- package/dist/matter/behaviors/WindowCoveringBehavior.js +102 -50
- package/dist/matter/behaviors/WindowCoveringBehavior.js.map +1 -1
- package/dist/matter/errors.d.ts +178 -0
- package/dist/matter/errors.d.ts.map +1 -0
- package/dist/matter/errors.js +200 -0
- package/dist/matter/errors.js.map +1 -0
- package/dist/matter/index.d.ts +1 -0
- package/dist/matter/index.d.ts.map +1 -1
- package/dist/matter/index.js +1 -0
- package/dist/matter/index.js.map +1 -1
- package/dist/matter/server.d.ts +9 -16
- package/dist/matter/server.d.ts.map +1 -1
- package/dist/matter/server.js +60 -142
- package/dist/matter/server.js.map +1 -1
- package/dist/matter/types.d.ts +11 -50
- package/dist/matter/types.d.ts.map +1 -1
- package/dist/matter/types.js +0 -17
- package/dist/matter/types.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +0 -7
- package/dist/server.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RvcRunModeBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/RvcRunModeBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"RvcRunModeBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/RvcRunModeBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IACtD,MAAM,CAAC,QAAQ,CAAkB;IAEzC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAA0B;QAC3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAEQ,KAAK,CAAC,YAAY,CAAC,OAAY;QACtC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;QAEnC,IAAI,CAAC;YACH,uBAAuB;YACvB,MAAM,0BAA0B,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;YAE3G,+DAA+D;YAC/D,OAAO,MAAM,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0EAA0E;YAC1E,uEAAuE;YACvE,IAAI,YAAY,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9C,MAAM,KAAK,CAAA;YACb,CAAC;YAED,4DAA4D;YAC5D,uEAAuE;YACvE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtE,MAAM,IAAI,mBAAmB,CAAC,8BAA8B,OAAO,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QACxF,CAAC;IACH,CAAC;CACF"}
|
|
@@ -46,10 +46,11 @@ describe('homebridgeRvcRunModeServer', () => {
|
|
|
46
46
|
vi.clearAllMocks();
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
it('should handle handler execution errors gracefully', () => {
|
|
49
|
+
it('should handle handler execution errors gracefully', async () => {
|
|
50
50
|
mockRegistry.executeHandler = vi.fn().mockRejectedValue(new Error('Handler failed'));
|
|
51
51
|
const request = { newMode: 1 };
|
|
52
|
-
|
|
52
|
+
// Errors are wrapped in StatusResponseError and propagated to Matter.js
|
|
53
|
+
await expect(behavior.changeToMode(request)).rejects.toThrow('Failed to change run mode: Handler failed');
|
|
53
54
|
});
|
|
54
55
|
});
|
|
55
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RvcRunModeBehavior.spec.js","sourceRoot":"","sources":["../../../src/matter/behaviors/RvcRunModeBehavior.spec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAEpE,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,IAAI,YAA8B,CAAA;IAClC,IAAI,QAAoC,CAAA;IACxC,IAAI,YAAiB,CAAA;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,uBAAuB;QACvB,YAAY,GAAG;Y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,EAAE,IAAI,EAAE,CAAA;gBACjC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;gBAE9B,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,oBAAoB,CACtD,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,OAAO,CACR,CAAA;gBAED,EAAE,CAAC,aAAa,EAAE,CAAA;YACpB,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;YACjE,YAAY,CAAC,cAAc,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAA;YACpF,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,CAAA;YAE9B,wEAAwE;YACxE,MAAM,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAAA;QAC3G,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles service area selection for robotic vacuum cleaners
|
|
5
5
|
*/
|
|
6
|
-
import type { MaybePromise } from '@matter/main';
|
|
7
6
|
import type { ServiceArea } from '@matter/main/clusters';
|
|
8
7
|
import type { BehaviorRegistry } from './BehaviorRegistry.js';
|
|
9
8
|
import { ServiceAreaServer } from '@matter/main/behaviors/service-area';
|
|
@@ -16,7 +15,7 @@ export declare class HomebridgeServiceAreaServer extends ServiceAreaServer {
|
|
|
16
15
|
* Set the behavior registry (called once during server initialization)
|
|
17
16
|
*/
|
|
18
17
|
static setRegistry(registry: BehaviorRegistry): void;
|
|
19
|
-
selectAreas(request: ServiceArea.SelectAreasRequest):
|
|
20
|
-
skipArea(request: ServiceArea.SkipAreaRequest):
|
|
18
|
+
selectAreas(request: ServiceArea.SelectAreasRequest): Promise<ServiceArea.SelectAreasResponse>;
|
|
19
|
+
skipArea(request: ServiceArea.SkipAreaRequest): Promise<ServiceArea.SkipAreaResponse>;
|
|
21
20
|
}
|
|
22
21
|
//# sourceMappingURL=ServiceAreaBehavior.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceAreaBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/ServiceAreaBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ServiceAreaBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/ServiceAreaBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAKvE;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,iBAAiB;IAChE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IAEzC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIrC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC;IAuB9F,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC;CAsBrG"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Handles service area selection for robotic vacuum cleaners
|
|
5
5
|
*/
|
|
6
6
|
import { ServiceAreaServer } from '@matter/main/behaviors/service-area';
|
|
7
|
+
import { Status, StatusResponseError } from '@matter/main/types';
|
|
8
|
+
import { MatterStatus } from '../errors.js';
|
|
7
9
|
/**
|
|
8
10
|
* Custom ServiceArea Server that calls plugin handlers
|
|
9
11
|
*/
|
|
@@ -15,21 +17,45 @@ export class HomebridgeServiceAreaServer extends ServiceAreaServer {
|
|
|
15
17
|
static setRegistry(registry) {
|
|
16
18
|
this.registry = registry;
|
|
17
19
|
}
|
|
18
|
-
selectAreas(request) {
|
|
20
|
+
async selectAreas(request) {
|
|
19
21
|
const endpointId = this.endpoint.id;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
try {
|
|
23
|
+
// Execute user handler
|
|
24
|
+
await HomebridgeServiceAreaServer.registry.executeHandler(endpointId, 'serviceArea', 'selectAreas', request);
|
|
25
|
+
// Only reached if handler succeeded - call base implementation
|
|
26
|
+
return await super.selectAreas(request);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
30
|
+
// This sends a proper Matter protocol error response to the controller
|
|
31
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
35
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
throw new StatusResponseError(`Failed to select areas: ${message}`, Status.Failure);
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
|
-
skipArea(request) {
|
|
40
|
+
async skipArea(request) {
|
|
27
41
|
const endpointId = this.endpoint.id;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
try {
|
|
43
|
+
// Execute user handler
|
|
44
|
+
await HomebridgeServiceAreaServer.registry.executeHandler(endpointId, 'serviceArea', 'skipArea', request);
|
|
45
|
+
// Only reached if handler succeeded - call base implementation
|
|
46
|
+
return await super.skipArea(request);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
50
|
+
// This sends a proper Matter protocol error response to the controller
|
|
51
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
55
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
56
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
+
throw new StatusResponseError(`Failed to skip area: ${message}`, Status.Failure);
|
|
58
|
+
}
|
|
33
59
|
}
|
|
34
60
|
}
|
|
35
61
|
//# sourceMappingURL=ServiceAreaBehavior.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceAreaBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/ServiceAreaBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"ServiceAreaBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/ServiceAreaBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,iBAAiB;IACxD,MAAM,CAAC,QAAQ,CAAkB;IAEzC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAA0B;QAC3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAEQ,KAAK,CAAC,WAAW,CAAC,OAAuC;QAChE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;QAEnC,IAAI,CAAC;YACH,uBAAuB;YACvB,MAAM,2BAA2B,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa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EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QAClF,CAAC;IACH,CAAC;CACF"}
|
|
@@ -42,10 +42,11 @@ describe('homebridgeServiceAreaServer', () => {
|
|
|
42
42
|
behavior.selectAreas(request);
|
|
43
43
|
expect(mockRegistry.executeHandler).toHaveBeenCalledWith('test-endpoint-123', 'serviceArea', 'selectAreas', request);
|
|
44
44
|
});
|
|
45
|
-
it('should handle handler execution errors gracefully', () => {
|
|
45
|
+
it('should handle handler execution errors gracefully', async () => {
|
|
46
46
|
mockRegistry.executeHandler = vi.fn().mockRejectedValue(new Error('Handler failed'));
|
|
47
47
|
const request = { newAreas: [0, 1] };
|
|
48
|
-
|
|
48
|
+
// Errors are wrapped in StatusResponseError and propagated to Matter.js
|
|
49
|
+
await expect(behavior.selectAreas(request)).rejects.toThrow('Failed to select areas: Handler failed');
|
|
49
50
|
});
|
|
50
51
|
});
|
|
51
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceAreaBehavior.spec.js","sourceRoot":"","sources":["../../../src/matter/behaviors/ServiceAreaBehavior.spec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAEtE,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,IAAI,YAA8B,CAAA;IAClC,IAAI,QAAqC,CAAA;IACzC,IAAI,YAAiB,CAAA;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,uBAAuB;QACvB,YAAY,GAAG;YACb,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;SACzC,CAAA;QAER,iCAAiC;QACjC,2BAA2B,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;QAErD,uBAAuB;QACvB,YAAY,GAAG;YACb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C,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;YAEpC,wEAAwE;YACxE,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAA;QACvG,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles thermostat commands for heating and cooling systems
|
|
5
5
|
*/
|
|
6
|
-
import type { MaybePromise } from '@matter/main';
|
|
7
6
|
import type { Thermostat } from '@matter/main/clusters';
|
|
8
7
|
import type { BehaviorRegistry } from './BehaviorRegistry.js';
|
|
9
8
|
import { ThermostatServer } from '@matter/main/behaviors/thermostat';
|
|
@@ -18,6 +17,6 @@ export declare class HomebridgeThermostatServer extends ThermostatServer {
|
|
|
18
17
|
*/
|
|
19
18
|
static setRegistry(registry: BehaviorRegistry): void;
|
|
20
19
|
initialize(): void;
|
|
21
|
-
setpointRaiseLower(request: Thermostat.SetpointRaiseLowerRequest):
|
|
20
|
+
setpointRaiseLower(request: Thermostat.SetpointRaiseLowerRequest): Promise<void>;
|
|
22
21
|
}
|
|
23
22
|
//# sourceMappingURL=ThermostatBehavior.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThermostatBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/ThermostatBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ThermostatBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/ThermostatBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAKpE;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,gBAAgB;;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IAEzC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAI3C,UAAU,IAAI,IAAI;IAwGZ,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAiChG"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Handles thermostat commands for heating and cooling systems
|
|
5
5
|
*/
|
|
6
6
|
import { ThermostatServer } from '@matter/main/behaviors/thermostat';
|
|
7
|
+
import { Status, StatusResponseError } from '@matter/main/types';
|
|
8
|
+
import { MatterStatus } from '../errors.js';
|
|
7
9
|
/**
|
|
8
10
|
* Custom Thermostat Server that calls plugin handlers
|
|
9
11
|
*/
|
|
@@ -29,51 +31,97 @@ export class HomebridgeThermostatServer extends ThermostatServer {
|
|
|
29
31
|
this.reactTo(events.occupiedCoolingSetpoint$Changing, this.#handleOccupiedCoolingSetpointChanging);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
#handleSystemModeChange(value, oldValue) {
|
|
34
|
+
async #handleSystemModeChange(value, oldValue) {
|
|
33
35
|
const endpointId = this.endpoint.id;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
try {
|
|
37
|
+
// Execute user handler
|
|
38
|
+
await HomebridgeThermostatServer.registry.executeHandler(endpointId, 'thermostat', 'systemModeChange', { systemMode: value, oldSystemMode: oldValue });
|
|
39
|
+
// Sync state to cache
|
|
40
|
+
HomebridgeThermostatServer.registry.syncStateToCache(endpointId, 'thermostat', { systemMode: value });
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
44
|
+
// This sends a proper Matter protocol error response to the controller
|
|
45
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
49
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
50
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
+
throw new StatusResponseError(`Failed to change system mode: ${message}`, Status.Failure);
|
|
52
|
+
}
|
|
39
53
|
}
|
|
40
|
-
#handleOccupiedHeatingSetpointChanging(value) {
|
|
54
|
+
async #handleOccupiedHeatingSetpointChanging(value) {
|
|
41
55
|
const endpointId = this.endpoint.id;
|
|
42
56
|
const oldValue = this.state.occupiedHeatingSetpoint;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
try {
|
|
58
|
+
// Execute user handler
|
|
59
|
+
await HomebridgeThermostatServer.registry.executeHandler(endpointId, 'thermostat', 'occupiedHeatingSetpointChange', { occupiedHeatingSetpoint: value, oldOccupiedHeatingSetpoint: oldValue });
|
|
60
|
+
// Sync state to cache
|
|
61
|
+
HomebridgeThermostatServer.registry.syncStateToCache(endpointId, 'thermostat', { occupiedHeatingSetpoint: value });
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
65
|
+
// This sends a proper Matter protocol error response to the controller
|
|
66
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
70
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
71
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
72
|
+
throw new StatusResponseError(`Failed to change heating setpoint: ${message}`, Status.Failure);
|
|
73
|
+
}
|
|
48
74
|
}
|
|
49
|
-
#handleOccupiedCoolingSetpointChanging(value) {
|
|
75
|
+
async #handleOccupiedCoolingSetpointChanging(value) {
|
|
50
76
|
const endpointId = this.endpoint.id;
|
|
51
77
|
const oldValue = this.state.occupiedCoolingSetpoint;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
78
|
+
try {
|
|
79
|
+
// Execute user handler
|
|
80
|
+
await HomebridgeThermostatServer.registry.executeHandler(endpointId, 'thermostat', 'occupiedCoolingSetpointChange', { occupiedCoolingSetpoint: value, oldOccupiedCoolingSetpoint: oldValue });
|
|
81
|
+
// Sync state to cache
|
|
82
|
+
HomebridgeThermostatServer.registry.syncStateToCache(endpointId, 'thermostat', { occupiedCoolingSetpoint: value });
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
86
|
+
// This sends a proper Matter protocol error response to the controller
|
|
87
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
91
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
92
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
93
|
+
throw new StatusResponseError(`Failed to change cooling setpoint: ${message}`, Status.Failure);
|
|
94
|
+
}
|
|
57
95
|
}
|
|
58
|
-
setpointRaiseLower(request) {
|
|
96
|
+
async setpointRaiseLower(request) {
|
|
59
97
|
const endpointId = this.endpoint.id;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
98
|
+
try {
|
|
99
|
+
// Execute user handler
|
|
100
|
+
await HomebridgeThermostatServer.registry.executeHandler(endpointId, 'thermostat', 'setpointRaiseLower', request);
|
|
101
|
+
// Only reached if handler succeeded - update Matter state
|
|
102
|
+
await super.setpointRaiseLower(request);
|
|
103
|
+
// Sync thermostat setpoints to cache
|
|
104
|
+
const currentState = this.state;
|
|
105
|
+
const stateUpdate = {};
|
|
106
|
+
if (currentState.occupiedCoolingSetpoint !== undefined) {
|
|
107
|
+
stateUpdate.occupiedCoolingSetpoint = currentState.occupiedCoolingSetpoint;
|
|
108
|
+
}
|
|
109
|
+
if (currentState.occupiedHeatingSetpoint !== undefined) {
|
|
110
|
+
stateUpdate.occupiedHeatingSetpoint = currentState.occupiedHeatingSetpoint;
|
|
111
|
+
}
|
|
112
|
+
HomebridgeThermostatServer.registry.syncStateToCache(endpointId, 'thermostat', stateUpdate);
|
|
71
113
|
}
|
|
72
|
-
|
|
73
|
-
|
|
114
|
+
catch (error) {
|
|
115
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
116
|
+
// This sends a proper Matter protocol error response to the controller
|
|
117
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
121
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
122
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
123
|
+
throw new StatusResponseError(`Failed to adjust setpoint: ${message}`, Status.Failure);
|
|
74
124
|
}
|
|
75
|
-
HomebridgeThermostatServer.registry.syncStateToCache(endpointId, 'thermostat', stateUpdate);
|
|
76
|
-
return result;
|
|
77
125
|
}
|
|
78
126
|
}
|
|
79
127
|
//# sourceMappingURL=ThermostatBehavior.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThermostatBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/ThermostatBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"ThermostatBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/ThermostatBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,mBA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A0B,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAA;YAEjH,0DAA0D;YAC1D,MAAM,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;YAEvC,qCAAqC;YACrC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAY,CAAA;YACtC,MAAM,WAAW,GAAwB,EAAE,CAAA;YAC3C,IAAI,YAAY,CAAC,uBAAuB,KAAK,SAAS,EAAE,CAAC;gBACvD,WAAW,CAAC,uBAAuB,GAAG,YAAY,CAAC,uBAAuB,CAAA;YAC5E,CAAC;YACD,IAAI,YAAY,CAAC,uBAAuB,KAAK,SAAS,EAAE,CAAC;gBACvD,WAAW,CAAC,uBAAuB,GAAG,YAAY,CAAC,uBAAuB,CAAA;YAC5E,CAAC;YACD,0BAA0B,CAAC,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,CAAC,CAAA;QAC7F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0EAA0E;YAC1E,uEAAuE;YACvE,IAAI,YAAY,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9C,MAAM,KAAK,CAAA;YACb,CAAC;YAED,4DAA4D;YAC5D,uEAAuE;YACvE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtE,MAAM,IAAI,mBAAmB,CAAC,8BAA8B,OAAO,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QACxF,CAAC;IACH,CAAC;CACF"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles window covering commands for blinds, shades, and curtains
|
|
5
5
|
*/
|
|
6
|
-
import type { MaybePromise } from '@matter/main';
|
|
7
6
|
import type { WindowCovering } from '@matter/main/clusters';
|
|
8
7
|
import type { BehaviorRegistry } from './BehaviorRegistry.js';
|
|
9
8
|
import { WindowCoveringBaseServer } from '@matter/main/behaviors/window-covering';
|
|
@@ -23,10 +22,10 @@ export declare class HomebridgeWindowCoveringServer extends WindowCoveringBaseSe
|
|
|
23
22
|
* @param currentProperty - Current position property name (e.g., 'currentPositionLiftPercent100ths')
|
|
24
23
|
*/
|
|
25
24
|
private syncPositionStateToCache;
|
|
26
|
-
upOrOpen():
|
|
27
|
-
downOrClose():
|
|
28
|
-
stopMotion():
|
|
29
|
-
goToLiftPercentage(request: WindowCovering.GoToLiftPercentageRequest):
|
|
30
|
-
goToTiltPercentage(request: WindowCovering.GoToTiltPercentageRequest):
|
|
25
|
+
upOrOpen(): Promise<void>;
|
|
26
|
+
downOrClose(): Promise<void>;
|
|
27
|
+
stopMotion(): Promise<void>;
|
|
28
|
+
goToLiftPercentage(request: WindowCovering.GoToLiftPercentageRequest): Promise<void>;
|
|
29
|
+
goToTiltPercentage(request: WindowCovering.GoToTiltPercentageRequest): Promise<void>;
|
|
31
30
|
}
|
|
32
31
|
//# sourceMappingURL=WindowCoveringBehavior.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WindowCoveringBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/WindowCoveringBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"WindowCoveringBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/WindowCoveringBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAA;AAgBjF;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,wBAAwB;IAC1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IAEzC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIpD;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAmBjB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA8BzB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B5B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B3B,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCpF,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkCpG"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Handles window covering commands for blinds, shades, and curtains
|
|
5
5
|
*/
|
|
6
6
|
import { WindowCoveringBaseServer } from '@matter/main/behaviors/window-covering';
|
|
7
|
+
import { Status, StatusResponseError } from '@matter/main/types';
|
|
8
|
+
import { MatterStatus } from '../errors.js';
|
|
7
9
|
/**
|
|
8
10
|
* WindowCovering state property names
|
|
9
11
|
* These correspond to the Matter.js WindowCovering cluster attribute names
|
|
@@ -42,65 +44,115 @@ export class HomebridgeWindowCoveringServer extends WindowCoveringBaseServer {
|
|
|
42
44
|
}
|
|
43
45
|
HomebridgeWindowCoveringServer.registry.syncStateToCache(endpointId, 'windowCovering', stateUpdate);
|
|
44
46
|
}
|
|
45
|
-
upOrOpen() {
|
|
47
|
+
async upOrOpen() {
|
|
46
48
|
const endpointId = this.endpoint.id;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
try {
|
|
50
|
+
// Execute user handler
|
|
51
|
+
await HomebridgeWindowCoveringServer.registry.executeHandler(endpointId, 'windowCovering', 'upOrOpen');
|
|
52
|
+
// Only reached if handler succeeded - update Matter state
|
|
53
|
+
await super.upOrOpen();
|
|
54
|
+
// Sync state to cache - window covering opening
|
|
55
|
+
this.syncPositionStateToCache(endpointId, WindowCoveringStateProps.targetPositionLiftPercent100ths, WindowCoveringStateProps.currentPositionLiftPercent100ths);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
59
|
+
// This sends a proper Matter protocol error response to the controller
|
|
60
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
64
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
65
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
66
|
+
throw new StatusResponseError(`Failed to open window covering: ${message}`, Status.Failure);
|
|
67
|
+
}
|
|
56
68
|
}
|
|
57
|
-
downOrClose() {
|
|
69
|
+
async downOrClose() {
|
|
58
70
|
const endpointId = this.endpoint.id;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
try {
|
|
72
|
+
// Execute user handler
|
|
73
|
+
await HomebridgeWindowCoveringServer.registry.executeHandler(endpointId, 'windowCovering', 'downOrClose');
|
|
74
|
+
// Only reached if handler succeeded - update Matter state
|
|
75
|
+
await super.downOrClose();
|
|
76
|
+
// Sync state to cache - window covering closing
|
|
77
|
+
this.syncPositionStateToCache(endpointId, WindowCoveringStateProps.targetPositionLiftPercent100ths, WindowCoveringStateProps.currentPositionLiftPercent100ths);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
81
|
+
// This sends a proper Matter protocol error response to the controller
|
|
82
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
86
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
87
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
88
|
+
throw new StatusResponseError(`Failed to close window covering: ${message}`, Status.Failure);
|
|
89
|
+
}
|
|
68
90
|
}
|
|
69
|
-
stopMotion() {
|
|
91
|
+
async stopMotion() {
|
|
70
92
|
const endpointId = this.endpoint.id;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
93
|
+
try {
|
|
94
|
+
// Execute user handler
|
|
95
|
+
await HomebridgeWindowCoveringServer.registry.executeHandler(endpointId, 'windowCovering', 'stopMotion');
|
|
96
|
+
// Only reached if handler succeeded - update Matter state
|
|
97
|
+
await super.stopMotion();
|
|
98
|
+
// Sync state to cache - window covering stopped
|
|
99
|
+
this.syncPositionStateToCache(endpointId, WindowCoveringStateProps.targetPositionLiftPercent100ths, WindowCoveringStateProps.currentPositionLiftPercent100ths);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
103
|
+
// This sends a proper Matter protocol error response to the controller
|
|
104
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
108
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
109
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
110
|
+
throw new StatusResponseError(`Failed to stop window covering: ${message}`, Status.Failure);
|
|
111
|
+
}
|
|
80
112
|
}
|
|
81
|
-
goToLiftPercentage(request) {
|
|
113
|
+
async goToLiftPercentage(request) {
|
|
82
114
|
const endpointId = this.endpoint.id;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
try {
|
|
116
|
+
// Execute user handler
|
|
117
|
+
await HomebridgeWindowCoveringServer.registry.executeHandler(endpointId, 'windowCovering', 'goToLiftPercentage', request);
|
|
118
|
+
// Only reached if handler succeeded - update Matter state
|
|
119
|
+
await super.goToLiftPercentage(request);
|
|
120
|
+
// Sync state to cache - window covering moving to target position
|
|
121
|
+
this.syncPositionStateToCache(endpointId, WindowCoveringStateProps.targetPositionLiftPercent100ths, WindowCoveringStateProps.currentPositionLiftPercent100ths);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
125
|
+
// This sends a proper Matter protocol error response to the controller
|
|
126
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
130
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
131
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
132
|
+
throw new StatusResponseError(`Failed to set window covering position: ${message}`, Status.Failure);
|
|
133
|
+
}
|
|
92
134
|
}
|
|
93
|
-
goToTiltPercentage(request) {
|
|
135
|
+
async goToTiltPercentage(request) {
|
|
94
136
|
const endpointId = this.endpoint.id;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
137
|
+
try {
|
|
138
|
+
// Execute user handler
|
|
139
|
+
await HomebridgeWindowCoveringServer.registry.executeHandler(endpointId, 'windowCovering', 'goToTiltPercentage', request);
|
|
140
|
+
// Only reached if handler succeeded - update Matter state
|
|
141
|
+
await super.goToTiltPercentage(request);
|
|
142
|
+
// Sync state to cache - window covering tilting to target angle
|
|
143
|
+
this.syncPositionStateToCache(endpointId, WindowCoveringStateProps.targetPositionTiltPercent100ths, WindowCoveringStateProps.currentPositionTiltPercent100ths);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
// If user handler already threw a StatusResponseError, propagate it as-is
|
|
147
|
+
// This sends a proper Matter protocol error response to the controller
|
|
148
|
+
if (MatterStatus.isMatterProtocolError(error)) {
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
// For other errors, wrap in appropriate StatusResponseError
|
|
152
|
+
// This prevents the endpoint from crashing and keeps the device online
|
|
153
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
154
|
+
throw new StatusResponseError(`Failed to set window covering tilt: ${message}`, Status.Failure);
|
|
155
|
+
}
|
|
104
156
|
}
|
|
105
157
|
}
|
|
106
158
|
//# sourceMappingURL=WindowCoveringBehavior.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WindowCoveringBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/WindowCoveringBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"WindowCoveringBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/WindowCoveringBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAA;AACjF,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C;;;GAGG;AACH,MAAM,wBAAwB,GAAG;IAC/B,+BAA+B,EAAE,iCAA0C;IAC3E,gCAAgC,EAAE,kCAA2C;IAC7E,+BAA+B,EAAE,iCAA0C;IAC3E,gCAAgC,EAAE,kCAA2C;CACf,CAAA;AAEhE;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,wBAAwB;IAClE,MAAM,CAAC,QAAQ,CAAkB;IAEzC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAA0B;QAC3C,IAAI,CAAC,QAAQ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