homebridge 2.3.0-beta.7 → 2.3.0-beta.9

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 (40) hide show
  1. package/dist/matter/MatterAPIImpl.d.ts +20 -2
  2. package/dist/matter/MatterAPIImpl.d.ts.map +1 -1
  3. package/dist/matter/behaviors/ClosureControlBehavior.d.ts +46 -0
  4. package/dist/matter/behaviors/ClosureControlBehavior.d.ts.map +1 -0
  5. package/dist/matter/behaviors/ClosureControlBehavior.js +117 -0
  6. package/dist/matter/behaviors/ClosureControlBehavior.js.map +1 -0
  7. package/dist/matter/behaviors/KeypadInputBehavior.d.ts +32 -0
  8. package/dist/matter/behaviors/KeypadInputBehavior.d.ts.map +1 -0
  9. package/dist/matter/behaviors/KeypadInputBehavior.js +59 -0
  10. package/dist/matter/behaviors/KeypadInputBehavior.js.map +1 -0
  11. package/dist/matter/behaviors/MediaPlaybackBehavior.d.ts +61 -0
  12. package/dist/matter/behaviors/MediaPlaybackBehavior.d.ts.map +1 -0
  13. package/dist/matter/behaviors/MediaPlaybackBehavior.js +146 -0
  14. package/dist/matter/behaviors/MediaPlaybackBehavior.js.map +1 -0
  15. package/dist/matter/behaviors/index.d.ts +3 -0
  16. package/dist/matter/behaviors/index.d.ts.map +1 -1
  17. package/dist/matter/behaviors/index.js +3 -0
  18. package/dist/matter/behaviors/index.js.map +1 -1
  19. package/dist/matter/clusterHandlerMap.d.ts +39 -1
  20. package/dist/matter/clusterHandlerMap.d.ts.map +1 -1
  21. package/dist/matter/server/AccessoryManager.d.ts +27 -0
  22. package/dist/matter/server/AccessoryManager.d.ts.map +1 -1
  23. package/dist/matter/server/AccessoryManager.js +124 -73
  24. package/dist/matter/server/AccessoryManager.js.map +1 -1
  25. package/dist/matter/server/BehaviorMap.d.ts.map +1 -1
  26. package/dist/matter/server/BehaviorMap.js +6 -2
  27. package/dist/matter/server/BehaviorMap.js.map +1 -1
  28. package/dist/matter/server/FabricManager.d.ts +9 -0
  29. package/dist/matter/server/FabricManager.d.ts.map +1 -1
  30. package/dist/matter/server/FabricManager.js +29 -2
  31. package/dist/matter/server/FabricManager.js.map +1 -1
  32. package/dist/matter/serverHelpers.d.ts +16 -0
  33. package/dist/matter/serverHelpers.d.ts.map +1 -1
  34. package/dist/matter/serverHelpers.js +27 -0
  35. package/dist/matter/serverHelpers.js.map +1 -1
  36. package/dist/matter/types.d.ts +23 -2
  37. package/dist/matter/types.d.ts.map +1 -1
  38. package/dist/matter/types.js +13 -2
  39. package/dist/matter/types.js.map +1 -1
  40. package/package.json +2 -2
@@ -112,7 +112,7 @@ export declare class MatterAPIImpl implements MatterAPI {
112
112
  };
113
113
  }>, import("@matter/main").SupportedBehaviors.With<{
114
114
  readonly identify: typeof import("@matter/node/behaviors").IdentifyServer;
115
- }, readonly [import("@matter/main").ClusterBehavior.Type<typeof import("@matter/node/behaviors").ClosureControlServer, import("@matter/types").ClusterType.WithSupportedFeatures<import("@matter/main/clusters").ClosureControl, {
115
+ }, readonly [import("@matter/main").ClusterBehavior.Type<typeof import("./behaviors/ClosureControlBehavior.js").DefaultClosureControlServer, import("@matter/types").ClusterType.WithSupportedFeatures<import("@matter/main/clusters").ClosureControl, {
116
116
  positioning: true;
117
117
  motionLatching: false;
118
118
  instantaneous: false;
@@ -123,7 +123,25 @@ export declare class MatterAPIImpl implements MatterAPI {
123
123
  protection: false;
124
124
  manuallyOperable: false;
125
125
  }>, import("@matter/types").ClusterType.Concrete, new () => {}, "closureControl">]>, {}>;
126
- readonly MediaPlayer: import("@matter/node/devices/basic-video-player").BasicVideoPlayerDevice;
126
+ readonly MediaPlayer: import("@matter/main").MutableEndpoint.With<EndpointType.For<{
127
+ readonly name: "BasicVideoPlayer";
128
+ readonly deviceType: 40;
129
+ readonly deviceRevision: 2;
130
+ readonly requirements: typeof import("@matter/node/devices/basic-video-player").BasicVideoPlayerRequirements;
131
+ readonly behaviors: {
132
+ readonly onOff: typeof import("@matter/node/behaviors").OnOffServer;
133
+ } & {
134
+ readonly mediaPlayback: typeof import("@matter/node/behaviors").MediaPlaybackServer;
135
+ } & {
136
+ readonly keypadInput: typeof import("@matter/node/behaviors").KeypadInputServer;
137
+ };
138
+ }>, import("@matter/main").SupportedBehaviors.With<{
139
+ readonly onOff: typeof import("@matter/node/behaviors").OnOffServer;
140
+ } & {
141
+ readonly mediaPlayback: typeof import("@matter/node/behaviors").MediaPlaybackServer;
142
+ } & {
143
+ readonly keypadInput: typeof import("@matter/node/behaviors").KeypadInputServer;
144
+ }, readonly [typeof import("./behaviors/MediaPlaybackBehavior.js").DefaultMediaPlaybackServer, typeof import("./behaviors/KeypadInputBehavior.js").DefaultKeypadInputServer]>, {}>;
127
145
  readonly Speaker: import("@matter/node/devices/speaker").SpeakerDevice;
128
146
  readonly RoboticVacuumCleaner: import("@matter/node/devices/robotic-vacuum-cleaner").RoboticVacuumCleanerDevice;
129
147
  readonly WaterValve: import("@matter/main").MutableEndpoint.With<EndpointType.For<{
@@ -1 +1 @@
1
- {"version":3,"file":"MatterAPIImpl.d.ts","sourceRoot":"","sources":["../../src/matter/MatterAPIImpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEzF,OAAO,KAAK,EAA2B,eAAe,EAAgB,MAAM,YAAY,CAAA;AAKxF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAgD9C;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAc,YAAW,SAAS;IAGjC,OAAO,CAAC,QAAQ,CAAC,GAAG;IAFhC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;gBAED,GAAG,EAAE,aAAa;IAI/C;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IA4CzB;;;OAGG;IAC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AI,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEf;IAED;;OAEG;IACH,IAAI,KAAK;;;;;;;;;;;;;;;;;;;;;;;MAER;IAED;;;;;;OAMG;IACH,IAAI,MAAM;;;;;;;;;;;;MAET;IAED;;;;;OAKG;IACH;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB;IAcnB,2BAA2B,CAC/B,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,eAAe,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC;IAmGhB;;;OAGG;IACG,yBAAyB,CAAC,WAAW,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAc9E;;;OAGG;IACG,6BAA6B,CACjC,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,eAAe,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC;IAqChB;;;OAGG;IACG,oBAAoB,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IA8BhB;;;;OAIG;IACG,iBAAiB,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAsChD"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * ClosureControl Cluster Behavior
3
+ *
4
+ * Handles move/stop commands for closures - garage doors, gates and similar.
5
+ */
6
+ import { ClosureControlServer } from '@matter/main/behaviors/closure-control';
7
+ import { ClosureControl } from '@matter/main/clusters/closure-control';
8
+ /**
9
+ * Default ClosureControl Server.
10
+ *
11
+ * matter.js's base ClosureControlServer implements none of the commands -
12
+ * invoking one throws NotImplementedError - so a closure without plugin
13
+ * handlers would advertise moveTo/stop and then fail every one. This default
14
+ * reflects the command in the cluster state instead, which is enough for the
15
+ * endpoint to behave sanely on its own.
16
+ *
17
+ * The move is reported as complete immediately. A plugin that knows better
18
+ * (a garage door takes ~15 seconds) should update `overallCurrentState` from
19
+ * its own device reports; the point here is only that the target is recorded
20
+ * and the closure never looks stuck.
21
+ */
22
+ export declare class DefaultClosureControlServer extends ClosureControlServer {
23
+ moveTo(request: ClosureControl.MoveToRequest): Promise<void>;
24
+ stop(): Promise<void>;
25
+ }
26
+ /**
27
+ * Custom ClosureControl Server that calls plugin handlers.
28
+ *
29
+ * Extends the default server so `super.*()` records the state (the matter.js
30
+ * base would throw NotImplementedError).
31
+ */
32
+ export declare class HomebridgeClosureControlServer extends DefaultClosureControlServer {
33
+ /**
34
+ * Get the registry for this behavior's endpoint
35
+ */
36
+ private getRegistry;
37
+ /**
38
+ * Handle 'moveTo' command
39
+ */
40
+ moveTo(request: ClosureControl.MoveToRequest): Promise<void>;
41
+ /**
42
+ * Handle 'stop' command
43
+ */
44
+ stop(): Promise<void>;
45
+ }
46
+ //# sourceMappingURL=ClosureControlBehavior.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClosureControlBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/ClosureControlBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAMtE;;;;;;;;;;;;;GAaG;AACH,qBAAa,2BAA4B,SAAQ,oBAAoB;IACpD,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAa5D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAMrC;AAED;;;;;GAKG;AACH,qBAAa,8BAA+B,SAAQ,2BAA2B;IAC7E;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACY,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B3E;;OAEG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CA6BrC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * ClosureControl Cluster Behavior
3
+ *
4
+ * Handles move/stop commands for closures - garage doors, gates and similar.
5
+ */
6
+ import { ClosureControlServer } from '@matter/main/behaviors/closure-control';
7
+ import { ClosureControl } from '@matter/main/clusters/closure-control';
8
+ import { Status, StatusResponseError } from '@matter/main/types';
9
+ import { MatterStatus } from '../errors.js';
10
+ import { getRegistryManager } from './EndpointContext.js';
11
+ /**
12
+ * Default ClosureControl Server.
13
+ *
14
+ * matter.js's base ClosureControlServer implements none of the commands -
15
+ * invoking one throws NotImplementedError - so a closure without plugin
16
+ * handlers would advertise moveTo/stop and then fail every one. This default
17
+ * reflects the command in the cluster state instead, which is enough for the
18
+ * endpoint to behave sanely on its own.
19
+ *
20
+ * The move is reported as complete immediately. A plugin that knows better
21
+ * (a garage door takes ~15 seconds) should update `overallCurrentState` from
22
+ * its own device reports; the point here is only that the target is recorded
23
+ * and the closure never looks stuck.
24
+ */
25
+ export class DefaultClosureControlServer extends ClosureControlServer {
26
+ async moveTo(request) {
27
+ const target = {
28
+ ...(this.state.overallTargetState ?? {}),
29
+ ...(request.position !== undefined ? { position: request.position } : {}),
30
+ ...(request.latch !== undefined ? { latch: request.latch } : {}),
31
+ ...(request.speed !== undefined ? { speed: request.speed } : {}),
32
+ };
33
+ this.state.overallTargetState = target;
34
+ this.state.overallCurrentState = target;
35
+ this.state.mainState = ClosureControl.MainState.Stopped;
36
+ }
37
+ async stop() {
38
+ // Stopping leaves the closure wherever it is, so the target becomes the
39
+ // current position rather than the other way round.
40
+ this.state.overallTargetState = this.state.overallCurrentState;
41
+ this.state.mainState = ClosureControl.MainState.Stopped;
42
+ }
43
+ }
44
+ /**
45
+ * Custom ClosureControl Server that calls plugin handlers.
46
+ *
47
+ * Extends the default server so `super.*()` records the state (the matter.js
48
+ * base would throw NotImplementedError).
49
+ */
50
+ export class HomebridgeClosureControlServer extends DefaultClosureControlServer {
51
+ /**
52
+ * Get the registry for this behavior's endpoint
53
+ */
54
+ getRegistry() {
55
+ return getRegistryManager(this.endpoint).getRegistry(this.endpoint.id);
56
+ }
57
+ /**
58
+ * Handle 'moveTo' command
59
+ */
60
+ async moveTo(request) {
61
+ const endpointId = this.endpoint.id;
62
+ const registry = this.getRegistry();
63
+ try {
64
+ // Execute user handler
65
+ await registry.executeHandler(endpointId, 'closureControl', 'moveTo', request);
66
+ // Only reached if handler succeeded - update Matter state via super
67
+ await super.moveTo(request);
68
+ // Sync state to cache
69
+ registry.syncStateToCache(endpointId, 'closureControl', {
70
+ overallTargetState: this.state.overallTargetState,
71
+ overallCurrentState: this.state.overallCurrentState,
72
+ mainState: this.state.mainState,
73
+ });
74
+ }
75
+ catch (error) {
76
+ // If user handler already threw a StatusResponseError, propagate it as-is
77
+ // This sends a proper Matter protocol error response to the controller
78
+ if (MatterStatus.isMatterProtocolError(error)) {
79
+ throw error;
80
+ }
81
+ // For other errors, wrap in appropriate StatusResponseError
82
+ // This prevents the endpoint from crashing and keeps the device online
83
+ const message = error instanceof Error ? error.message : String(error);
84
+ throw new StatusResponseError(`Failed to move closure: ${message}`, Status.Failure);
85
+ }
86
+ }
87
+ /**
88
+ * Handle 'stop' command
89
+ */
90
+ async stop() {
91
+ const endpointId = this.endpoint.id;
92
+ const registry = this.getRegistry();
93
+ try {
94
+ // Execute user handler
95
+ await registry.executeHandler(endpointId, 'closureControl', 'stop');
96
+ // Only reached if handler succeeded - update Matter state via super
97
+ await super.stop();
98
+ // Sync state to cache
99
+ registry.syncStateToCache(endpointId, 'closureControl', {
100
+ overallTargetState: this.state.overallTargetState,
101
+ mainState: this.state.mainState,
102
+ });
103
+ }
104
+ catch (error) {
105
+ // If user handler already threw a StatusResponseError, propagate it as-is
106
+ // This sends a proper Matter protocol error response to the controller
107
+ if (MatterStatus.isMatterProtocolError(error)) {
108
+ throw error;
109
+ }
110
+ // For other errors, wrap in appropriate StatusResponseError
111
+ // This prevents the endpoint from crashing and keeps the device online
112
+ const message = error instanceof Error ? error.message : String(error);
113
+ throw new StatusResponseError(`Failed to stop closure: ${message}`, Status.Failure);
114
+ }
115
+ }
116
+ }
117
+ //# sourceMappingURL=ClosureControlBehavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClosureControlBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/ClosureControlBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,2BAA4B,SAAQ,oBAAoB;IAC1D,KAAK,CAAC,MAAM,CAAC,OAAqC;QACzD,MAAM,MAAM,GAAG;YACb,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAAI,EAAE,CAAC;YACxC,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzE,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChE,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,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M,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,2BAA2B,OAAO,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QACrF,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * KeypadInput Cluster Behavior
3
+ *
4
+ * Handles remote-control key presses for media players.
5
+ */
6
+ import { KeypadInputServer } from '@matter/main/behaviors/keypad-input';
7
+ import { KeypadInput } from '@matter/main/clusters/keypad-input';
8
+ /**
9
+ * Default KeypadInput Server.
10
+ *
11
+ * matter.js's base KeypadInputServer leaves sendKey unimplemented (it throws
12
+ * NotImplementedError), so a player without a plugin handler would advertise
13
+ * the keypad and fail every press. Answering UnsupportedKey is the honest
14
+ * response for a device that has nowhere to send the key.
15
+ */
16
+ export declare class DefaultKeypadInputServer extends KeypadInputServer {
17
+ sendKey(_request: KeypadInput.SendKeyRequest): Promise<KeypadInput.SendKeyResponse>;
18
+ }
19
+ /**
20
+ * Custom KeypadInput Server that calls plugin handlers.
21
+ */
22
+ export declare class HomebridgeKeypadInputServer extends DefaultKeypadInputServer {
23
+ /**
24
+ * Get the registry for this behavior's endpoint
25
+ */
26
+ private getRegistry;
27
+ /**
28
+ * Handle 'sendKey' command
29
+ */
30
+ sendKey(request: KeypadInput.SendKeyRequest): Promise<KeypadInput.SendKeyResponse>;
31
+ }
32
+ //# sourceMappingURL=KeypadInputBehavior.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeypadInputBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/KeypadInputBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAKhE;;;;;;;GAOG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB;IAI9C,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC;CAGnG;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,wBAAwB;IACvE;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACY,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC;CAoBlG"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * KeypadInput Cluster Behavior
3
+ *
4
+ * Handles remote-control key presses for media players.
5
+ */
6
+ import { KeypadInputServer } from '@matter/main/behaviors/keypad-input';
7
+ import { KeypadInput } from '@matter/main/clusters/keypad-input';
8
+ import { MatterStatus } from '../errors.js';
9
+ import { getRegistryManager } from './EndpointContext.js';
10
+ /**
11
+ * Default KeypadInput Server.
12
+ *
13
+ * matter.js's base KeypadInputServer leaves sendKey unimplemented (it throws
14
+ * NotImplementedError), so a player without a plugin handler would advertise
15
+ * the keypad and fail every press. Answering UnsupportedKey is the honest
16
+ * response for a device that has nowhere to send the key.
17
+ */
18
+ export class DefaultKeypadInputServer extends KeypadInputServer {
19
+ // The key is ignored here - there is nowhere to send it. The parameter must
20
+ // stay so HomebridgeKeypadInputServer can forward it.
21
+ // eslint-disable-next-line unused-imports/no-unused-vars
22
+ async sendKey(_request) {
23
+ return { status: KeypadInput.Status.UnsupportedKey };
24
+ }
25
+ }
26
+ /**
27
+ * Custom KeypadInput Server that calls plugin handlers.
28
+ */
29
+ export class HomebridgeKeypadInputServer extends DefaultKeypadInputServer {
30
+ /**
31
+ * Get the registry for this behavior's endpoint
32
+ */
33
+ getRegistry() {
34
+ return getRegistryManager(this.endpoint).getRegistry(this.endpoint.id);
35
+ }
36
+ /**
37
+ * Handle 'sendKey' command
38
+ */
39
+ async sendKey(request) {
40
+ const endpointId = this.endpoint.id;
41
+ const registry = this.getRegistry();
42
+ try {
43
+ await registry.executeHandler(endpointId, 'keypadInput', 'sendKey', request);
44
+ return { status: KeypadInput.Status.Success };
45
+ }
46
+ catch (error) {
47
+ // If user handler already threw a StatusResponseError, propagate it as-is
48
+ // This sends a proper Matter protocol error response to the controller
49
+ if (MatterStatus.isMatterProtocolError(error)) {
50
+ throw error;
51
+ }
52
+ // KeypadInput carries its own status in the response, so a failed handler
53
+ // is reported through that rather than as a protocol-level error - which
54
+ // keeps the endpoint online.
55
+ return { status: KeypadInput.Status.UnsupportedKey };
56
+ }
57
+ }
58
+ }
59
+ //# sourceMappingURL=KeypadInputBehavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeypadInputBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/KeypadInputBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IAC7D,4EAA4E;IAC5E,sDAAsD;IACtD,yDAAyD;IAChD,KAAK,CAAC,OAAO,CAAC,QAAoC;QACzD,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE,CAAA;IACtD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,wBAAwB;IACvE;;OAEG;IACK,WAAW;QACjB,OAAO,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACxE,CAAC;IAED;;OAEG;IACM,KAAK,CAAC,OAAO,CAAC,OAAmC;QACxD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QAEnC,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;YAC5E,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;QAC/C,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,0EAA0E;YAC1E,yEAAyE;YACzE,6BAA6B;YAC7B,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE,CAAA;QACtD,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * MediaPlayback Cluster Behavior
3
+ *
4
+ * Handles transport commands - play, pause, stop and track navigation - for
5
+ * media players and speakers.
6
+ */
7
+ import { MediaPlaybackServer } from '@matter/main/behaviors/media-playback';
8
+ import { MediaPlayback } from '@matter/main/clusters/media-playback';
9
+ /**
10
+ * Default MediaPlayback Server.
11
+ *
12
+ * matter.js's base MediaPlaybackServer implements none of the commands -
13
+ * invoking one throws NotImplementedError - so a player without plugin
14
+ * handlers would advertise the transport controls and fail every one. This
15
+ * default reflects the command in `currentState` and answers Success, which is
16
+ * enough for the endpoint to behave sanely on its own.
17
+ */
18
+ export declare class DefaultMediaPlaybackServer extends MediaPlaybackServer {
19
+ /**
20
+ * Record a new playback state, when the command implies one.
21
+ */
22
+ protected reflect(state?: MediaPlayback.PlaybackState): MediaPlayback.PlaybackResponse;
23
+ play(): Promise<MediaPlayback.PlaybackResponse>;
24
+ pause(): Promise<MediaPlayback.PlaybackResponse>;
25
+ stop(): Promise<MediaPlayback.PlaybackResponse>;
26
+ startOver(): Promise<MediaPlayback.PlaybackResponse>;
27
+ previous(): Promise<MediaPlayback.PlaybackResponse>;
28
+ next(): Promise<MediaPlayback.PlaybackResponse>;
29
+ skipForward(_request: MediaPlayback.SkipForwardRequest): Promise<MediaPlayback.PlaybackResponse>;
30
+ skipBackward(_request: MediaPlayback.SkipBackwardRequest): Promise<MediaPlayback.PlaybackResponse>;
31
+ }
32
+ /**
33
+ * Custom MediaPlayback Server that calls plugin handlers.
34
+ *
35
+ * Extends the default server for its `reflect()` state handling (the matter.js
36
+ * base implements nothing at all).
37
+ */
38
+ export declare class HomebridgeMediaPlaybackServer extends DefaultMediaPlaybackServer {
39
+ /**
40
+ * Get the registry for this behavior's endpoint
41
+ */
42
+ private getRegistry;
43
+ /**
44
+ * Run a plugin handler and reflect the resulting playback state.
45
+ *
46
+ * A handler that throws a Matter protocol error is propagated as-is so the
47
+ * controller gets the real status; anything else is answered with a
48
+ * cluster-level status rather than an exception, which keeps the endpoint
49
+ * online.
50
+ */
51
+ private invoke;
52
+ play(): Promise<MediaPlayback.PlaybackResponse>;
53
+ pause(): Promise<MediaPlayback.PlaybackResponse>;
54
+ stop(): Promise<MediaPlayback.PlaybackResponse>;
55
+ startOver(): Promise<MediaPlayback.PlaybackResponse>;
56
+ previous(): Promise<MediaPlayback.PlaybackResponse>;
57
+ next(): Promise<MediaPlayback.PlaybackResponse>;
58
+ skipForward(request: MediaPlayback.SkipForwardRequest): Promise<MediaPlayback.PlaybackResponse>;
59
+ skipBackward(request: MediaPlayback.SkipBackwardRequest): Promise<MediaPlayback.PlaybackResponse>;
60
+ }
61
+ //# sourceMappingURL=MediaPlaybackBehavior.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaPlaybackBehavior.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/MediaPlaybackBeh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O,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAInD,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAI/C,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAI/F,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC;CAGjH"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * MediaPlayback Cluster Behavior
3
+ *
4
+ * Handles transport commands - play, pause, stop and track navigation - for
5
+ * media players and speakers.
6
+ */
7
+ import { MediaPlaybackServer } from '@matter/main/behaviors/media-playback';
8
+ import { MediaPlayback } from '@matter/main/clusters/media-playback';
9
+ import { MatterStatus } from '../errors.js';
10
+ import { getRegistryManager } from './EndpointContext.js';
11
+ /**
12
+ * Default MediaPlayback Server.
13
+ *
14
+ * matter.js's base MediaPlaybackServer implements none of the commands -
15
+ * invoking one throws NotImplementedError - so a player without plugin
16
+ * handlers would advertise the transport controls and fail every one. This
17
+ * default reflects the command in `currentState` and answers Success, which is
18
+ * enough for the endpoint to behave sanely on its own.
19
+ */
20
+ export class DefaultMediaPlaybackServer extends MediaPlaybackServer {
21
+ /**
22
+ * Record a new playback state, when the command implies one.
23
+ */
24
+ reflect(state) {
25
+ if (state !== undefined) {
26
+ this.state.currentState = state;
27
+ }
28
+ return { status: MediaPlayback.Status.Success };
29
+ }
30
+ async play() {
31
+ return this.reflect(MediaPlayback.PlaybackState.Playing);
32
+ }
33
+ async pause() {
34
+ return this.reflect(MediaPlayback.PlaybackState.Paused);
35
+ }
36
+ async stop() {
37
+ return this.reflect(MediaPlayback.PlaybackState.NotPlaying);
38
+ }
39
+ // Track navigation does not change whether the player is playing, so these
40
+ // only acknowledge the command.
41
+ async startOver() {
42
+ return this.reflect();
43
+ }
44
+ async previous() {
45
+ return this.reflect();
46
+ }
47
+ async next() {
48
+ return this.reflect();
49
+ }
50
+ // The requests are ignored here - the default server has no position to
51
+ // seek. The parameters must stay so HomebridgeMediaPlaybackServer can
52
+ // forward them.
53
+ // eslint-disable-next-line unused-imports/no-unused-vars
54
+ async skipForward(_request) {
55
+ return this.reflect();
56
+ }
57
+ // eslint-disable-next-line unused-imports/no-unused-vars
58
+ async skipBackward(_request) {
59
+ return this.reflect();
60
+ }
61
+ }
62
+ /**
63
+ * The transport commands routed to plugin handlers, and the playback state
64
+ * each one implies once the handler succeeds.
65
+ *
66
+ * Kept as data rather than one method per command: every command has the same
67
+ * shape - run the handler, record the state, answer Success - so writing them
68
+ * out longhand would be eight copies of the same error handling.
69
+ */
70
+ const PLAYBACK_COMMANDS = {
71
+ play: MediaPlayback.PlaybackState.Playing,
72
+ pause: MediaPlayback.PlaybackState.Paused,
73
+ stop: MediaPlayback.PlaybackState.NotPlaying,
74
+ startOver: undefined,
75
+ previous: undefined,
76
+ next: undefined,
77
+ skipForward: undefined,
78
+ skipBackward: undefined,
79
+ };
80
+ /**
81
+ * Custom MediaPlayback Server that calls plugin handlers.
82
+ *
83
+ * Extends the default server for its `reflect()` state handling (the matter.js
84
+ * base implements nothing at all).
85
+ */
86
+ export class HomebridgeMediaPlaybackServer extends DefaultMediaPlaybackServer {
87
+ /**
88
+ * Get the registry for this behavior's endpoint
89
+ */
90
+ getRegistry() {
91
+ return getRegistryManager(this.endpoint).getRegistry(this.endpoint.id);
92
+ }
93
+ /**
94
+ * Run a plugin handler and reflect the resulting playback state.
95
+ *
96
+ * A handler that throws a Matter protocol error is propagated as-is so the
97
+ * controller gets the real status; anything else is answered with a
98
+ * cluster-level status rather than an exception, which keeps the endpoint
99
+ * online.
100
+ */
101
+ async invoke(commandName, request) {
102
+ const endpointId = this.endpoint.id;
103
+ const registry = this.getRegistry();
104
+ try {
105
+ await registry.executeHandler(endpointId, 'mediaPlayback', commandName, request);
106
+ // Only reached if the handler succeeded - update Matter state
107
+ const response = this.reflect(PLAYBACK_COMMANDS[commandName]);
108
+ registry.syncStateToCache(endpointId, 'mediaPlayback', { currentState: this.state.currentState });
109
+ return response;
110
+ }
111
+ catch (error) {
112
+ if (MatterStatus.isMatterProtocolError(error)) {
113
+ throw error;
114
+ }
115
+ // Unlike the on/off style clusters, MediaPlayback carries its own status
116
+ // in the response, so a failure is reported through that rather than as
117
+ // a protocol-level error.
118
+ return { status: MediaPlayback.Status.InvalidStateForCommand };
119
+ }
120
+ }
121
+ async play() {
122
+ return this.invoke('play');
123
+ }
124
+ async pause() {
125
+ return this.invoke('pause');
126
+ }
127
+ async stop() {
128
+ return this.invoke('stop');
129
+ }
130
+ async startOver() {
131
+ return this.invoke('startOver');
132
+ }
133
+ async previous() {
134
+ return this.invoke('previous');
135
+ }
136
+ async next() {
137
+ return this.invoke('next');
138
+ }
139
+ async skipForward(request) {
140
+ return this.invoke('skipForward', request);
141
+ }
142
+ async skipBackward(request) {
143
+ return this.invoke('skipBackward', request);
144
+ }
145
+ }
146
+ //# sourceMappingURL=MediaPlaybackBehavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaPlaybackBehavior.js","sourceRoot":"","sources":["../../../src/matter/behaviors/MediaPlaybackBehavior.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA2B,SAAQ,mBAAmB;IACjE;;OAEG;IACO,OAAO,CAAC,KAAmC;QACnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAA;QACjC,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,MA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Q,KAAK,CAAC,IAAI;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;IAEQ,KAAK,CAAC,SAAS;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACjC,CAAC;IAEQ,KAAK,CAAC,QAAQ;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAChC,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;IAEQ,KAAK,CAAC,WAAW,CAAC,OAAyC;QAClE,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;IAEQ,KAAK,CAAC,YAAY,CAAC,OAA0C;QACpE,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;CACF"}
@@ -6,12 +6,15 @@
6
6
  export { HomebridgeAirQualityServer } from './AirQualityBehavior.js';
7
7
  export type { MatterAccessoryMap, MatterCommandHandler } from './BehaviorRegistry.js';
8
8
  export { BehaviorRegistry } from './BehaviorRegistry.js';
9
+ export { DefaultClosureControlServer, HomebridgeClosureControlServer } from './ClosureControlBehavior.js';
9
10
  export { HomebridgeColorControlServer } from './ColorControlBehavior.js';
10
11
  export { HomebridgeCarbonMonoxideConcentrationMeasurementServer, HomebridgeNitrogenDioxideConcentrationMeasurementServer, HomebridgeOzoneConcentrationMeasurementServer, HomebridgePm10ConcentrationMeasurementServer, HomebridgePm25ConcentrationMeasurementServer, } from './ConcentrationMeasurementBehavior.js';
11
12
  export { HomebridgeDoorLockServer } from './DoorLockBehavior.js';
12
13
  export { HomebridgeFanControlServer } from './FanControlBehavior.js';
13
14
  export { HomebridgeIdentifyServer } from './IdentifyBehavior.js';
15
+ export { DefaultKeypadInputServer, HomebridgeKeypadInputServer } from './KeypadInputBehavior.js';
14
16
  export { HomebridgeLevelControlServer } from './LevelControlBehavior.js';
17
+ export { DefaultMediaPlaybackServer, HomebridgeMediaPlaybackServer } from './MediaPlaybackBehavior.js';
15
18
  export { HomebridgeOnOffServer } from './OnOffBehavior.js';
16
19
  export { RegistryManager } from './RegistryManager.js';
17
20
  export { HomebridgeRvcCleanModeServer } from './RvcCleanModeBehavior.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/matter/behaviors/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EACL,sDAAsD,EACtD,uDAAuD,EACvD,6CAA6C,EAC7C,4CAA4C,EAC5C,4CAA4C,GAC7C,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAA;AACtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAE,0BAA0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0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,yCAAyC,EAAE,4CAA4C,EAAE,MAAM,2CAA2C,CAAA;AACnJ,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA"}
@@ -5,12 +5,15 @@
5
5
  */
6
6
  export { HomebridgeAirQualityServer } from './AirQualityBehavior.js';
7
7
  export { BehaviorRegistry } from './BehaviorRegistry.js';
8
+ export { DefaultClosureControlServer, HomebridgeClosureControlServer } from './ClosureControlBehavior.js';
8
9
  export { HomebridgeColorControlServer } from './ColorControlBehavior.js';
9
10
  export { HomebridgeCarbonMonoxideConcentrationMeasurementServer, HomebridgeNitrogenDioxideConcentrationMeasurementServer, HomebridgeOzoneConcentrationMeasurementServer, HomebridgePm10ConcentrationMeasurementServer, HomebridgePm25ConcentrationMeasurementServer, } from './ConcentrationMeasurementBehavior.js';
10
11
  export { HomebridgeDoorLockServer } from './DoorLockBehavior.js';
11
12
  export { HomebridgeFanControlServer } from './FanControlBehavior.js';
12
13
  export { HomebridgeIdentifyServer } from './IdentifyBehavior.js';
14
+ export { DefaultKeypadInputServer, HomebridgeKeypadInputServer } from './KeypadInputBehavior.js';
13
15
  export { HomebridgeLevelControlServer } from './LevelControlBehavior.js';
16
+ export { DefaultMediaPlaybackServer, HomebridgeMediaPlaybackServer } from './MediaPlaybackBehavior.js';
14
17
  export { HomebridgeOnOffServer } from './OnOffBehavior.js';
15
18
  export { RegistryManager } from './RegistryManager.js';
16
19
  export { HomebridgeRvcCleanModeServer } from './RvcCleanModeBehavior.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/matter/behaviors/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAEp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