@matterbridge/core 3.5.3
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/LICENSE +202 -0
- package/README.md +22 -0
- package/dist/cli.d.ts +29 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +268 -0
- package/dist/cli.js.map +1 -0
- package/dist/cliEmitter.d.ts +50 -0
- package/dist/cliEmitter.d.ts.map +1 -0
- package/dist/cliEmitter.js +49 -0
- package/dist/cliEmitter.js.map +1 -0
- package/dist/cliHistory.d.ts +48 -0
- package/dist/cliHistory.d.ts.map +1 -0
- package/dist/cliHistory.js +826 -0
- package/dist/cliHistory.js.map +1 -0
- package/dist/clusters/export.d.ts +2 -0
- package/dist/clusters/export.d.ts.map +1 -0
- package/dist/clusters/export.js +3 -0
- package/dist/clusters/export.js.map +1 -0
- package/dist/crypto/attestationDecoder.d.ts +180 -0
- package/dist/crypto/attestationDecoder.d.ts.map +1 -0
- package/dist/crypto/attestationDecoder.js +176 -0
- package/dist/crypto/attestationDecoder.js.map +1 -0
- package/dist/crypto/declarationDecoder.d.ts +72 -0
- package/dist/crypto/declarationDecoder.d.ts.map +1 -0
- package/dist/crypto/declarationDecoder.js +241 -0
- package/dist/crypto/declarationDecoder.js.map +1 -0
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts +9 -0
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts.map +1 -0
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js +120 -0
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js.map +1 -0
- package/dist/crypto/read-extensions.d.ts +2 -0
- package/dist/crypto/read-extensions.d.ts.map +1 -0
- package/dist/crypto/read-extensions.js +81 -0
- package/dist/crypto/read-extensions.js.map +1 -0
- package/dist/crypto/testData.d.ts +31 -0
- package/dist/crypto/testData.d.ts.map +1 -0
- package/dist/crypto/testData.js +131 -0
- package/dist/crypto/testData.js.map +1 -0
- package/dist/crypto/walk-der.d.ts +2 -0
- package/dist/crypto/walk-der.d.ts.map +1 -0
- package/dist/crypto/walk-der.js +165 -0
- package/dist/crypto/walk-der.js.map +1 -0
- package/dist/deviceManager.d.ts +135 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +270 -0
- package/dist/deviceManager.js.map +1 -0
- package/dist/devices/airConditioner.d.ts +98 -0
- package/dist/devices/airConditioner.d.ts.map +1 -0
- package/dist/devices/airConditioner.js +74 -0
- package/dist/devices/airConditioner.js.map +1 -0
- package/dist/devices/basicVideoPlayer.d.ts +88 -0
- package/dist/devices/basicVideoPlayer.d.ts.map +1 -0
- package/dist/devices/basicVideoPlayer.js +155 -0
- package/dist/devices/basicVideoPlayer.js.map +1 -0
- package/dist/devices/batteryStorage.d.ts +48 -0
- package/dist/devices/batteryStorage.d.ts.map +1 -0
- package/dist/devices/batteryStorage.js +75 -0
- package/dist/devices/batteryStorage.js.map +1 -0
- package/dist/devices/castingVideoPlayer.d.ts +79 -0
- package/dist/devices/castingVideoPlayer.d.ts.map +1 -0
- package/dist/devices/castingVideoPlayer.js +101 -0
- package/dist/devices/castingVideoPlayer.js.map +1 -0
- package/dist/devices/cooktop.d.ts +61 -0
- package/dist/devices/cooktop.d.ts.map +1 -0
- package/dist/devices/cooktop.js +77 -0
- package/dist/devices/cooktop.js.map +1 -0
- package/dist/devices/dishwasher.d.ts +71 -0
- package/dist/devices/dishwasher.d.ts.map +1 -0
- package/dist/devices/dishwasher.js +130 -0
- package/dist/devices/dishwasher.js.map +1 -0
- package/dist/devices/evse.d.ts +76 -0
- package/dist/devices/evse.d.ts.map +1 -0
- package/dist/devices/evse.js +156 -0
- package/dist/devices/evse.js.map +1 -0
- package/dist/devices/export.d.ts +19 -0
- package/dist/devices/export.d.ts.map +1 -0
- package/dist/devices/export.js +23 -0
- package/dist/devices/export.js.map +1 -0
- package/dist/devices/extractorHood.d.ts +46 -0
- package/dist/devices/extractorHood.d.ts.map +1 -0
- package/dist/devices/extractorHood.js +78 -0
- package/dist/devices/extractorHood.js.map +1 -0
- package/dist/devices/heatPump.d.ts +47 -0
- package/dist/devices/heatPump.d.ts.map +1 -0
- package/dist/devices/heatPump.js +84 -0
- package/dist/devices/heatPump.js.map +1 -0
- package/dist/devices/laundryDryer.d.ts +67 -0
- package/dist/devices/laundryDryer.d.ts.map +1 -0
- package/dist/devices/laundryDryer.js +106 -0
- package/dist/devices/laundryDryer.js.map +1 -0
- package/dist/devices/laundryWasher.d.ts +81 -0
- package/dist/devices/laundryWasher.d.ts.map +1 -0
- package/dist/devices/laundryWasher.js +147 -0
- package/dist/devices/laundryWasher.js.map +1 -0
- package/dist/devices/microwaveOven.d.ts +168 -0
- package/dist/devices/microwaveOven.d.ts.map +1 -0
- package/dist/devices/microwaveOven.js +179 -0
- package/dist/devices/microwaveOven.js.map +1 -0
- package/dist/devices/oven.d.ts +105 -0
- package/dist/devices/oven.d.ts.map +1 -0
- package/dist/devices/oven.js +190 -0
- package/dist/devices/oven.js.map +1 -0
- package/dist/devices/refrigerator.d.ts +118 -0
- package/dist/devices/refrigerator.d.ts.map +1 -0
- package/dist/devices/refrigerator.js +186 -0
- package/dist/devices/refrigerator.js.map +1 -0
- package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +268 -0
- package/dist/devices/roboticVacuumCleaner.js.map +1 -0
- package/dist/devices/solarPower.d.ts +40 -0
- package/dist/devices/solarPower.d.ts.map +1 -0
- package/dist/devices/solarPower.js +59 -0
- package/dist/devices/solarPower.js.map +1 -0
- package/dist/devices/speaker.d.ts +87 -0
- package/dist/devices/speaker.d.ts.map +1 -0
- package/dist/devices/speaker.js +120 -0
- package/dist/devices/speaker.js.map +1 -0
- package/dist/devices/temperatureControl.d.ts +166 -0
- package/dist/devices/temperatureControl.d.ts.map +1 -0
- package/dist/devices/temperatureControl.js +78 -0
- package/dist/devices/temperatureControl.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +111 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +166 -0
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/dgram/export.d.ts +2 -0
- package/dist/dgram/export.d.ts.map +1 -0
- package/dist/dgram/export.js +2 -0
- package/dist/dgram/export.js.map +1 -0
- package/dist/export.d.ts +32 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +39 -0
- package/dist/export.js.map +1 -0
- package/dist/frontend.d.ts +248 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +2605 -0
- package/dist/frontend.js.map +1 -0
- package/dist/helpers.d.ts +48 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +161 -0
- package/dist/helpers.js.map +1 -0
- package/dist/jestutils/export.d.ts +2 -0
- package/dist/jestutils/export.d.ts.map +1 -0
- package/dist/jestutils/export.js +2 -0
- package/dist/jestutils/export.js.map +1 -0
- package/dist/jestutils/jestHelpers.d.ts +349 -0
- package/dist/jestutils/jestHelpers.d.ts.map +1 -0
- package/dist/jestutils/jestHelpers.js +980 -0
- package/dist/jestutils/jestHelpers.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +3 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +3 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +3 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +3 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +4 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +5 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +2 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +3 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterNode.d.ts +341 -0
- package/dist/matterNode.d.ts.map +1 -0
- package/dist/matterNode.js +1329 -0
- package/dist/matterNode.js.map +1 -0
- package/dist/matterbridge.d.ts +544 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +2880 -0
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +49 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +80 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +2428 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +620 -0
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +744 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +1312 -0
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +49 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +80 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1548 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +2883 -0
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +1855 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +1270 -0
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgeEndpointTypes.d.ts +172 -0
- package/dist/matterbridgeEndpointTypes.d.ts.map +1 -0
- package/dist/matterbridgeEndpointTypes.js +28 -0
- package/dist/matterbridgeEndpointTypes.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +520 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +921 -0
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/mb_coap.d.ts +24 -0
- package/dist/mb_coap.d.ts.map +1 -0
- package/dist/mb_coap.js +89 -0
- package/dist/mb_coap.js.map +1 -0
- package/dist/mb_health.d.ts +77 -0
- package/dist/mb_health.d.ts.map +1 -0
- package/dist/mb_health.js +147 -0
- package/dist/mb_health.js.map +1 -0
- package/dist/mb_mdns.d.ts +24 -0
- package/dist/mb_mdns.d.ts.map +1 -0
- package/dist/mb_mdns.js +285 -0
- package/dist/mb_mdns.js.map +1 -0
- package/dist/pluginManager.d.ts +388 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +1574 -0
- package/dist/pluginManager.js.map +1 -0
- package/dist/spawn.d.ts +33 -0
- package/dist/spawn.d.ts.map +1 -0
- package/dist/spawn.js +165 -0
- package/dist/spawn.js.map +1 -0
- package/dist/utils/export.d.ts +2 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +2 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/workers/brand.d.ts +25 -0
- package/dist/workers/brand.d.ts.map +1 -0
- package/dist/workers/brand.extend.d.ts +10 -0
- package/dist/workers/brand.extend.d.ts.map +1 -0
- package/dist/workers/brand.extend.js +15 -0
- package/dist/workers/brand.extend.js.map +1 -0
- package/dist/workers/brand.invalid.d.ts +9 -0
- package/dist/workers/brand.invalid.d.ts.map +1 -0
- package/dist/workers/brand.invalid.js +19 -0
- package/dist/workers/brand.invalid.js.map +1 -0
- package/dist/workers/brand.js +67 -0
- package/dist/workers/brand.js.map +1 -0
- package/dist/workers/clusterTypes.d.ts +47 -0
- package/dist/workers/clusterTypes.d.ts.map +1 -0
- package/dist/workers/clusterTypes.js +57 -0
- package/dist/workers/clusterTypes.js.map +1 -0
- package/dist/workers/frontendWorker.d.ts +2 -0
- package/dist/workers/frontendWorker.d.ts.map +1 -0
- package/dist/workers/frontendWorker.js +90 -0
- package/dist/workers/frontendWorker.js.map +1 -0
- package/dist/workers/helloWorld.d.ts +2 -0
- package/dist/workers/helloWorld.d.ts.map +1 -0
- package/dist/workers/helloWorld.js +135 -0
- package/dist/workers/helloWorld.js.map +1 -0
- package/dist/workers/matterWorker.d.ts +2 -0
- package/dist/workers/matterWorker.d.ts.map +1 -0
- package/dist/workers/matterWorker.js +104 -0
- package/dist/workers/matterWorker.js.map +1 -0
- package/dist/workers/matterbridgeWorker.d.ts +2 -0
- package/dist/workers/matterbridgeWorker.d.ts.map +1 -0
- package/dist/workers/matterbridgeWorker.js +75 -0
- package/dist/workers/matterbridgeWorker.js.map +1 -0
- package/dist/workers/messageLab.d.ts +134 -0
- package/dist/workers/messageLab.d.ts.map +1 -0
- package/dist/workers/messageLab.js +129 -0
- package/dist/workers/messageLab.js.map +1 -0
- package/dist/workers/testWorker.d.ts +2 -0
- package/dist/workers/testWorker.d.ts.map +1 -0
- package/dist/workers/testWorker.js +45 -0
- package/dist/workers/testWorker.js.map +1 -0
- package/dist/workers/usage.d.ts +19 -0
- package/dist/workers/usage.d.ts.map +1 -0
- package/dist/workers/usage.js +140 -0
- package/dist/workers/usage.js.map +1 -0
- package/dist/workers/workerManager.d.ts +115 -0
- package/dist/workers/workerManager.d.ts.map +1 -0
- package/dist/workers/workerManager.js +464 -0
- package/dist/workers/workerManager.js.map +1 -0
- package/dist/workers/workerServer.d.ts +126 -0
- package/dist/workers/workerServer.d.ts.map +1 -0
- package/dist/workers/workerServer.js +340 -0
- package/dist/workers/workerServer.js.map +1 -0
- package/dist/workers/workerTypes.d.ts +23 -0
- package/dist/workers/workerTypes.d.ts.map +1 -0
- package/dist/workers/workerTypes.js +3 -0
- package/dist/workers/workerTypes.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the BasicVideoPlayer class.
|
|
3
|
+
* @file src/devices/basicVideoPlayer.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @created 2026-01-25
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
import { MediaPlayback } from '@matter/types/clusters/media-playback';
|
|
24
|
+
import { KeypadInput } from '@matter/types/clusters/keypad-input';
|
|
25
|
+
import { MediaPlaybackServer } from '@matter/node/behaviors/media-playback';
|
|
26
|
+
import { KeypadInputServer } from '@matter/node/behaviors/keypad-input';
|
|
27
|
+
// Matterbridge
|
|
28
|
+
import { basicVideoPlayer, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
29
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
30
|
+
import { MatterbridgeOnOffServer, MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
31
|
+
export class BasicVideoPlayer extends MatterbridgeEndpoint {
|
|
32
|
+
/**
|
|
33
|
+
* Creates an instance of the BasicVideoPlayer class.
|
|
34
|
+
*
|
|
35
|
+
* A Video Player (either Basic or Casting) represents a device that is able to play media to a physical
|
|
36
|
+
* output or to a display screen which is part of the device.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} name - The name of the video player.
|
|
39
|
+
* @param {string} serial - The serial number of the video player.
|
|
40
|
+
* @param {BasicVideoPlayerOptions} [options] - Optional configuration values. Missing fields use defaults.
|
|
41
|
+
*
|
|
42
|
+
* Options defaults:
|
|
43
|
+
* - onOff: false
|
|
44
|
+
* - playbackState: NotPlaying
|
|
45
|
+
*
|
|
46
|
+
* @returns {BasicVideoPlayer} The BasicVideoPlayer instance.
|
|
47
|
+
*
|
|
48
|
+
* @remarks Not supported by Google Home.
|
|
49
|
+
*/
|
|
50
|
+
constructor(name, serial, options = {}) {
|
|
51
|
+
const { onOff = false, playbackState = MediaPlayback.PlaybackState.NotPlaying } = options;
|
|
52
|
+
super([basicVideoPlayer, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
|
|
53
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Basic Video Player');
|
|
54
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
55
|
+
this.createOnOffClusterServer(onOff);
|
|
56
|
+
this.createDefaultMediaPlaybackClusterServer(playbackState);
|
|
57
|
+
this.createDefaultKeypadInputClusterServer();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a default Media Playback Cluster Server.
|
|
61
|
+
*
|
|
62
|
+
* @param {MediaPlayback.PlaybackState} currentState - The current state of the video player.
|
|
63
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
64
|
+
*/
|
|
65
|
+
createDefaultMediaPlaybackClusterServer(currentState) {
|
|
66
|
+
this.behaviors.require(MatterbridgeMediaPlaybackServer.enable({
|
|
67
|
+
commands: { next: true, previous: true, skipForward: true, skipBackward: true },
|
|
68
|
+
}), {
|
|
69
|
+
currentState,
|
|
70
|
+
});
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a default Keypad Input Cluster Server.
|
|
75
|
+
*
|
|
76
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
77
|
+
*/
|
|
78
|
+
createDefaultKeypadInputClusterServer() {
|
|
79
|
+
this.behaviors.require(MatterbridgeKeypadInputServer, {
|
|
80
|
+
// No attributes to initialize
|
|
81
|
+
});
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export class MatterbridgeMediaPlaybackServer extends MediaPlaybackServer {
|
|
86
|
+
initialize() {
|
|
87
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
88
|
+
device.log.info(`MatterbridgeMediaPlaybackServer initialized: currentState is ${this.state.currentState}`);
|
|
89
|
+
this.reactTo(this.agent.get(MatterbridgeOnOffServer).events.onOff$Changed, this.handleOnOffChange);
|
|
90
|
+
}
|
|
91
|
+
handleOnOffChange(_onOff) {
|
|
92
|
+
this.state.currentState = MediaPlayback.PlaybackState.NotPlaying;
|
|
93
|
+
}
|
|
94
|
+
play() {
|
|
95
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
96
|
+
device.log.info(`Play (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
97
|
+
device.commandHandler.executeHandler('play', { request: undefined, cluster: MediaPlaybackServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
98
|
+
if (this.endpoint.stateOf(MatterbridgeOnOffServer).onOff === true)
|
|
99
|
+
this.state.currentState = MediaPlayback.PlaybackState.Playing;
|
|
100
|
+
return { status: MediaPlayback.Status.Success };
|
|
101
|
+
}
|
|
102
|
+
pause() {
|
|
103
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
104
|
+
device.log.info(`Pause (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
105
|
+
device.commandHandler.executeHandler('pause', { request: undefined, cluster: MediaPlaybackServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
106
|
+
if (this.endpoint.stateOf(MatterbridgeOnOffServer).onOff === true)
|
|
107
|
+
this.state.currentState = MediaPlayback.PlaybackState.Paused;
|
|
108
|
+
return { status: MediaPlayback.Status.Success };
|
|
109
|
+
}
|
|
110
|
+
stop() {
|
|
111
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
112
|
+
device.log.info(`Stop (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
113
|
+
device.commandHandler.executeHandler('stop', { request: undefined, cluster: MediaPlaybackServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
114
|
+
if (this.endpoint.stateOf(MatterbridgeOnOffServer).onOff === true)
|
|
115
|
+
this.state.currentState = MediaPlayback.PlaybackState.NotPlaying;
|
|
116
|
+
return { status: MediaPlayback.Status.Success };
|
|
117
|
+
}
|
|
118
|
+
previous() {
|
|
119
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
120
|
+
device.log.info(`Previous (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
121
|
+
device.commandHandler.executeHandler('previous', { request: undefined, cluster: MediaPlaybackServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
122
|
+
return { status: MediaPlayback.Status.Success };
|
|
123
|
+
}
|
|
124
|
+
next() {
|
|
125
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
126
|
+
device.log.info(`Next (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
127
|
+
device.commandHandler.executeHandler('next', { request: undefined, cluster: MediaPlaybackServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
128
|
+
return { status: MediaPlayback.Status.Success };
|
|
129
|
+
}
|
|
130
|
+
skipForward() {
|
|
131
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
132
|
+
device.log.info(`SkipForward (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
133
|
+
device.commandHandler.executeHandler('skipForward', { request: undefined, cluster: MediaPlaybackServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
134
|
+
return { status: MediaPlayback.Status.Success };
|
|
135
|
+
}
|
|
136
|
+
skipBackward() {
|
|
137
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
138
|
+
device.log.info(`SkipBackward (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
139
|
+
device.commandHandler.executeHandler('skipBackward', { request: undefined, cluster: MediaPlaybackServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
140
|
+
return { status: MediaPlayback.Status.Success };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export class MatterbridgeKeypadInputServer extends KeypadInputServer {
|
|
144
|
+
initialize() {
|
|
145
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
146
|
+
device.log.info(`MatterbridgeKeypadInputServer initialized`);
|
|
147
|
+
}
|
|
148
|
+
sendKey(request) {
|
|
149
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
150
|
+
device.log.info(`SendKey keyCode ${request.keyCode} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
151
|
+
device.commandHandler.executeHandler('sendKey', { request, cluster: KeypadInputServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
152
|
+
return { status: KeypadInput.Status.Success };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=basicVideoPlayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basicVideoPlayer.js","sourceRoot":"","sources":["../../src/devices/basicVideoPlayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,E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,SAAQ,iBAAiB;IACzD,UAAU;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAEQ,OAAO,CAAC,OAAmC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,OAAO,CAAC,OAAO,cAAc,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,CAAC,CAAC;QACvH,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7I,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the BatteryStorage class.
|
|
3
|
+
* @file src/devices/batteryStorage.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @contributor Ludovic BOUÉ
|
|
6
|
+
* @created 2025-06-20
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
25
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
26
|
+
export declare class BatteryStorage extends MatterbridgeEndpoint {
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of the BatteryStorage class.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} name - The name of the BatteryStorage.
|
|
31
|
+
* @param {string} serial - The serial number of the BatteryStorage.
|
|
32
|
+
* @param {number} [batPercentRemaining] - The percentage of battery remaining, defaults to `100` if not provided.
|
|
33
|
+
* @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
34
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
35
|
+
* @param {number} current - The current value in milliamperes.
|
|
36
|
+
* @param {number} power - The power value in milliwatts.
|
|
37
|
+
* @param {number} energyImported - The total production value in mW/h.
|
|
38
|
+
* @param {number} energyExported - The total production value in mW/h.
|
|
39
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
40
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* - A battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
44
|
+
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
45
|
+
*/
|
|
46
|
+
constructor(name: string, serial: string, batPercentRemaining?: number, batChargeLevel?: PowerSource.BatChargeLevel, voltage?: number | bigint | null, current?: number | bigint | null, power?: number | bigint | null, energyImported?: number | bigint | null, energyExported?: number | bigint | null, absMinPower?: number, absMaxPower?: number);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=batteryStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batteryStorage.d.ts","sourceRoot":"","sources":["../../src/devices/batteryStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,qBAAa,cAAe,SAAQ,oBAAoB;IACtD;;;;;;;;;;;;;;;;;;OAkBG;gBAED,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,mBAAmB,GAAE,MAAY,EACjC,cAAc,GAAE,WAAW,CAAC,cAA8C,EAC1E,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACpC,cAAc,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EAC7C,cAAc,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EAC7C,WAAW,GAAE,MAAU,EACvB,WAAW,GAAE,MAAU;CA0B1B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the BatteryStorage class.
|
|
3
|
+
* @file src/devices/batteryStorage.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @contributor Ludovic BOUÉ
|
|
6
|
+
* @created 2025-06-20
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
// @matter
|
|
25
|
+
import { PowerSourceTag } from '@matter/node';
|
|
26
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
27
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
28
|
+
// Matterbridge
|
|
29
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
30
|
+
import { deviceEnergyManagement, electricalSensor, batteryStorage, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
31
|
+
export class BatteryStorage extends MatterbridgeEndpoint {
|
|
32
|
+
/**
|
|
33
|
+
* Creates an instance of the BatteryStorage class.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} name - The name of the BatteryStorage.
|
|
36
|
+
* @param {string} serial - The serial number of the BatteryStorage.
|
|
37
|
+
* @param {number} [batPercentRemaining] - The percentage of battery remaining, defaults to `100` if not provided.
|
|
38
|
+
* @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
39
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
40
|
+
* @param {number} current - The current value in milliamperes.
|
|
41
|
+
* @param {number} power - The power value in milliwatts.
|
|
42
|
+
* @param {number} energyImported - The total production value in mW/h.
|
|
43
|
+
* @param {number} energyExported - The total production value in mW/h.
|
|
44
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
45
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* - A battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
49
|
+
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
50
|
+
*/
|
|
51
|
+
constructor(name, serial, batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, voltage = null, current = null, power = null, energyImported = null, energyExported = null, absMinPower = 0, absMaxPower = 0) {
|
|
52
|
+
super([batteryStorage, electricalSensor, deviceEnergyManagement], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
|
|
53
|
+
this.createDefaultIdentifyClusterServer()
|
|
54
|
+
.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Solar Power')
|
|
55
|
+
.createDefaultPowerTopologyClusterServer()
|
|
56
|
+
.createDefaultElectricalPowerMeasurementClusterServer(voltage, current, power)
|
|
57
|
+
.createDefaultElectricalEnergyMeasurementClusterServer(energyImported, energyExported)
|
|
58
|
+
.createDefaultDeviceEnergyManagementClusterServer(DeviceEnergyManagement.EsaType.BatteryStorage, true, DeviceEnergyManagement.EsaState.Online, absMinPower, absMaxPower)
|
|
59
|
+
.createDefaultDeviceEnergyManagementModeClusterServer()
|
|
60
|
+
.addRequiredClusterServers();
|
|
61
|
+
// Add separate PowerSource child devices cause in matter.js the PowerSource cluster is not supported with both features Wired and Battery.
|
|
62
|
+
// Probably this is also an error in the specification...
|
|
63
|
+
this.addChildDeviceType('BatteryPowerSource', powerSource, {
|
|
64
|
+
tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Battery.namespaceId, tag: PowerSourceTag.Battery.tag, label: null }],
|
|
65
|
+
})
|
|
66
|
+
.createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, 24_000) // Battery voltage in mV (24V).
|
|
67
|
+
.addRequiredClusterServers();
|
|
68
|
+
this.addChildDeviceType('GridPowerSource', powerSource, {
|
|
69
|
+
tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Grid.namespaceId, tag: PowerSourceTag.Grid.tag, label: null }],
|
|
70
|
+
})
|
|
71
|
+
.createDefaultPowerSourceWiredClusterServer()
|
|
72
|
+
.addRequiredClusterServers();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=batteryStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batteryStorage.js","sourceRoot":"","sources":["../../src/devices/batteryStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,eAAe;AACf,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEtH,MAAM,OAAO,cAAe,SAAQ,oBAAoB;IACtD;;;;;;;;;;;;;;;;;;OAkBG;IACH,YACE,IAAY,EACZ,MAAc,EACd,sBAA8B,GAAG,EACjC,iBAA6C,WAAW,CAAC,cAAc,CAAC,EAAE,EAC1E,UAAkC,IAAI,EACtC,UAAkC,IAAI,EACtC,QAAgC,IAAI,EACpC,iBAAyC,IAAI,EAC7C,iBAAyC,IAAI,EAC7C,cAAsB,CAAC,EACvB,cAAsB,CAAC;QAEvB,KAAK,CAAC,CAAC,cAAc,EAAE,gBAAgB,EAAE,sBAAsB,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAA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@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the CastingVideoPlayer class.
|
|
3
|
+
* @file src/devices/castingVideoPlayer.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @created 2026-01-25
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
import { MediaPlayback } from '@matter/types/clusters/media-playback';
|
|
24
|
+
import { ContentLauncherServer } from '@matter/node/behaviors/content-launcher';
|
|
25
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
26
|
+
/**
|
|
27
|
+
* Options for configuring an {@link AirConditioner} instance.
|
|
28
|
+
*
|
|
29
|
+
* All temperatures in °C. Typical valid range 0–50 unless otherwise noted.
|
|
30
|
+
*/
|
|
31
|
+
export interface CastingVideoPlayerOptions {
|
|
32
|
+
/** Device state */
|
|
33
|
+
onOff?: boolean;
|
|
34
|
+
playbackState?: MediaPlayback.PlaybackState;
|
|
35
|
+
}
|
|
36
|
+
export declare class CastingVideoPlayer extends MatterbridgeEndpoint {
|
|
37
|
+
/**
|
|
38
|
+
* Creates an instance of the CastingVideoPlayer class.
|
|
39
|
+
*
|
|
40
|
+
* A Video Player (either Basic or Casting) represents a device that is able to play media to a physical
|
|
41
|
+
* output or to a display screen which is part of the device.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} name - The name of the video player.
|
|
44
|
+
* @param {string} serial - The serial number of the video player.
|
|
45
|
+
* @param {CastingVideoPlayerOptions} [options] - Optional configuration values. Missing fields use defaults.
|
|
46
|
+
*
|
|
47
|
+
* Options defaults:
|
|
48
|
+
* - onOff: false
|
|
49
|
+
* - playbackState: NotPlaying
|
|
50
|
+
*
|
|
51
|
+
* @returns {CastingVideoPlayer} The CastingVideoPlayer instance.
|
|
52
|
+
*
|
|
53
|
+
* @remarks Not supported by Google Home.
|
|
54
|
+
*/
|
|
55
|
+
constructor(name: string, serial: string, options?: CastingVideoPlayerOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Creates a default Media Playback Cluster Server.
|
|
58
|
+
*
|
|
59
|
+
* @param {MediaPlayback.PlaybackState} currentState - The current state of the video player.
|
|
60
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
61
|
+
*/
|
|
62
|
+
createDefaultMediaPlaybackClusterServer(currentState: MediaPlayback.PlaybackState): this;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a default Keypad Input Cluster Server.
|
|
65
|
+
*
|
|
66
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
67
|
+
*/
|
|
68
|
+
createDefaultKeypadInputClusterServer(): this;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a default Keypad Input Cluster Server.
|
|
71
|
+
*
|
|
72
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
73
|
+
*/
|
|
74
|
+
createDefaultContentLauncherClusterServer(): this;
|
|
75
|
+
}
|
|
76
|
+
export declare class MatterbridgeContentLauncherServer extends ContentLauncherServer {
|
|
77
|
+
initialize(): void;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=castingVideoPlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"castingVideoPlayer.d.ts","sourceRoot":"","sources":["../../src/devices/castingVideoPlayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAKlE;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,mBAAmB;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC;CAC7C;AAED,qBAAa,kBAAmB,SAAQ,oBAAoB;IAC1D;;;;;;;;;;;;;;;;;OAiBG;gBACS,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,yBAA8B;IAWjF;;;;;OAKG;IACH,uCAAuC,CAAC,YAAY,EAAE,aAAa,CAAC,aAAa,GAAG,IAAI;IAOxF;;;;OAIG;IACH,qCAAqC,IAAI,IAAI;IAO7C;;;;OAIG;IACH,yCAAyC,IAAI,IAAI;CAMlD;AAED,qBAAa,iCAAkC,SAAQ,qBAAqB;IACjE,UAAU;CAIpB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the CastingVideoPlayer class.
|
|
3
|
+
* @file src/devices/castingVideoPlayer.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @created 2026-01-25
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
// Imports from @matter
|
|
24
|
+
import { MediaPlayback } from '@matter/types/clusters/media-playback';
|
|
25
|
+
import { ContentLauncherServer } from '@matter/node/behaviors/content-launcher';
|
|
26
|
+
// Matterbridge
|
|
27
|
+
import { castingVideoPlayer, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
28
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
29
|
+
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
30
|
+
import { MatterbridgeKeypadInputServer, MatterbridgeMediaPlaybackServer } from './basicVideoPlayer.js';
|
|
31
|
+
export class CastingVideoPlayer extends MatterbridgeEndpoint {
|
|
32
|
+
/**
|
|
33
|
+
* Creates an instance of the CastingVideoPlayer class.
|
|
34
|
+
*
|
|
35
|
+
* A Video Player (either Basic or Casting) represents a device that is able to play media to a physical
|
|
36
|
+
* output or to a display screen which is part of the device.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} name - The name of the video player.
|
|
39
|
+
* @param {string} serial - The serial number of the video player.
|
|
40
|
+
* @param {CastingVideoPlayerOptions} [options] - Optional configuration values. Missing fields use defaults.
|
|
41
|
+
*
|
|
42
|
+
* Options defaults:
|
|
43
|
+
* - onOff: false
|
|
44
|
+
* - playbackState: NotPlaying
|
|
45
|
+
*
|
|
46
|
+
* @returns {CastingVideoPlayer} The CastingVideoPlayer instance.
|
|
47
|
+
*
|
|
48
|
+
* @remarks Not supported by Google Home.
|
|
49
|
+
*/
|
|
50
|
+
constructor(name, serial, options = {}) {
|
|
51
|
+
const { onOff = false, playbackState = MediaPlayback.PlaybackState.NotPlaying } = options;
|
|
52
|
+
super([castingVideoPlayer, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
|
|
53
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Casting Video Player');
|
|
54
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
55
|
+
this.createOnOffClusterServer(onOff);
|
|
56
|
+
this.createDefaultMediaPlaybackClusterServer(playbackState);
|
|
57
|
+
this.createDefaultKeypadInputClusterServer();
|
|
58
|
+
this.createDefaultContentLauncherClusterServer();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a default Media Playback Cluster Server.
|
|
62
|
+
*
|
|
63
|
+
* @param {MediaPlayback.PlaybackState} currentState - The current state of the video player.
|
|
64
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
65
|
+
*/
|
|
66
|
+
createDefaultMediaPlaybackClusterServer(currentState) {
|
|
67
|
+
this.behaviors.require(MatterbridgeMediaPlaybackServer, {
|
|
68
|
+
currentState,
|
|
69
|
+
});
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a default Keypad Input Cluster Server.
|
|
74
|
+
*
|
|
75
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
76
|
+
*/
|
|
77
|
+
createDefaultKeypadInputClusterServer() {
|
|
78
|
+
this.behaviors.require(MatterbridgeKeypadInputServer, {
|
|
79
|
+
// No attributes to initialize
|
|
80
|
+
});
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates a default Keypad Input Cluster Server.
|
|
85
|
+
*
|
|
86
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
87
|
+
*/
|
|
88
|
+
createDefaultContentLauncherClusterServer() {
|
|
89
|
+
this.behaviors.require(MatterbridgeContentLauncherServer, {
|
|
90
|
+
// No attributes to initialize
|
|
91
|
+
});
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export class MatterbridgeContentLauncherServer extends ContentLauncherServer {
|
|
96
|
+
initialize() {
|
|
97
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
98
|
+
device.log.info(`MatterbridgeContentLauncherServer initialized`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=castingVideoPlayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"castingVideoPlayer.js","sourceRoot":"","sources":["../../src/devices/castingVideoPlayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,uBAAuB;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,eAAe;AACf,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAavG,MAAM,OAAO,kBAAmB,SAAQ,oBAAoB;IAC1D;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,IAAY,EAAE,MAAc,EAAE,UAAqC,EAAE;QAC/E,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;QAC1F,KAAK,CAAC,CAAC,kBAAkB,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9G,IAAI,CAAC,0CAA0C,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,mCAAmC,CAAC,CAAC;QACnI,IAAI,CAAC,0CAA0C,EAAE,CAAC;QAClD,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,uCAAuC,CAAC,aAAa,CAAC,CAAC;QAC5D,IAAI,CAAC,qCAAqC,EAAE,CAAC;QAC7C,IAAI,CAAC,yCAAyC,EAAE,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,uCAAuC,CAAC,YAAyC;QAC/E,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,+BAA+B,EAAE;YACtD,YAAY;SACb,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,qCAAqC;QACnC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,6BAA6B,EAAE;QACpD,8BAA8B;SAC/B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,yCAAyC;QACvC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,iCAAiC,EAAE;QACxD,8BAA8B;SAC/B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,OAAO,iCAAkC,SAAQ,qBAAqB;IACjE,UAAU;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the Cooktop class.
|
|
3
|
+
* @file src/devices/cooktop.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @created 2025-05-25
|
|
6
|
+
* @version 1.1.0
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
import { Semtag } from '@matter/types';
|
|
24
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
25
|
+
export declare class Cooktop extends MatterbridgeEndpoint {
|
|
26
|
+
/**
|
|
27
|
+
* Creates an instance of the Cooktop class.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} name - The name of the cooktop.
|
|
30
|
+
* @param {string} serial - The serial number of the cooktop.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* 13.8 A cooktop is a cooking surface that heats food either by transferring currents from an electromagnetic
|
|
34
|
+
* field located below the glass surface directly to the magnetic induction cookware placed
|
|
35
|
+
* above or through traditional gas or electric burners.
|
|
36
|
+
*
|
|
37
|
+
* 13.8.4 A Cooktop SHALL be composed of zero or more endpoints with the Cook Surface device type.
|
|
38
|
+
* An Cooktop is always defined via endpoint composition.
|
|
39
|
+
* - Use `addSurface` to add one or more surfaces to the cooktop.
|
|
40
|
+
*/
|
|
41
|
+
constructor(name: string, serial: string);
|
|
42
|
+
/**
|
|
43
|
+
* Adds a surface to the cooktop.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} name - The name of the surface.
|
|
46
|
+
* @param {Semtag[]} tagList - The tagList associated with the surface.
|
|
47
|
+
* @param {number} selectedTemperatureLevel - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 2 (which corresponds to 'Level 3').
|
|
48
|
+
* @param {string[]} supportedTemperatureLevels - The list of supported temperature levels for the surface. Defaults to ['Level 1', 'Level 2', 'Level 3', 'Level 4', 'Level 5'].
|
|
49
|
+
*
|
|
50
|
+
* @returns {MatterbridgeEndpoint} The MatterbridgeEndpoint instance representing the surface.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* 13.7 A Cook Surface device type represents a heating object on a cooktop or other similar device. It
|
|
54
|
+
* SHALL only be used when composed as part of another device type.
|
|
55
|
+
*
|
|
56
|
+
* The OffOnly feature is required for the On/Off cluster in this device type due to safety requirements.
|
|
57
|
+
* TemperatureLevel is the only valid temperature control mode.
|
|
58
|
+
*/
|
|
59
|
+
addSurface(name: string, tagList: Semtag[], selectedTemperatureLevel?: number, supportedTemperatureLevels?: string[]): MatterbridgeEndpoint;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=cooktop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cooktop.d.ts","sourceRoot":"","sources":["../../src/devices/cooktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIlE,qBAAa,OAAQ,SAAQ,oBAAoB;IAC/C;;;;;;;;;;;;;;OAcG;gBACS,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IASxC;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,wBAAwB,GAAE,MAAU,EACpC,0BAA0B,GAAE,MAAM,EAA4D,GAC7F,oBAAoB;CAQxB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the Cooktop class.
|
|
3
|
+
* @file src/devices/cooktop.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @created 2025-05-25
|
|
6
|
+
* @version 1.1.0
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
// Matterbridge
|
|
24
|
+
import { cookSurface, cooktop, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
25
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
26
|
+
import { createLevelTemperatureControlClusterServer } from './temperatureControl.js';
|
|
27
|
+
export class Cooktop extends MatterbridgeEndpoint {
|
|
28
|
+
/**
|
|
29
|
+
* Creates an instance of the Cooktop class.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} name - The name of the cooktop.
|
|
32
|
+
* @param {string} serial - The serial number of the cooktop.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* 13.8 A cooktop is a cooking surface that heats food either by transferring currents from an electromagnetic
|
|
36
|
+
* field located below the glass surface directly to the magnetic induction cookware placed
|
|
37
|
+
* above or through traditional gas or electric burners.
|
|
38
|
+
*
|
|
39
|
+
* 13.8.4 A Cooktop SHALL be composed of zero or more endpoints with the Cook Surface device type.
|
|
40
|
+
* An Cooktop is always defined via endpoint composition.
|
|
41
|
+
* - Use `addSurface` to add one or more surfaces to the cooktop.
|
|
42
|
+
*/
|
|
43
|
+
constructor(name, serial) {
|
|
44
|
+
super([cooktop, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
|
|
45
|
+
this.createDefaultIdentifyClusterServer();
|
|
46
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Cooktop');
|
|
47
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
48
|
+
this.createOffOnlyOnOffClusterServer(true);
|
|
49
|
+
this.addFixedLabel('composed', 'Cooktop');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Adds a surface to the cooktop.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} name - The name of the surface.
|
|
55
|
+
* @param {Semtag[]} tagList - The tagList associated with the surface.
|
|
56
|
+
* @param {number} selectedTemperatureLevel - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 2 (which corresponds to 'Level 3').
|
|
57
|
+
* @param {string[]} supportedTemperatureLevels - The list of supported temperature levels for the surface. Defaults to ['Level 1', 'Level 2', 'Level 3', 'Level 4', 'Level 5'].
|
|
58
|
+
*
|
|
59
|
+
* @returns {MatterbridgeEndpoint} The MatterbridgeEndpoint instance representing the surface.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* 13.7 A Cook Surface device type represents a heating object on a cooktop or other similar device. It
|
|
63
|
+
* SHALL only be used when composed as part of another device type.
|
|
64
|
+
*
|
|
65
|
+
* The OffOnly feature is required for the On/Off cluster in this device type due to safety requirements.
|
|
66
|
+
* TemperatureLevel is the only valid temperature control mode.
|
|
67
|
+
*/
|
|
68
|
+
addSurface(name, tagList, selectedTemperatureLevel = 2, supportedTemperatureLevels = ['Level 1', 'Level 2', 'Level 3', 'Level 4', 'Level 5']) {
|
|
69
|
+
const surface = this.addChildDeviceType(name, cookSurface, { tagList }, true);
|
|
70
|
+
surface.log.logName = name;
|
|
71
|
+
createLevelTemperatureControlClusterServer(surface, selectedTemperatureLevel, supportedTemperatureLevels);
|
|
72
|
+
surface.createDefaultTemperatureMeasurementClusterServer(2000);
|
|
73
|
+
surface.createOffOnlyOnOffClusterServer(true);
|
|
74
|
+
return surface;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=cooktop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cooktop.js","sourceRoot":"","sources":["../../src/devices/cooktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,0CAA0C,EAAE,MAAM,yBAAyB,CAAC;AAErF,MAAM,OAAO,OAAQ,SAAQ,oBAAoB;IAC/C;;;;;;;;;;;;;;OAcG;IACH,YAAY,IAAY,EAAE,MAAc;QACtC,KAAK,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACnG,IAAI,CAAC,kCAAkC,EAAE,CAAC;QAC1C,IAAI,CAAC,0CAA0C,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACzG,IAAI,CAAC,0CAA0C,EAAE,CAAC;QAClD,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CACR,IA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