matterbridge 3.3.6 → 3.3.7-dev-20251102-c85d574
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/CHANGELOG.md +17 -0
- package/dist/broadcastServer.js +1 -92
- package/dist/broadcastServerTypes.js +0 -24
- package/dist/cli.js +1 -97
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.js +0 -38
- package/dist/clusters/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -24
- package/dist/deviceManager.js +1 -124
- package/dist/devices/airConditioner.js +0 -57
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/cooktop.js +0 -55
- package/dist/devices/dishwasher.js +0 -57
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.js +0 -5
- package/dist/devices/extractorHood.js +0 -42
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.js +3 -62
- package/dist/devices/laundryWasher.js +4 -70
- package/dist/devices/microwaveOven.js +5 -88
- package/dist/devices/oven.js +0 -85
- package/dist/devices/refrigerator.js +0 -102
- package/dist/devices/roboticVacuumCleaner.js +9 -100
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/speaker.js +0 -84
- package/dist/devices/temperatureControl.js +3 -24
- package/dist/devices/waterHeater.js +2 -82
- package/dist/dgram/coap.js +13 -126
- package/dist/dgram/dgram.js +2 -114
- package/dist/dgram/mb_coap.js +3 -41
- package/dist/dgram/mb_mdns.js +15 -80
- package/dist/dgram/mdns.js +137 -299
- package/dist/dgram/multicast.js +1 -62
- package/dist/dgram/unicast.js +0 -54
- package/dist/frontend.js +34 -431
- package/dist/frontendTypes.js +0 -45
- package/dist/helpers.js +0 -53
- package/dist/index.js +0 -25
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -3
- package/dist/matter/types.js +0 -3
- package/dist/matterbridge.js +46 -828
- package/dist/matterbridgeAccessoryPlatform.js +0 -37
- package/dist/matterbridgeBehaviors.js +5 -68
- package/dist/matterbridgeDeviceTypes.js +17 -638
- package/dist/matterbridgeDynamicPlatform.js +0 -37
- package/dist/matterbridgeEndpoint.js +52 -1408
- package/dist/matterbridgeEndpointHelpers.js +19 -464
- package/dist/matterbridgePlatform.js +1 -341
- package/dist/matterbridgeTypes.js +0 -26
- package/dist/pluginManager.js +3 -319
- package/dist/shelly.js +7 -168
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -69
- package/dist/utils/colorUtils.js +2 -97
- package/dist/utils/commandLine.js +0 -60
- package/dist/utils/copyDirectory.js +1 -38
- package/dist/utils/createDirectory.js +0 -33
- package/dist/utils/createZip.js +2 -47
- package/dist/utils/deepCopy.js +0 -39
- package/dist/utils/deepEqual.js +1 -72
- package/dist/utils/error.js +0 -41
- package/dist/utils/export.js +0 -1
- package/dist/utils/format.js +0 -49
- package/dist/utils/hex.js +0 -124
- package/dist/utils/inspector.js +1 -69
- package/dist/utils/isvalid.js +0 -101
- package/dist/utils/jestHelpers.js +3 -153
- package/dist/utils/network.js +5 -96
- package/dist/utils/spawn.js +0 -71
- package/dist/utils/tracker.js +1 -64
- package/dist/utils/wait.js +8 -60
- package/frontend/build/assets/index.js +4 -4
- package/frontend/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -2
- package/dist/broadcastServer.d.ts +0 -112
- package/dist/broadcastServer.d.ts.map +0 -1
- package/dist/broadcastServer.js.map +0 -1
- package/dist/broadcastServerTypes.d.ts +0 -803
- package/dist/broadcastServerTypes.d.ts.map +0 -1
- package/dist/broadcastServerTypes.js.map +0 -1
- package/dist/cli.d.ts +0 -30
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts +0 -50
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.js.map +0 -1
- package/dist/cliHistory.d.ts +0 -48
- package/dist/cliHistory.d.ts.map +0 -1
- package/dist/cliHistory.js.map +0 -1
- package/dist/clusters/export.d.ts +0 -2
- package/dist/clusters/export.d.ts.map +0 -1
- package/dist/clusters/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -28
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -117
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/airConditioner.d.ts +0 -98
- package/dist/devices/airConditioner.d.ts.map +0 -1
- package/dist/devices/airConditioner.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts +0 -48
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/cooktop.d.ts +0 -60
- package/dist/devices/cooktop.d.ts.map +0 -1
- package/dist/devices/cooktop.js.map +0 -1
- package/dist/devices/dishwasher.d.ts +0 -71
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts +0 -76
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts +0 -17
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/extractorHood.d.ts +0 -46
- package/dist/devices/extractorHood.d.ts.map +0 -1
- package/dist/devices/extractorHood.js.map +0 -1
- package/dist/devices/heatPump.d.ts +0 -47
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts +0 -67
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts +0 -81
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/microwaveOven.d.ts +0 -168
- package/dist/devices/microwaveOven.d.ts.map +0 -1
- package/dist/devices/microwaveOven.js.map +0 -1
- package/dist/devices/oven.d.ts +0 -105
- package/dist/devices/oven.d.ts.map +0 -1
- package/dist/devices/oven.js.map +0 -1
- package/dist/devices/refrigerator.d.ts +0 -118
- package/dist/devices/refrigerator.d.ts.map +0 -1
- package/dist/devices/refrigerator.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts +0 -40
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/speaker.d.ts +0 -87
- package/dist/devices/speaker.d.ts.map +0 -1
- package/dist/devices/speaker.js.map +0 -1
- package/dist/devices/temperatureControl.d.ts +0 -166
- package/dist/devices/temperatureControl.d.ts.map +0 -1
- package/dist/devices/temperatureControl.js.map +0 -1
- package/dist/devices/waterHeater.d.ts +0 -111
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/dgram/coap.d.ts +0 -205
- package/dist/dgram/coap.d.ts.map +0 -1
- package/dist/dgram/coap.js.map +0 -1
- package/dist/dgram/dgram.d.ts +0 -141
- package/dist/dgram/dgram.d.ts.map +0 -1
- package/dist/dgram/dgram.js.map +0 -1
- package/dist/dgram/mb_coap.d.ts +0 -24
- package/dist/dgram/mb_coap.d.ts.map +0 -1
- package/dist/dgram/mb_coap.js.map +0 -1
- package/dist/dgram/mb_mdns.d.ts +0 -24
- package/dist/dgram/mb_mdns.d.ts.map +0 -1
- package/dist/dgram/mb_mdns.js.map +0 -1
- package/dist/dgram/mdns.d.ts +0 -290
- package/dist/dgram/mdns.d.ts.map +0 -1
- package/dist/dgram/mdns.js.map +0 -1
- package/dist/dgram/multicast.d.ts +0 -67
- package/dist/dgram/multicast.d.ts.map +0 -1
- package/dist/dgram/multicast.js.map +0 -1
- package/dist/dgram/unicast.d.ts +0 -56
- package/dist/dgram/unicast.d.ts.map +0 -1
- package/dist/dgram/unicast.js.map +0 -1
- package/dist/frontend.d.ts +0 -236
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/frontendTypes.d.ts +0 -529
- package/dist/frontendTypes.d.ts.map +0 -1
- package/dist/frontendTypes.js.map +0 -1
- package/dist/helpers.d.ts +0 -48
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -33
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -476
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -2404
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -770
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -1556
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -758
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -402
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -226
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -347
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -174
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -75
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -101
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -66
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -33
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -34
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -39
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -32
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -54
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/error.d.ts +0 -44
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/export.d.ts +0 -13
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/format.d.ts +0 -53
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -89
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/inspector.d.ts +0 -87
- package/dist/utils/inspector.d.ts.map +0 -1
- package/dist/utils/inspector.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -103
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/jestHelpers.d.ts +0 -139
- package/dist/utils/jestHelpers.d.ts.map +0 -1
- package/dist/utils/jestHelpers.js.map +0 -1
- package/dist/utils/network.d.ts +0 -101
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -35
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/tracker.d.ts +0 -108
- package/dist/utils/tracker.d.ts.map +0 -1
- package/dist/utils/tracker.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -54
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
package/dist/devices/oven.js
CHANGED
|
@@ -1,49 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the Oven class.
|
|
3
|
-
* @file src/devices/oven.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
1
|
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
24
2
|
import { OvenMode } from '@matter/types/clusters/oven-mode';
|
|
25
3
|
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
26
4
|
import { OvenModeServer } from '@matter/node/behaviors/oven-mode';
|
|
27
5
|
import { OvenCavityOperationalStateServer } from '@matter/node/behaviors/oven-cavity-operational-state';
|
|
28
|
-
// Matterbridge
|
|
29
6
|
import { oven, powerSource, temperatureControlledCabinetHeater } from '../matterbridgeDeviceTypes.js';
|
|
30
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
31
8
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
32
9
|
import { createLevelTemperatureControlClusterServer } from './temperatureControl.js';
|
|
33
10
|
export class Oven extends MatterbridgeEndpoint {
|
|
34
|
-
/**
|
|
35
|
-
* Creates an instance of the Oven class.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} name - The name of the oven.
|
|
38
|
-
* @param {string} serial - The serial number of the oven.
|
|
39
|
-
*
|
|
40
|
-
* @remarks
|
|
41
|
-
* 13.9 An oven represents a device that contains one or more cabinets, and optionally a single cooktop,
|
|
42
|
-
* that are all capable of heating food. Examples of consumer products implementing this device type
|
|
43
|
-
* include ovens, wall ovens, convection ovens, etc.
|
|
44
|
-
* An oven is always defined via endpoint composition.
|
|
45
|
-
* - Use `addCabinet` to add one or more cabinets to the oven.
|
|
46
|
-
*/
|
|
47
11
|
constructor(name, serial) {
|
|
48
12
|
super([oven, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
49
13
|
this.createDefaultIdentifyClusterServer();
|
|
@@ -51,25 +15,6 @@ export class Oven extends MatterbridgeEndpoint {
|
|
|
51
15
|
this.createDefaultPowerSourceWiredClusterServer();
|
|
52
16
|
this.addFixedLabel('composed', 'Oven');
|
|
53
17
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Adds a Temperature Controlled Cabinet Heater to the oven.
|
|
56
|
-
*
|
|
57
|
-
* @param {string} name - The name of the cabinet.
|
|
58
|
-
* @param {Semtag[]} tagList - The tagList associated with the cabinet.
|
|
59
|
-
* @param {number} currentMode - The current mode of the cabinet. Defaults to 2 (which corresponds to 'Convection').
|
|
60
|
-
* @param {OvenMode.ModeOption[]} supportedModes - The supported modes of the cabinet. Defaults to a set of common oven modes.
|
|
61
|
-
* @param {number} selectedTemperatureLevel - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 1 (which corresponds to 'Warm').
|
|
62
|
-
* @param {string[]} supportedTemperatureLevels - The list of supported temperature levels for the cabinet. Defaults to ['Defrost', '180°', '190°', '200°', '250°', '300°'].
|
|
63
|
-
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state of the cabinet. Defaults to Stopped.
|
|
64
|
-
* @param {number} [currentPhase] - Optional: the current phase of the cabinet.
|
|
65
|
-
* @param {string[]} [phaseList] - Optional: the list of phases for the cabinet.
|
|
66
|
-
*
|
|
67
|
-
* @returns {MatterbridgeEndpoint} The MatterbridgeEndpoint instance representing the cabinet.
|
|
68
|
-
*
|
|
69
|
-
* @remarks
|
|
70
|
-
* 13.4.1 A Temperature Controlled Cabinet Heater is a device that provides a heated space for warming food.
|
|
71
|
-
* It is typically installed within an oven and can be used in conjunction with other heating elements.
|
|
72
|
-
*/
|
|
73
18
|
addCabinet(name, tagList, currentMode = 2, supportedModes = [
|
|
74
19
|
{ label: 'Bake', mode: 1, modeTags: [{ value: OvenMode.ModeTag.Bake }] },
|
|
75
20
|
{ label: 'Convection', mode: 2, modeTags: [{ value: OvenMode.ModeTag.Convection }] },
|
|
@@ -91,19 +36,6 @@ export class Oven extends MatterbridgeEndpoint {
|
|
|
91
36
|
this.createDefaultOvenCavityOperationalStateClusterServer(cabinet, operationalState, currentPhase, phaseList);
|
|
92
37
|
return cabinet;
|
|
93
38
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Creates a default OvenMode Cluster Server.
|
|
96
|
-
*
|
|
97
|
-
* @param {MatterbridgeEndpoint} endpoint - The Matterbridge endpoint instance.
|
|
98
|
-
* @param {number} currentMode - The current mode of the oven.
|
|
99
|
-
* @param {OvenMode.ModeOption[]} supportedModes - The supported modes of the oven.
|
|
100
|
-
*
|
|
101
|
-
* @returns {MatterbridgeEndpoint} The current MatterbridgeEndpoint instance for chaining.
|
|
102
|
-
*
|
|
103
|
-
* @remarks
|
|
104
|
-
* - supportedModes is a fixed attribute. It cannot be changed at runtime.
|
|
105
|
-
* - currentMode persists across reboots.
|
|
106
|
-
*/
|
|
107
39
|
createDefaultOvenModeClusterServer(endpoint, currentMode, supportedModes) {
|
|
108
40
|
endpoint.behaviors.require(MatterbridgeOvenModeServer, {
|
|
109
41
|
supportedModes,
|
|
@@ -111,20 +43,6 @@ export class Oven extends MatterbridgeEndpoint {
|
|
|
111
43
|
});
|
|
112
44
|
return endpoint;
|
|
113
45
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Creates a default Oven Cavity Operational State Cluster Server.
|
|
116
|
-
*
|
|
117
|
-
* @param {MatterbridgeEndpoint} endpoint - The Matterbridge endpoint instance.
|
|
118
|
-
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
|
|
119
|
-
* @param {number} [currentPhase] - The current phase of the oven cavity.
|
|
120
|
-
* @param {string[]} [phaseList] - The list of phases for the oven cavity.
|
|
121
|
-
*
|
|
122
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
123
|
-
*
|
|
124
|
-
* @remarks
|
|
125
|
-
* For this derived cluster, only these pre-defined strings may be used in the PhaseList attribute:
|
|
126
|
-
* "pre-heating", "pre-heated", and "cooling down".
|
|
127
|
-
*/
|
|
128
46
|
createDefaultOvenCavityOperationalStateClusterServer(endpoint, operationalState = OperationalState.OperationalStateEnum.Stopped, currentPhase, phaseList) {
|
|
129
47
|
endpoint.behaviors.require(MatterbridgeOvenCavityOperationalStateServer, {
|
|
130
48
|
phaseList: phaseList || null,
|
|
@@ -140,7 +58,6 @@ export class Oven extends MatterbridgeEndpoint {
|
|
|
140
58
|
return endpoint;
|
|
141
59
|
}
|
|
142
60
|
}
|
|
143
|
-
// Server for OvenMode
|
|
144
61
|
export class MatterbridgeOvenModeServer extends OvenModeServer {
|
|
145
62
|
initialize() {
|
|
146
63
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -160,7 +77,6 @@ export class MatterbridgeOvenModeServer extends OvenModeServer {
|
|
|
160
77
|
}
|
|
161
78
|
}
|
|
162
79
|
}
|
|
163
|
-
// Server for OvenCavityOperationalState
|
|
164
80
|
export class MatterbridgeOvenCavityOperationalStateServer extends OvenCavityOperationalStateServer {
|
|
165
81
|
initialize() {
|
|
166
82
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -187,4 +103,3 @@ export class MatterbridgeOvenCavityOperationalStateServer extends OvenCavityOper
|
|
|
187
103
|
};
|
|
188
104
|
}
|
|
189
105
|
}
|
|
190
|
-
//# sourceMappingURL=oven.js.map
|
|
@@ -1,48 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the Refrigerator class.
|
|
3
|
-
* @file src/devices/refrigerator.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
1
|
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
24
2
|
import { RefrigeratorAndTemperatureControlledCabinetMode } from '@matter/types/clusters/refrigerator-and-temperature-controlled-cabinet-mode';
|
|
25
3
|
import { RefrigeratorAndTemperatureControlledCabinetModeServer } from '@matter/node/behaviors/refrigerator-and-temperature-controlled-cabinet-mode';
|
|
26
4
|
import { RefrigeratorAlarmServer } from '@matter/node/behaviors/refrigerator-alarm';
|
|
27
|
-
// Matterbridge
|
|
28
5
|
import { powerSource, refrigerator, temperatureControlledCabinetCooler } from '../matterbridgeDeviceTypes.js';
|
|
29
6
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
30
7
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
31
8
|
import { createLevelTemperatureControlClusterServer } from './temperatureControl.js';
|
|
32
9
|
export class Refrigerator extends MatterbridgeEndpoint {
|
|
33
|
-
/**
|
|
34
|
-
* Creates an instance of the Refrigerator class.
|
|
35
|
-
*
|
|
36
|
-
* @param {string} name - The name of the refrigerator.
|
|
37
|
-
* @param {string} serial - The serial number of the refrigerator.
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* 13.2 A refrigerator represents a device that contains one or more cabinets that are capable of chilling or
|
|
41
|
-
* freezing food. Examples of consumer products that MAY make use of this device type include refrigerators,
|
|
42
|
-
* freezers, and wine coolers.
|
|
43
|
-
* A refrigerator is always defined via endpoint composition.
|
|
44
|
-
* - Use `addCabinet` to add one or more cabinets to the refrigerator.
|
|
45
|
-
*/
|
|
46
10
|
constructor(name, serial) {
|
|
47
11
|
super([refrigerator, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
48
12
|
this.createDefaultIdentifyClusterServer();
|
|
@@ -50,35 +14,6 @@ export class Refrigerator extends MatterbridgeEndpoint {
|
|
|
50
14
|
this.createDefaultPowerSourceWiredClusterServer();
|
|
51
15
|
this.addFixedLabel('composed', 'Refrigerator');
|
|
52
16
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Adds a Level Temperature Controlled Cabinet Cooler to the refrigerator.
|
|
55
|
-
*
|
|
56
|
-
* @param {string} name - The name of the cabinet.
|
|
57
|
-
* @param {Semtag[]} tagList - The tagList associated with the cabinet.
|
|
58
|
-
* @param {number} currentMode - The current mode of the cabinet. Defaults to 1 (which corresponds to 'Auto').
|
|
59
|
-
* @param {RefrigeratorAndTemperatureControlledCabinetMode.ModeOption[]} supportedModes - The supported modes for the cabinet. Defaults to 'Auto', 'RapidCool', and 'RapidFreeze'.
|
|
60
|
-
* @param {number} selectedTemperatureLevel - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 2 (which corresponds to 'Level 3').
|
|
61
|
-
* @param {string[]} supportedTemperatureLevels - The list of supported temperature levels for the cabinet. Defaults to ['Level 1', 'Level 2', 'Level 3', 'Level 4', 'Level 5'].
|
|
62
|
-
* @param {number} currentTemperature - The current temperature of the cabinet in degrees Celsius. Defaults to 1000 (which corresponds to 10.00 degrees Celsius).
|
|
63
|
-
*
|
|
64
|
-
* @returns {MatterbridgeEndpoint} The MatterbridgeEndpoint instance representing the cabinet.
|
|
65
|
-
*
|
|
66
|
-
* @remarks
|
|
67
|
-
* 13.4.1 A Temperature Controlled Cabinet Cooler is a device that provides a cooled space for chilling food.
|
|
68
|
-
* It is typically installed within a refrigerator.
|
|
69
|
-
*
|
|
70
|
-
* Example usage with specific namespace tags:
|
|
71
|
-
* ```
|
|
72
|
-
* refrigerator.addCabinet('Refrigerator Top', [
|
|
73
|
-
* { mfgCode: null, namespaceId: PositionTag.Top.namespaceId, tag: PositionTag.Top.tag, label: 'Refrigerator Top' },
|
|
74
|
-
* { mfgCode: null, namespaceId: RefrigeratorTag.Refrigerator.namespaceId, tag: RefrigeratorTag.Refrigerator.tag, label: RefrigeratorTag.Refrigerator.label },
|
|
75
|
-
* ]);
|
|
76
|
-
* refrigerator.addCabinet('Freezer Bottom', [
|
|
77
|
-
* { mfgCode: null, namespaceId: PositionTag.Bottom.namespaceId, tag: PositionTag.Bottom.tag, label: 'Freezer Bottom' },
|
|
78
|
-
* { mfgCode: null, namespaceId: RefrigeratorTag.Freezer.namespaceId, tag: RefrigeratorTag.Freezer.tag, label: RefrigeratorTag.Freezer.label },
|
|
79
|
-
* ]);
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
17
|
addCabinet(name, tagList, currentMode = 1, supportedModes = [
|
|
83
18
|
{ label: 'Auto', mode: 1, modeTags: [{ value: RefrigeratorAndTemperatureControlledCabinetMode.ModeTag.Auto }] },
|
|
84
19
|
{ label: 'RapidCool', mode: 2, modeTags: [{ value: RefrigeratorAndTemperatureControlledCabinetMode.ModeTag.RapidCool }] },
|
|
@@ -93,19 +28,6 @@ export class Refrigerator extends MatterbridgeEndpoint {
|
|
|
93
28
|
cabinet.createDefaultTemperatureMeasurementClusterServer(currentTemperature);
|
|
94
29
|
return cabinet;
|
|
95
30
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Creates a default RefrigeratorAndTemperatureControlledCabinetMode Cluster Server.
|
|
98
|
-
*
|
|
99
|
-
* @param {MatterbridgeEndpoint} endpoint - The Matterbridge endpoint instance.
|
|
100
|
-
* @param {number} currentMode - The current mode of the oven.
|
|
101
|
-
* @param {RefrigeratorAndTemperatureControlledCabinetMode.ModeOption[]} supportedModes - The supported modes for the refrigerator and temperature controlled cabinet.
|
|
102
|
-
*
|
|
103
|
-
* @returns {MatterbridgeEndpoint} The current MatterbridgeEndpoint instance for chaining.
|
|
104
|
-
*
|
|
105
|
-
* @remarks
|
|
106
|
-
* - supportedModes is a fixed attribute. It cannot be changed at runtime.
|
|
107
|
-
* - currentMode persists across reboots.
|
|
108
|
-
*/
|
|
109
31
|
createDefaultRefrigeratorAndTemperatureControlledCabinetModeClusterServer(endpoint, currentMode, supportedModes) {
|
|
110
32
|
endpoint.behaviors.require(MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer, {
|
|
111
33
|
supportedModes,
|
|
@@ -113,14 +35,6 @@ export class Refrigerator extends MatterbridgeEndpoint {
|
|
|
113
35
|
});
|
|
114
36
|
return endpoint;
|
|
115
37
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Creates a default RefrigeratorAlarm Cluster Server.
|
|
118
|
-
*
|
|
119
|
-
* @param {MatterbridgeEndpoint} endpoint - The Matterbridge endpoint instance.
|
|
120
|
-
* @param {boolean} doorOpen - Indicates if the refrigerator door is open.
|
|
121
|
-
*
|
|
122
|
-
* @returns {MatterbridgeEndpoint} The updated MatterbridgeEndpoint instance.
|
|
123
|
-
*/
|
|
124
38
|
createDefaultRefrigeratorAlarmClusterServer(endpoint, doorOpen = false) {
|
|
125
39
|
endpoint.behaviors.require(RefrigeratorAlarmServer, {
|
|
126
40
|
mask: { doorOpen: true },
|
|
@@ -129,13 +43,6 @@ export class Refrigerator extends MatterbridgeEndpoint {
|
|
|
129
43
|
});
|
|
130
44
|
return endpoint;
|
|
131
45
|
}
|
|
132
|
-
/**
|
|
133
|
-
* Sets the door open state for a specific cabinet.
|
|
134
|
-
*
|
|
135
|
-
* @param {string} cabinetName - The name of the cabinet.
|
|
136
|
-
* @param {boolean} doorOpen - Indicates if the door is open.
|
|
137
|
-
* @returns {MatterbridgeEndpoint | undefined} The updated MatterbridgeEndpoint instance or undefined if not found.
|
|
138
|
-
*/
|
|
139
46
|
async setDoorOpenState(cabinetName, doorOpen) {
|
|
140
47
|
const endpoint = this.getChildEndpointByName(cabinetName);
|
|
141
48
|
if (endpoint) {
|
|
@@ -143,13 +50,6 @@ export class Refrigerator extends MatterbridgeEndpoint {
|
|
|
143
50
|
return endpoint;
|
|
144
51
|
}
|
|
145
52
|
}
|
|
146
|
-
/**
|
|
147
|
-
* Triggers the notify event for door open state on a specific cabinet.
|
|
148
|
-
*
|
|
149
|
-
* @param {string} cabinetName - The name of the cabinet.
|
|
150
|
-
* @param {boolean} doorOpen - Indicates if the door is open.
|
|
151
|
-
* @returns {MatterbridgeEndpoint | undefined} The updated MatterbridgeEndpoint instance or undefined if not found.
|
|
152
|
-
*/
|
|
153
53
|
async triggerDoorOpenState(cabinetName, doorOpen) {
|
|
154
54
|
const endpoint = this.getChildEndpointByName(cabinetName);
|
|
155
55
|
if (endpoint) {
|
|
@@ -163,7 +63,6 @@ export class Refrigerator extends MatterbridgeEndpoint {
|
|
|
163
63
|
}
|
|
164
64
|
}
|
|
165
65
|
}
|
|
166
|
-
// Server for RefrigeratorAndTemperatureControlledCabinetMode
|
|
167
66
|
export class MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer extends RefrigeratorAndTemperatureControlledCabinetModeServer {
|
|
168
67
|
initialize() {
|
|
169
68
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -183,4 +82,3 @@ export class MatterbridgeRefrigeratorAndTemperatureControlledCabinetModeServer e
|
|
|
183
82
|
}
|
|
184
83
|
}
|
|
185
84
|
}
|
|
186
|
-
//# sourceMappingURL=refrigerator.js.map
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the RoboticVacuumCleaner class.
|
|
3
|
-
* @file src/devices/roboticVacuumCleaner.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-05-01
|
|
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
|
-
// Matter.js
|
|
24
1
|
import { AreaNamespaceTag } from '@matter/node';
|
|
25
2
|
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
26
3
|
import { RvcRunMode } from '@matter/types/clusters/rvc-run-mode';
|
|
@@ -32,30 +9,10 @@ import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
|
32
9
|
import { RvcRunModeServer } from '@matter/node/behaviors/rvc-run-mode';
|
|
33
10
|
import { RvcOperationalStateServer } from '@matter/node/behaviors/rvc-operational-state';
|
|
34
11
|
import { RvcCleanModeServer } from '@matter/node/behaviors/rvc-clean-mode';
|
|
35
|
-
// Matterbridge
|
|
36
12
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
37
13
|
import { powerSource, roboticVacuumCleaner } from '../matterbridgeDeviceTypes.js';
|
|
38
14
|
import { MatterbridgeServer, MatterbridgeServiceAreaServer } from '../matterbridgeBehaviors.js';
|
|
39
15
|
export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
40
|
-
/**
|
|
41
|
-
* Creates an instance of the RoboticVacuumCleaner class.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} name - The name of the robotic vacuum cleaner.
|
|
44
|
-
* @param {string} serial - The serial number of the robotic vacuum cleaner.
|
|
45
|
-
* @param {'server' | 'matter' | undefined} [mode] - The mode of the robotic vacuum cleaner. Defaults to undefined. Use 'server' or 'matter' if you want Apple Home compatibility.
|
|
46
|
-
* @param {number} [currentRunMode] - The current run mode of the robotic vacuum cleaner. Defaults to 1 (Idle).
|
|
47
|
-
* @param {RvcRunMode.ModeOption[]} [supportedRunModes] - The supported run modes for the robotic vacuum cleaner. Defaults to a predefined set of modes.
|
|
48
|
-
* @param {number} [currentCleanMode] - The current clean mode of the robotic vacuum cleaner. Defaults to 1 (Vacuum).
|
|
49
|
-
* @param {RvcCleanMode.ModeOption[]} [supportedCleanModes] - The supported clean modes for the robotic vacuum cleaner. Defaults to a predefined set of modes.
|
|
50
|
-
* @param {number | null} [currentPhase] - The current phase of the robotic vacuum cleaner. Defaults to null.
|
|
51
|
-
* @param {string[] | null} [phaseList] - The list of phases for the robotic vacuum cleaner. Defaults to null.
|
|
52
|
-
* @param {RvcOperationalState.OperationalState} [operationalState] - The current operational state of the robotic vacuum cleaner. Defaults to Docked.
|
|
53
|
-
* @param {RvcOperationalState.OperationalStateStruct[]} [operationalStateList] - The list of operational states for the robotic vacuum cleaner. Defaults to a predefined set of states.
|
|
54
|
-
* @param {ServiceArea.Area[]} [supportedAreas] - The supported areas for the robotic vacuum cleaner. Defaults to a predefined set of areas.
|
|
55
|
-
* @param {number[]} [selectedAreas] - The selected areas for the robotic vacuum cleaner. Defaults to an empty array (all areas allowed).
|
|
56
|
-
* @param {number} [currentArea] - The current area of the robotic vacuum cleaner. Defaults to 1 (Living).
|
|
57
|
-
* @param {ServiceArea.Map[]} [supportedMaps] - The supported maps for the robotic vacuum cleaner. Defaults to empty list.
|
|
58
|
-
*/
|
|
59
16
|
constructor(name, serial, mode = undefined, currentRunMode, supportedRunModes, currentCleanMode, supportedCleanModes, currentPhase = null, phaseList = null, operationalState, operationalStateList, supportedAreas, selectedAreas, currentArea, supportedMaps) {
|
|
60
17
|
super([roboticVacuumCleaner, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, mode }, true);
|
|
61
18
|
this.createDefaultIdentifyClusterServer()
|
|
@@ -66,17 +23,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
66
23
|
.createDefaultRvcOperationalStateClusterServer(phaseList, currentPhase, operationalStateList, operationalState)
|
|
67
24
|
.createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea, supportedMaps);
|
|
68
25
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Creates a default RvcRunMode Cluster Server.
|
|
71
|
-
*
|
|
72
|
-
* @param {number} [currentMode] - The current mode of the RvcRunMode cluster. Defaults to 1 (Idle).
|
|
73
|
-
* @param {RvcRunMode.ModeOption[]} [supportedModes] - The supported modes for the RvcRunMode cluster. Defaults to a predefined set of modes.
|
|
74
|
-
*
|
|
75
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* - supportedModes is a fixed attribute that defines the run modes available for the robotic vacuum cleaner.
|
|
79
|
-
*/
|
|
80
26
|
createDefaultRvcRunModeClusterServer(currentMode, supportedModes) {
|
|
81
27
|
this.behaviors.require(MatterbridgeRvcRunModeServer, {
|
|
82
28
|
supportedModes: supportedModes ?? [
|
|
@@ -89,17 +35,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
89
35
|
});
|
|
90
36
|
return this;
|
|
91
37
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Creates a default RvcCleanMode Cluster Server.
|
|
94
|
-
*
|
|
95
|
-
* @param {number} [currentMode] - The current mode of the RvcCleanMode cluster. Defaults to 1 (Vacuum).
|
|
96
|
-
* @param {RvcCleanMode.ModeOption[]} [supportedModes] - The supported modes for the RvcCleanMode cluster. Defaults to a predefined set of modes.
|
|
97
|
-
*
|
|
98
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
99
|
-
*
|
|
100
|
-
* @remarks
|
|
101
|
-
* - supportedModes is a fixed attribute that defines the clean modes available for the robotic vacuum cleaner.
|
|
102
|
-
*/
|
|
103
38
|
createDefaultRvcCleanModeClusterServer(currentMode, supportedModes) {
|
|
104
39
|
this.behaviors.require(MatterbridgeRvcCleanModeServer, {
|
|
105
40
|
supportedModes: supportedModes ?? [
|
|
@@ -111,15 +46,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
111
46
|
});
|
|
112
47
|
return this;
|
|
113
48
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Creates a default ServiceArea Cluster Server.
|
|
116
|
-
*
|
|
117
|
-
* @param {ServiceArea.Area[]} [supportedAreas] - The supported areas for the ServiceArea cluster. Defaults to a predefined set of areas.
|
|
118
|
-
* @param {number[]} [selectedAreas] - The selected areas for the ServiceArea cluster. Defaults to an empty array (all areas allowed).
|
|
119
|
-
* @param {number} [currentArea] - The current areaId (not the index in the array!) of the ServiceArea cluster. Defaults to 1 (Living).
|
|
120
|
-
* @param {ServiceArea.Map[]} [supportedMaps] - The supported maps for the robotic vacuum cleaner. Defaults empty list.
|
|
121
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
122
|
-
*/
|
|
123
49
|
createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea, supportedMaps) {
|
|
124
50
|
this.behaviors.require(MatterbridgeServiceAreaServer.with(ServiceArea.Feature.Maps), {
|
|
125
51
|
supportedAreas: supportedAreas ?? [
|
|
@@ -144,28 +70,13 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
144
70
|
areaInfo: { locationInfo: { locationName: 'Bathroom', floorNumber: 1, areaType: AreaNamespaceTag.Bathroom.tag }, landmarkInfo: null },
|
|
145
71
|
},
|
|
146
72
|
],
|
|
147
|
-
selectedAreas: selectedAreas ?? [],
|
|
148
|
-
currentArea: currentArea ?? 1,
|
|
149
|
-
supportedMaps: supportedMaps ?? [],
|
|
150
|
-
/**
|
|
151
|
-
* Indicates the estimated Epoch time for completing operating at the area indicated by the CurrentArea attribute, in seconds. A value of 0 means that the operation has completed.
|
|
152
|
-
* When this attribute is null, that represents that there is no time currently defined until operation completion.
|
|
153
|
-
* This attribute SHALL be null if the CurrentArea attribute is null.
|
|
154
|
-
*/
|
|
73
|
+
selectedAreas: selectedAreas ?? [],
|
|
74
|
+
currentArea: currentArea ?? 1,
|
|
75
|
+
supportedMaps: supportedMaps ?? [],
|
|
155
76
|
estimatedEndTime: null,
|
|
156
77
|
});
|
|
157
78
|
return this;
|
|
158
79
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Creates a default RvcOperationalState Cluster Server.
|
|
161
|
-
*
|
|
162
|
-
* @param {string[] | null} [phaseList] - The list of phases for the RvcOperationalState cluster. Defaults to null.
|
|
163
|
-
* @param {number | null} [currentPhase] - The current phase (the index of the phaseList) of the RvcOperationalState cluster. Defaults to null.
|
|
164
|
-
* @param {RvcOperationalState.OperationalStateStruct[]} [operationalStateList] - The list of operational states for the RvcOperationalState cluster. Defaults to a predefined set of states.
|
|
165
|
-
* @param {RvcOperationalState.OperationalState} [operationalState] - The current operationalStateId of the RvcOperationalState cluster. Defaults to Docked.
|
|
166
|
-
* @param {RvcOperationalState.ErrorStateStruct} [operationalError] - The current operational error of the RvcOperationalState cluster. Defaults to NoError.
|
|
167
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
168
|
-
*/
|
|
169
80
|
createDefaultRvcOperationalStateClusterServer(phaseList = null, currentPhase = null, operationalStateList, operationalState, operationalError) {
|
|
170
81
|
this.behaviors.require(MatterbridgeRvcOperationalStateServer, {
|
|
171
82
|
phaseList,
|
|
@@ -175,9 +86,9 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
175
86
|
{ operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
|
|
176
87
|
{ operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
|
|
177
88
|
{ operationalStateId: RvcOperationalState.OperationalState.Error, operationalStateLabel: 'Error' },
|
|
178
|
-
{ operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
|
|
179
|
-
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
|
180
|
-
{ operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
|
|
89
|
+
{ operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
|
|
90
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
|
91
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
|
|
181
92
|
],
|
|
182
93
|
operationalState: operationalState ?? RvcOperationalState.OperationalState.Docked,
|
|
183
94
|
operationalError: operationalError ?? { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
|
|
@@ -232,7 +143,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
232
143
|
device.log.info(`Pause (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
233
144
|
device.commandHandler.executeHandler('pause', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
234
145
|
device.log.debug('MatterbridgeRvcOperationalStateServer: pause called setting operational state to Paused and currentMode to Idle');
|
|
235
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
146
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
236
147
|
this.state.operationalState = RvcOperationalState.OperationalState.Paused;
|
|
237
148
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
238
149
|
return {
|
|
@@ -244,7 +155,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
244
155
|
device.log.info(`Resume (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
245
156
|
device.commandHandler.executeHandler('resume', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
246
157
|
device.log.debug('MatterbridgeRvcOperationalStateServer: resume called setting operational state to Running and currentMode to Cleaning');
|
|
247
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
158
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
248
159
|
this.state.operationalState = RvcOperationalState.OperationalState.Running;
|
|
249
160
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
250
161
|
return {
|
|
@@ -252,12 +163,11 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
252
163
|
};
|
|
253
164
|
}
|
|
254
165
|
goHome() {
|
|
255
|
-
// const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
|
|
256
166
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
257
167
|
device.log.info(`GoHome (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
258
168
|
device.commandHandler.executeHandler('goHome', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
259
169
|
device.log.debug('MatterbridgeRvcOperationalStateServer: goHome called setting operational state to Docked and currentMode to Idle');
|
|
260
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
170
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
261
171
|
this.state.operationalState = RvcOperationalState.OperationalState.Docked;
|
|
262
172
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
263
173
|
return {
|
|
@@ -265,4 +175,3 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
265
175
|
};
|
|
266
176
|
}
|
|
267
177
|
}
|
|
268
|
-
//# sourceMappingURL=roboticVacuumCleaner.js.map
|
|
@@ -1,45 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the SolarPower class.
|
|
3
|
-
* @file src/devices/solarPower.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @contributor Ludovic BOUÉ
|
|
6
|
-
* @created 2025-06-14
|
|
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
1
|
import { PowerSourceTag } from '@matter/node';
|
|
26
2
|
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
27
|
-
// Matterbridge
|
|
28
3
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
29
4
|
import { deviceEnergyManagement, electricalSensor, solarPower, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
30
5
|
export class SolarPower extends MatterbridgeEndpoint {
|
|
31
|
-
/**
|
|
32
|
-
* Creates an instance of the SolarPower class.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} name - The name of the SolarPower.
|
|
35
|
-
* @param {string} serial - The serial number of the SolarPower.
|
|
36
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
37
|
-
* @param {number} current - The current value in milliamperes.
|
|
38
|
-
* @param {number} power - The power value in milliwatts.
|
|
39
|
-
* @param {number} energyExported - The total production value in mW/h.
|
|
40
|
-
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
41
|
-
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
42
|
-
*/
|
|
43
6
|
constructor(name, serial, voltage = null, current = null, power = null, energyExported = null, absMinPower = 0, absMaxPower = 0) {
|
|
44
7
|
super([solarPower, powerSource, electricalSensor, deviceEnergyManagement], {
|
|
45
8
|
tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Solar.namespaceId, tag: PowerSourceTag.Solar.tag, label: null }],
|
|
@@ -56,4 +19,3 @@ export class SolarPower extends MatterbridgeEndpoint {
|
|
|
56
19
|
.addRequiredClusterServers();
|
|
57
20
|
}
|
|
58
21
|
}
|
|
59
|
-
//# sourceMappingURL=solarPower.js.map
|
package/dist/devices/speaker.js
CHANGED
|
@@ -1,60 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Speaker device class controlling mute (On/Off) and volume level (Level Control).
|
|
3
|
-
* @file src/devices/speaker.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-09-04
|
|
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
|
-
// matter clusters
|
|
24
1
|
import { OnOff } from '@matter/types/clusters/on-off';
|
|
25
2
|
import { LevelControl } from '@matter/types/clusters/level-control';
|
|
26
|
-
// matterbridge
|
|
27
3
|
import { speakerDevice } from '../matterbridgeDeviceTypes.js';
|
|
28
4
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
29
|
-
/**
|
|
30
|
-
* Represents a Speaker endpoint (Device Type 0x0022) exposing mute (OnOff) and volume (LevelControl).
|
|
31
|
-
*
|
|
32
|
-
* Mapping:
|
|
33
|
-
* - OnOff TRUE => audio unmuted
|
|
34
|
-
* - OnOff FALSE => audio muted
|
|
35
|
-
* - LevelControl.currentLevel (1..254) => volume (linear map to 0..100%)
|
|
36
|
-
*
|
|
37
|
-
* Edge cases:
|
|
38
|
-
* - Volume < 1 coerced to 1.
|
|
39
|
-
* - Volume > 254 coerced to 254.
|
|
40
|
-
* - Non‑finite volume falls back to 128 (≈ mid level).
|
|
41
|
-
*/
|
|
42
5
|
export class Speaker extends MatterbridgeEndpoint {
|
|
43
|
-
/**
|
|
44
|
-
* Create Speaker endpoint.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} name Human readable device name.
|
|
47
|
-
* @param {string} serial Unique serial (used to derive storage key).
|
|
48
|
-
* @param {boolean} muted Initial muted state (true => unmuted, default true if omitted).
|
|
49
|
-
* @param {number} volume Initial volume (1..254, coerced; default 128 ≈ 50% if omitted).
|
|
50
|
-
* @returns {Speaker} New speaker instance.
|
|
51
|
-
*
|
|
52
|
-
* @remarks Supported by:
|
|
53
|
-
* - SmartThings (OnOff mute, LevelControl volume)
|
|
54
|
-
* - Google Home (OnOff mute, LevelControl volume)
|
|
55
|
-
*/
|
|
56
6
|
constructor(name, serial, muted = false, volume = 128) {
|
|
57
|
-
// sanitize volume
|
|
58
7
|
if (!Number.isFinite(volume))
|
|
59
8
|
volume = 128;
|
|
60
9
|
if (volume < 1)
|
|
@@ -63,42 +12,15 @@ export class Speaker extends MatterbridgeEndpoint {
|
|
|
63
12
|
volume = 254;
|
|
64
13
|
super([speakerDevice], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
65
14
|
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Speaker');
|
|
66
|
-
// On/Off used for mute state (TRUE => unmuted) - using no features
|
|
67
15
|
this.createOnOffClusterServer(!muted);
|
|
68
|
-
// LevelControl for volume - using no features
|
|
69
16
|
this.createLevelControlClusterServer(volume);
|
|
70
17
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Set mute state (true => muted / audio off).
|
|
73
|
-
*
|
|
74
|
-
* Edge cases:
|
|
75
|
-
* - Strict boolean; caller must pass boolean (TS enforces).
|
|
76
|
-
*
|
|
77
|
-
* @param {boolean} muted Desired mute state (true => muted, false => unmuted).
|
|
78
|
-
* @returns {Promise<void>} Resolves when attribute is updated.
|
|
79
|
-
*/
|
|
80
18
|
async setMuted(muted) {
|
|
81
19
|
await this.setAttribute(OnOff.Cluster.id, 'onOff', !muted);
|
|
82
20
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Get mute state.
|
|
85
|
-
*
|
|
86
|
-
* @returns {boolean} TRUE when muted, FALSE when unmuted.
|
|
87
|
-
*/
|
|
88
21
|
isMuted() {
|
|
89
22
|
return !this.getAttribute(OnOff.Cluster.id, 'onOff');
|
|
90
23
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Set volume level (1..254).
|
|
93
|
-
*
|
|
94
|
-
* Edge cases:
|
|
95
|
-
* - Non‑finite input ignored.
|
|
96
|
-
* - <1 coerced to 1.
|
|
97
|
-
* - >254 coerced to 254.
|
|
98
|
-
*
|
|
99
|
-
* @param {number} level Raw level (1..254 recommended, coerced if outside range).
|
|
100
|
-
* @returns {Promise<void>} Resolves when attribute is updated.
|
|
101
|
-
*/
|
|
102
24
|
async setVolume(level) {
|
|
103
25
|
if (!Number.isFinite(level))
|
|
104
26
|
return;
|
|
@@ -108,13 +30,7 @@ export class Speaker extends MatterbridgeEndpoint {
|
|
|
108
30
|
level = 254;
|
|
109
31
|
await this.setAttribute(LevelControl.Cluster.id, 'currentLevel', level);
|
|
110
32
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Get current volume.
|
|
113
|
-
*
|
|
114
|
-
* @returns {number} Current level (1..254).
|
|
115
|
-
*/
|
|
116
33
|
getVolume() {
|
|
117
34
|
return this.getAttribute(LevelControl.Cluster.id, 'currentLevel');
|
|
118
35
|
}
|
|
119
36
|
}
|
|
120
|
-
//# sourceMappingURL=speaker.js.map
|