matterbridge 3.2.2 → 3.2.3-dev-20250813-099c5df
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 +16 -0
- package/dist/cli.js +2 -91
- package/dist/cliEmitter.js +0 -30
- package/dist/clusters/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -24
- package/dist/deviceManager.js +1 -94
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/dishwasher.js +4 -79
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.js +5 -5
- package/dist/devices/extractorHood.js +0 -42
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.js +8 -84
- package/dist/devices/laundryWasher.js +7 -146
- package/dist/devices/microwaveOven.js +96 -0
- package/dist/devices/oven.js +104 -0
- package/dist/devices/roboticVacuumCleaner.js +7 -93
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/temperatureControl.js +57 -0
- package/dist/devices/waterHeater.js +2 -82
- package/dist/dgram/coap.js +13 -126
- package/dist/dgram/dgram.js +2 -113
- package/dist/dgram/mb_coap.js +3 -41
- package/dist/dgram/mb_mdns.js +13 -51
- package/dist/dgram/mdns.js +137 -298
- package/dist/dgram/multicast.js +1 -60
- package/dist/dgram/unicast.js +0 -54
- package/dist/frontend.js +24 -451
- package/dist/globalMatterbridge.js +0 -47
- package/dist/helpers.js +0 -53
- package/dist/index.js +1 -30
- 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 +50 -789
- package/dist/matterbridgeAccessoryPlatform.js +0 -36
- package/dist/matterbridgeBehaviors.js +5 -65
- package/dist/matterbridgeDeviceTypes.js +15 -579
- package/dist/matterbridgeDynamicPlatform.js +0 -36
- package/dist/matterbridgeEndpoint.js +54 -1220
- package/dist/matterbridgeEndpointHelpers.js +12 -345
- package/dist/matterbridgePlatform.js +0 -250
- package/dist/matterbridgeTypes.js +0 -25
- package/dist/pluginManager.js +3 -249
- 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 -54
- 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/hex.js +0 -124
- package/dist/utils/isvalid.js +0 -101
- package/dist/utils/network.js +5 -91
- package/dist/utils/spawn.js +0 -40
- package/dist/utils/wait.js +8 -60
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -2
- package/dist/cli.d.ts +0 -26
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts +0 -34
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.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 -112
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.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/dishwasher.d.ts +0 -91
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts +0 -75
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts +0 -11
- 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 -87
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts +0 -242
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.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/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 -140
- 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 -288
- package/dist/dgram/mdns.d.ts.map +0 -1
- package/dist/dgram/mdns.js.map +0 -1
- package/dist/dgram/multicast.d.ts +0 -65
- 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 -313
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/globalMatterbridge.d.ts +0 -59
- package/dist/globalMatterbridge.d.ts.map +0 -1
- package/dist/globalMatterbridge.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 -462
- 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 -1351
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -709
- 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 -1354
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -407
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -324
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -198
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -270
- 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 -99
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -59
- 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 -12
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.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/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/network.d.ts +0 -84
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -33
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.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
|
@@ -1,60 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the LaundryWasher class.
|
|
3
|
-
* @file src/devices/laundryWasher.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 { LaundryWasherControls } from '@matter/main/clusters/laundry-washer-controls';
|
|
24
2
|
import { LaundryWasherMode } from '@matter/main/clusters/laundry-washer-mode';
|
|
25
|
-
import { TemperatureControl } from '@matter/main/clusters/temperature-control';
|
|
26
3
|
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
27
|
-
import { TemperatureControlServer } from '@matter/main/behaviors/temperature-control';
|
|
28
4
|
import { LaundryWasherModeServer } from '@matter/main/behaviors/laundry-washer-mode';
|
|
29
5
|
import { LaundryWasherControlsServer } from '@matter/main/behaviors/laundry-washer-controls';
|
|
30
|
-
// Matterbridge
|
|
31
6
|
import { laundryWasher, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
32
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
33
8
|
import { MatterbridgeOnOffServer, MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
9
|
+
import { createLevelTemperatureControlClusterServer, createNumberTemperatureControlClusterServer } from './temperatureControl.js';
|
|
34
10
|
export class LaundryWasher extends MatterbridgeEndpoint {
|
|
35
|
-
/**
|
|
36
|
-
* Creates an instance of the LaundryWasher class.
|
|
37
|
-
*
|
|
38
|
-
* @param {string} name - The name of the laundry washer.
|
|
39
|
-
* @param {string} serial - The serial number of the laundry washer.
|
|
40
|
-
* @param {number} [currentMode] - The current mode of the laundry washer. Defaults to 2 (Normal mode). Dead Front OnOff Cluster will set this to 2 when turned off. Persistent attribute.
|
|
41
|
-
* @param {LaundryWasherMode.ModeOption[]} [supportedModes] - The supported modes of the laundry washer. Defaults to a set of common modes (which include Delicate, Normal, Heavy, and Whites). Fixed attribute.
|
|
42
|
-
* @param {number} [spinSpeedCurrent] - The current spin speed as index of the spinSpeeds array. Defaults to 2 (which corresponds to '1200').
|
|
43
|
-
* @param {string[]} [spinSpeeds] - The supported spin speeds. Defaults to ['400', '800', '1200', '1600'].
|
|
44
|
-
* @param {LaundryWasherControls.NumberOfRinses} [numberOfRinses] - The number of rinses. Defaults to LaundryWasherControls.NumberOfRinses.Normal (which corresponds to 1 rinse).
|
|
45
|
-
* @param {LaundryWasherControls.NumberOfRinses[]} [supportedRinses] - The supported rinses. Defaults to [NumberOfRinses.None, NumberOfRinses.Normal, NumberOfRinses.Max, NumberOfRinses.Extra].
|
|
46
|
-
* @param {number} [selectedTemperatureLevel] - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 1 (which corresponds to 'Warm').
|
|
47
|
-
* @param {string[]} [supportedTemperatureLevels] - The supported temperature levels. Defaults to ['Cold', 'Warm', 'Hot', '30°', '40°', '60°', '80°']. Fixed attribute.
|
|
48
|
-
* @param {number} [temperatureSetpoint] - The temperature setpoint * 100. Defaults to 40 * 100 (which corresponds to 40°C).
|
|
49
|
-
* @param {number} [minTemperature] - The minimum temperature * 100. Defaults to 30 * 100 (which corresponds to 30°C). Fixed attribute.
|
|
50
|
-
* @param {number} [maxTemperature] - The maximum temperature * 100. Defaults to 60 * 100 (which corresponds to 60°C). Fixed attribute.
|
|
51
|
-
* @param {number} [step] - The step size for temperature changes. Defaults to 10 * 100 (which corresponds to 10°C). Fixed attribute.
|
|
52
|
-
* @param {OperationalState.OperationalStateEnum} [operationalState] - The operational state of the laundry washer. Defaults to OperationalState.OperationalStateEnum.Off.
|
|
53
|
-
*
|
|
54
|
-
* Remarks:
|
|
55
|
-
* - If `temperatureSetpoint` is provided, the `createNumberTemperatureControlClusterServer` method will be used to create the TemperatureControl Cluster Server with features TemperatureNumber and TemperatureStep.
|
|
56
|
-
* - If `temperatureSetpoint` is not provided, the `createLevelTemperatureControlClusterServer` method will be used to create the TemperatureControl Cluster Server with feature TemperatureLevel.
|
|
57
|
-
*/
|
|
58
11
|
constructor(name, serial, currentMode, supportedModes, spinSpeedCurrent, spinSpeeds, numberOfRinses, supportedRinses, selectedTemperatureLevel, supportedTemperatureLevels, temperatureSetpoint, minTemperature, maxTemperature, step, operationalState) {
|
|
59
12
|
super([laundryWasher, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
60
13
|
this.createDefaultIdentifyClusterServer();
|
|
@@ -64,19 +17,11 @@ export class LaundryWasher extends MatterbridgeEndpoint {
|
|
|
64
17
|
this.createDefaultLaundryWasherModeClusterServer(currentMode, supportedModes);
|
|
65
18
|
this.createDefaultLaundryWasherControlsClusterServer(spinSpeedCurrent, spinSpeeds, numberOfRinses, supportedRinses);
|
|
66
19
|
if (temperatureSetpoint)
|
|
67
|
-
|
|
20
|
+
createNumberTemperatureControlClusterServer(this, temperatureSetpoint, minTemperature, maxTemperature, step);
|
|
68
21
|
else
|
|
69
|
-
|
|
22
|
+
createLevelTemperatureControlClusterServer(this, selectedTemperatureLevel, supportedTemperatureLevels);
|
|
70
23
|
this.createDefaultOperationalStateClusterServer(operationalState);
|
|
71
24
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Creates a default Laundry Washer Mode Cluster Server.
|
|
74
|
-
*
|
|
75
|
-
* @param {number} currentMode - The current mode of the laundry washer. Defaults to 2 (Normal mode). Dead Front OnOff Cluster will set this to 2 when turned off. Persistent attribute.
|
|
76
|
-
* @param {LaundryWasherMode.ModeOption[]} supportedModes - The supported modes of the laundry washer. Defaults to a set of common modes (which include Delicate, Normal, Heavy, and Whites). Fixed attribute.
|
|
77
|
-
*
|
|
78
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
79
|
-
*/
|
|
80
25
|
createDefaultLaundryWasherModeClusterServer(currentMode = 2, supportedModes = [
|
|
81
26
|
{ label: 'Delicate', mode: 1, modeTags: [{ value: LaundryWasherMode.ModeTag.Delicate }] },
|
|
82
27
|
{ label: 'Normal', mode: 2, modeTags: [{ value: LaundryWasherMode.ModeTag.Normal }] },
|
|
@@ -84,102 +29,20 @@ export class LaundryWasher extends MatterbridgeEndpoint {
|
|
|
84
29
|
{ label: 'Whites', mode: 4, modeTags: [{ value: LaundryWasherMode.ModeTag.Whites }] },
|
|
85
30
|
]) {
|
|
86
31
|
this.behaviors.require(MatterbridgeLaundryWasherModeServer, {
|
|
87
|
-
supportedModes,
|
|
88
|
-
currentMode,
|
|
32
|
+
supportedModes,
|
|
33
|
+
currentMode,
|
|
89
34
|
});
|
|
90
35
|
return this;
|
|
91
36
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Creates a Laundry Washer Controls Cluster Server with feature Spin for selecting the spin speed and feature Rinse for selecting the number of rinses.
|
|
94
|
-
*
|
|
95
|
-
* @param {number} spinSpeedCurrent - The current spin speed as index of the spinSpeeds array. Default to 2 (which corresponds to '1200').
|
|
96
|
-
* @param {string[]} spinSpeeds - The supported spin speeds. Default to ['400', '800', '1200', '1600'].
|
|
97
|
-
* @param {LaundryWasherControls.NumberOfRinses} numberOfRinses - The number of rinses. Default to LaundryWasherControls.NumberOfRinses.Normal (which corresponds to 1 rinse).
|
|
98
|
-
* @param {LaundryWasherControls.NumberOfRinses[]} supportedRinses - The supported rinses. Default to [NumberOfRinses.None, NumberOfRinses.Normal, NumberOfRinses.Max, NumberOfRinses.Extra].
|
|
99
|
-
*
|
|
100
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
101
|
-
*/
|
|
102
37
|
createDefaultLaundryWasherControlsClusterServer(spinSpeedCurrent = 2, spinSpeeds = ['400', '800', '1200', '1600'], numberOfRinses = LaundryWasherControls.NumberOfRinses.Normal, supportedRinses = [LaundryWasherControls.NumberOfRinses.None, LaundryWasherControls.NumberOfRinses.Normal, LaundryWasherControls.NumberOfRinses.Max, LaundryWasherControls.NumberOfRinses.Extra]) {
|
|
103
38
|
this.behaviors.require(LaundryWasherControlsServer.with(LaundryWasherControls.Feature.Spin, LaundryWasherControls.Feature.Rinse), {
|
|
104
39
|
spinSpeeds,
|
|
105
|
-
spinSpeedCurrent,
|
|
40
|
+
spinSpeedCurrent,
|
|
106
41
|
supportedRinses,
|
|
107
|
-
numberOfRinses,
|
|
42
|
+
numberOfRinses,
|
|
108
43
|
});
|
|
109
44
|
return this;
|
|
110
45
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Creates a TemperatureControl Cluster Server with feature TemperatureLevel.
|
|
113
|
-
*
|
|
114
|
-
* @param {number} selectedTemperatureLevel - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 1 (which corresponds to 'Warm').
|
|
115
|
-
* @param {string[]} supportedTemperatureLevels - The supported temperature levels. Defaults to ['Cold', 'Warm', 'Hot', '30°', '40°', '60°', '80°'].
|
|
116
|
-
*
|
|
117
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
118
|
-
*/
|
|
119
|
-
createLevelTemperatureControlClusterServer(selectedTemperatureLevel = 1, supportedTemperatureLevels = ['Cold', 'Warm', 'Hot', '30°', '40°', '60°', '80°']) {
|
|
120
|
-
this.behaviors.require(MatterbridgeLevelTemperatureControlServer.with(TemperatureControl.Feature.TemperatureLevel), {
|
|
121
|
-
selectedTemperatureLevel,
|
|
122
|
-
supportedTemperatureLevels,
|
|
123
|
-
});
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Creates a TemperatureControl Cluster Server with features TemperatureNumber and TemperatureStep.
|
|
128
|
-
*
|
|
129
|
-
* @param {number} temperatureSetpoint - The temperature setpoint * 100. Defaults to 40 * 100 (which corresponds to 40°C).
|
|
130
|
-
* @param {number} minTemperature - The minimum temperature * 100. Defaults to 30 * 100 (which corresponds to 30°C). Fixed attribute.
|
|
131
|
-
* @param {number} maxTemperature - The maximum temperature * 100. Defaults to 60 * 100 (which corresponds to 60°C). Fixed attribute.
|
|
132
|
-
* @param {number} [step] - The step size for temperature changes. Defaults to 10 * 100 (which corresponds to 10°C). Fixed attribute.
|
|
133
|
-
*
|
|
134
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
135
|
-
*/
|
|
136
|
-
createNumberTemperatureControlClusterServer(temperatureSetpoint = 40 * 100, minTemperature = 30 * 100, maxTemperature = 60 * 100, step = 10 * 100) {
|
|
137
|
-
this.behaviors.require(MatterbridgeNumberTemperatureControlServer.with(TemperatureControl.Feature.TemperatureNumber, TemperatureControl.Feature.TemperatureStep), {
|
|
138
|
-
temperatureSetpoint,
|
|
139
|
-
minTemperature, // Fixed attribute
|
|
140
|
-
maxTemperature, // Fixed attribute
|
|
141
|
-
step, // Fixed attribute
|
|
142
|
-
});
|
|
143
|
-
return this;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
export class MatterbridgeLevelTemperatureControlServer extends TemperatureControlServer.with(TemperatureControl.Feature.TemperatureLevel) {
|
|
147
|
-
initialize() {
|
|
148
|
-
if (this.state.supportedTemperatureLevels.length >= 2) {
|
|
149
|
-
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
150
|
-
device.log.info(`MatterbridgeLevelTemperatureControlServer initialized with selectedTemperatureLevel ${this.state.selectedTemperatureLevel} and supportedTemperatureLevels: ${this.state.supportedTemperatureLevels.join(', ')}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
setTemperature(request) {
|
|
154
|
-
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
155
|
-
device.log.info(`SetTemperature (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
156
|
-
device.commandHandler.executeHandler('setTemperature', { request, cluster: TemperatureControlServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
157
|
-
if (request.targetTemperatureLevel !== undefined && request.targetTemperatureLevel >= 0 && request.targetTemperatureLevel < this.state.supportedTemperatureLevels.length) {
|
|
158
|
-
device.log.debug(`MatterbridgeLevelTemperatureControlServer: setTemperature called setting selectedTemperatureLevel to ${request.targetTemperatureLevel}: ${this.state.supportedTemperatureLevels[request.targetTemperatureLevel]}`);
|
|
159
|
-
this.state.selectedTemperatureLevel = request.targetTemperatureLevel;
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
device.log.error(`MatterbridgeLevelTemperatureControlServer: setTemperature called with invalid targetTemperatureLevel ${request.targetTemperatureLevel}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
export class MatterbridgeNumberTemperatureControlServer extends TemperatureControlServer.with(TemperatureControl.Feature.TemperatureNumber, TemperatureControl.Feature.TemperatureStep) {
|
|
167
|
-
initialize() {
|
|
168
|
-
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
169
|
-
device.log.info(`MatterbridgeNumberTemperatureControlServer initialized with temperatureSetpoint ${this.state.temperatureSetpoint} minTemperature ${this.state.minTemperature} maxTemperature ${this.state.maxTemperature} step ${this.state.step}`);
|
|
170
|
-
}
|
|
171
|
-
setTemperature(request) {
|
|
172
|
-
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
173
|
-
device.log.info(`SetTemperature (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
174
|
-
device.commandHandler.executeHandler('setTemperature', { request, cluster: TemperatureControlServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
175
|
-
if (request.targetTemperature !== undefined && request.targetTemperature >= this.state.minTemperature && request.targetTemperature <= this.state.maxTemperature) {
|
|
176
|
-
device.log.debug(`MatterbridgeNumberTemperatureControlServer: setTemperature called setting temperatureSetpoint to ${request.targetTemperature}`);
|
|
177
|
-
this.state.temperatureSetpoint = request.targetTemperature;
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
device.log.error(`MatterbridgeNumberTemperatureControlServer: setTemperature called with invalid targetTemperature ${request.targetTemperature}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
46
|
}
|
|
184
47
|
export class MatterbridgeLaundryWasherModeServer extends LaundryWasherModeServer {
|
|
185
48
|
initialize() {
|
|
@@ -187,7 +50,6 @@ export class MatterbridgeLaundryWasherModeServer extends LaundryWasherModeServer
|
|
|
187
50
|
device.log.info(`MatterbridgeLaundryWasherModeServer initialized: currentMode is ${this.state.currentMode}`);
|
|
188
51
|
this.reactTo(this.agent.get(MatterbridgeOnOffServer).events.onOff$Changed, this.handleOnOffChange);
|
|
189
52
|
}
|
|
190
|
-
// Dead Front OnOff Cluster
|
|
191
53
|
handleOnOffChange(onOff) {
|
|
192
54
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
193
55
|
device.log.info(`HandleOnOffChange (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
@@ -212,4 +74,3 @@ export class MatterbridgeLaundryWasherModeServer extends LaundryWasherModeServer
|
|
|
212
74
|
}
|
|
213
75
|
}
|
|
214
76
|
}
|
|
215
|
-
//# sourceMappingURL=laundryWasher.js.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
2
|
+
import { MicrowaveOvenMode } from '@matter/main/clusters/microwave-oven-mode';
|
|
3
|
+
import { MicrowaveOvenControl } from '@matter/main/clusters/microwave-oven-control';
|
|
4
|
+
import { MicrowaveOvenControlServer } from '@matter/main/behaviors/microwave-oven-control';
|
|
5
|
+
import { MicrowaveOvenModeServer } from '@matter/main/behaviors/microwave-oven-mode';
|
|
6
|
+
import { microwaveOven, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
7
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
8
|
+
import { MatterbridgeServer, MatterbridgeOperationalStateServer } from '../matterbridgeBehaviors.js';
|
|
9
|
+
export class MicrowaveOven extends MatterbridgeEndpoint {
|
|
10
|
+
constructor(name, serial, currentMode = 1, supportedModes = [
|
|
11
|
+
{ label: 'Auto', mode: 1, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Auto }] },
|
|
12
|
+
{ label: 'Quick', mode: 2, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Quick }] },
|
|
13
|
+
{ label: 'Quiet', mode: 3, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Quiet }] },
|
|
14
|
+
{ label: 'Min', mode: 4, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Min }] },
|
|
15
|
+
{ label: 'Max', mode: 5, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Max }] },
|
|
16
|
+
{ label: 'Normal', mode: 6, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Normal }] },
|
|
17
|
+
{ label: 'Defrost', mode: 7, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Defrost }] },
|
|
18
|
+
], selectedWattIndex = 5, supportedWatts = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], cookTime = 60, maxCookTime = 3600) {
|
|
19
|
+
super([microwaveOven, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
20
|
+
this.createDefaultIdentifyClusterServer();
|
|
21
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Microwave Oven');
|
|
22
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
23
|
+
this.createDefaultOperationalStateClusterServer(OperationalState.OperationalStateEnum.Stopped);
|
|
24
|
+
this.createDefaultMicrowaveOvenModeClusterServer(currentMode, supportedModes);
|
|
25
|
+
this.createDefaultMicrowaveOvenControlClusterServer(selectedWattIndex, supportedWatts, cookTime, maxCookTime);
|
|
26
|
+
}
|
|
27
|
+
createDefaultMicrowaveOvenModeClusterServer(currentMode, supportedModes) {
|
|
28
|
+
this.behaviors.require(MicrowaveOvenModeServer, {
|
|
29
|
+
supportedModes,
|
|
30
|
+
currentMode,
|
|
31
|
+
});
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
createDefaultMicrowaveOvenControlClusterServer(selectedWattIndex, supportedWatts, cookTime, maxCookTime) {
|
|
35
|
+
this.behaviors.require(MatterbridgeMicrowaveOvenControlServer.with(MicrowaveOvenControl.Feature.PowerInWatts), {
|
|
36
|
+
supportedWatts,
|
|
37
|
+
selectedWattIndex,
|
|
38
|
+
cookTime,
|
|
39
|
+
maxCookTime,
|
|
40
|
+
});
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export class MatterbridgeMicrowaveOvenControlServer extends MicrowaveOvenControlServer.with(MicrowaveOvenControl.Feature.PowerInWatts) {
|
|
45
|
+
initialize() {
|
|
46
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
47
|
+
device.log.info('MatterbridgeMicrowaveOvenControlServer initialized');
|
|
48
|
+
}
|
|
49
|
+
setCookingParameters(request) {
|
|
50
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
51
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
52
|
+
device.commandHandler.executeHandler('setCookingParameters', { request, cluster: MicrowaveOvenControl.Cluster.id, attributes: this.state, endpoint: this.endpoint });
|
|
53
|
+
if (request.cookMode !== undefined) {
|
|
54
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting cookMode to ${request.cookMode}`);
|
|
55
|
+
this.endpoint.setStateOf(MicrowaveOvenModeServer, { currentMode: request.cookMode });
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called with no cookMode so set to Normal`);
|
|
59
|
+
const supportedModes = this.endpoint.stateOf(MicrowaveOvenModeServer).supportedModes;
|
|
60
|
+
const normalMode = supportedModes.find((mode) => mode.modeTags.some((tag) => tag.value === MicrowaveOvenMode.ModeTag.Normal));
|
|
61
|
+
this.endpoint.setStateOf(MicrowaveOvenModeServer, { currentMode: normalMode?.mode });
|
|
62
|
+
}
|
|
63
|
+
if (request.cookTime !== undefined && request.cookTime >= 0 && request.cookTime <= this.state.maxCookTime) {
|
|
64
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting cookTime to ${request.cookTime}`);
|
|
65
|
+
this.state.cookTime = request.cookTime;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called with no cookTime so set to 30sec.`);
|
|
69
|
+
this.state.cookTime = 30;
|
|
70
|
+
}
|
|
71
|
+
if (request.wattSettingIndex !== undefined && request.wattSettingIndex >= 0 && request.wattSettingIndex < this.state.supportedWatts.length) {
|
|
72
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting selectedWattIndex to ${request.wattSettingIndex}`);
|
|
73
|
+
this.state.selectedWattIndex = request.wattSettingIndex;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called with no wattSettingIndex so set to the highest Watt setting for the selected CookMode`);
|
|
77
|
+
this.state.selectedWattIndex = this.state.supportedWatts.length - 1;
|
|
78
|
+
}
|
|
79
|
+
if (request.startAfterSetting === true) {
|
|
80
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting startAfterSetting = true`);
|
|
81
|
+
this.endpoint.setStateOf(MatterbridgeOperationalStateServer, { operationalState: OperationalState.OperationalStateEnum.Running });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
addMoreTime(request) {
|
|
85
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
86
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: addMoreTime (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
87
|
+
device.commandHandler.executeHandler('addMoreTime', { request, cluster: MicrowaveOvenControl.Cluster.id, attributes: this.state, endpoint: this.endpoint });
|
|
88
|
+
if (request.timeToAdd !== undefined && request.timeToAdd > 0 && this.state.cookTime + request.timeToAdd <= this.state.maxCookTime) {
|
|
89
|
+
device.log.info(`MatterbridgeMicrowaveOvenControlServer: addMoreTime called setting cookTime to ${this.state.cookTime + request.timeToAdd}`);
|
|
90
|
+
this.state.cookTime += request.timeToAdd;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
device.log.error(`MatterbridgeMicrowaveOvenControlServer: addMoreTime called with invalid cookTime ${request.timeToAdd}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
2
|
+
import { OvenMode } from '@matter/main/clusters/oven-mode';
|
|
3
|
+
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
4
|
+
import { OvenModeServer } from '@matter/main/behaviors/oven-mode';
|
|
5
|
+
import { OvenCavityOperationalStateServer } from '@matter/main/behaviors/oven-cavity-operational-state';
|
|
6
|
+
import { oven, powerSource, temperatureControlledCabinetHeater } from '../matterbridgeDeviceTypes.js';
|
|
7
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
8
|
+
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
9
|
+
import { createLevelTemperatureControlClusterServer } from './temperatureControl.js';
|
|
10
|
+
export class Oven extends MatterbridgeEndpoint {
|
|
11
|
+
constructor(name, serial) {
|
|
12
|
+
super([oven, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
13
|
+
this.createDefaultIdentifyClusterServer();
|
|
14
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Oven');
|
|
15
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
16
|
+
}
|
|
17
|
+
addCabinet(name, tagList, currentMode = 2, supportedModes = [
|
|
18
|
+
{ label: 'Bake', mode: 1, modeTags: [{ value: OvenMode.ModeTag.Bake }] },
|
|
19
|
+
{ label: 'Convection', mode: 2, modeTags: [{ value: OvenMode.ModeTag.Convection }] },
|
|
20
|
+
{ label: 'Grill', mode: 3, modeTags: [{ value: OvenMode.ModeTag.Grill }] },
|
|
21
|
+
{ label: 'Roast', mode: 4, modeTags: [{ value: OvenMode.ModeTag.Roast }] },
|
|
22
|
+
{ label: 'Clean', mode: 5, modeTags: [{ value: OvenMode.ModeTag.Clean }] },
|
|
23
|
+
{ label: 'Convection Bake', mode: 6, modeTags: [{ value: OvenMode.ModeTag.ConvectionBake }] },
|
|
24
|
+
{ label: 'Convection Roast', mode: 7, modeTags: [{ value: OvenMode.ModeTag.ConvectionRoast }] },
|
|
25
|
+
{ label: 'Warming', mode: 8, modeTags: [{ value: OvenMode.ModeTag.Warming }] },
|
|
26
|
+
{ label: 'Proofing', mode: 9, modeTags: [{ value: OvenMode.ModeTag.Proofing }] },
|
|
27
|
+
{ label: 'Steam', mode: 10, modeTags: [{ value: OvenMode.ModeTag.Steam }] },
|
|
28
|
+
], selectedTemperatureLevel = 1, supportedTemperatureLevels = ['Defrost', '180°', '190°', '200°', '250°', '300°'], operationalState = OperationalState.OperationalStateEnum.Stopped, currentPhase, phaseList) {
|
|
29
|
+
const cabinet = this.addChildDeviceType(name, temperatureControlledCabinetHeater, { tagList }, true);
|
|
30
|
+
cabinet.log.logName = name;
|
|
31
|
+
cabinet.createDefaultIdentifyClusterServer();
|
|
32
|
+
createLevelTemperatureControlClusterServer(cabinet, selectedTemperatureLevel, supportedTemperatureLevels);
|
|
33
|
+
cabinet.createDefaultTemperatureMeasurementClusterServer(2000);
|
|
34
|
+
this.createDefaultOvenModeClusterServer(cabinet, currentMode, supportedModes);
|
|
35
|
+
this.createDefaultOvenCavityOperationalStateClusterServer(cabinet, operationalState, currentPhase, phaseList);
|
|
36
|
+
return cabinet;
|
|
37
|
+
}
|
|
38
|
+
createDefaultOvenModeClusterServer(endpoint, currentMode, supportedModes) {
|
|
39
|
+
endpoint.behaviors.require(MatterbridgeOvenModeServer, {
|
|
40
|
+
supportedModes,
|
|
41
|
+
currentMode,
|
|
42
|
+
});
|
|
43
|
+
return endpoint;
|
|
44
|
+
}
|
|
45
|
+
createDefaultOvenCavityOperationalStateClusterServer(endpoint, operationalState = OperationalState.OperationalStateEnum.Stopped, currentPhase, phaseList) {
|
|
46
|
+
endpoint.behaviors.require(MatterbridgeOvenCavityOperationalStateServer, {
|
|
47
|
+
phaseList: phaseList || null,
|
|
48
|
+
currentPhase: currentPhase || null,
|
|
49
|
+
operationalStateList: [
|
|
50
|
+
{ operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
|
|
51
|
+
{ operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
|
|
52
|
+
{ operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
|
|
53
|
+
],
|
|
54
|
+
operationalState,
|
|
55
|
+
operationalError: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
56
|
+
});
|
|
57
|
+
return endpoint;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export class MatterbridgeOvenModeServer extends OvenModeServer {
|
|
61
|
+
initialize() {
|
|
62
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
63
|
+
device.log.info('MatterbridgeOvenModeServer initialized');
|
|
64
|
+
}
|
|
65
|
+
changeToMode(request) {
|
|
66
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
67
|
+
const supportedMode = this.state.supportedModes.find((supportedMode) => supportedMode.mode === request.newMode);
|
|
68
|
+
if (supportedMode) {
|
|
69
|
+
device.log.info(`MatterbridgeOvenModeServer: changeToMode (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber}) called with mode ${supportedMode.mode} = ${supportedMode.label}`);
|
|
70
|
+
this.state.currentMode = request.newMode;
|
|
71
|
+
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Success' };
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
device.log.error(`MatterbridgeOvenModeServer: changeToMode (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber}) called with invalid mode ${request.newMode}`);
|
|
75
|
+
return { status: ModeBase.ModeChangeStatus.InvalidInMode, statusText: 'Invalid mode' };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export class MatterbridgeOvenCavityOperationalStateServer extends OvenCavityOperationalStateServer {
|
|
80
|
+
initialize() {
|
|
81
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
82
|
+
device.log.info('MatterbridgeOvenCavityOperationalStateServer initialized: setting operational state to Stopped and operational error to No error');
|
|
83
|
+
this.state.operationalState = OperationalState.OperationalStateEnum.Stopped;
|
|
84
|
+
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
|
85
|
+
}
|
|
86
|
+
stop() {
|
|
87
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
88
|
+
device.log.info(`MatterbridgeOvenCavityOperationalStateServer: stop (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber}) called setting operational state to Stopped and operational error to No error`);
|
|
89
|
+
this.state.operationalState = OperationalState.OperationalStateEnum.Stopped;
|
|
90
|
+
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
|
91
|
+
return {
|
|
92
|
+
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
start() {
|
|
96
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
97
|
+
device.log.info(`MatterbridgeOvenCavityOperationalStateServer: start (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber}) called setting operational state to Running and operational error to No error`);
|
|
98
|
+
this.state.operationalState = OperationalState.OperationalStateEnum.Running;
|
|
99
|
+
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
|
100
|
+
return {
|
|
101
|
+
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -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/main';
|
|
25
2
|
import { RvcRunModeServer } from '@matter/main/behaviors/rvc-run-mode';
|
|
26
3
|
import { RvcOperationalStateServer } from '@matter/main/behaviors/rvc-operational-state';
|
|
@@ -32,30 +9,10 @@ import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state
|
|
|
32
9
|
import { ServiceArea } from '@matter/main/clusters/service-area';
|
|
33
10
|
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
34
11
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
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 ?? [
|
|
@@ -146,21 +72,11 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
146
72
|
],
|
|
147
73
|
selectedAreas: selectedAreas ?? [],
|
|
148
74
|
currentArea: currentArea ?? 1,
|
|
149
|
-
supportedMaps: supportedMaps ?? [],
|
|
75
|
+
supportedMaps: supportedMaps ?? [],
|
|
150
76
|
estimatedEndTime: null,
|
|
151
77
|
});
|
|
152
78
|
return this;
|
|
153
79
|
}
|
|
154
|
-
/**
|
|
155
|
-
* Creates a default RvcOperationalState Cluster Server.
|
|
156
|
-
*
|
|
157
|
-
* @param {string[] | null} [phaseList] - The list of phases for the RvcOperationalState cluster. Defaults to null.
|
|
158
|
-
* @param {number | null} [currentPhase] - The current phase (the index of the phaseList) of the RvcOperationalState cluster. Defaults to null.
|
|
159
|
-
* @param {RvcOperationalState.OperationalStateStruct[]} [operationalStateList] - The list of operational states for the RvcOperationalState cluster. Defaults to a predefined set of states.
|
|
160
|
-
* @param {RvcOperationalState.OperationalState} [operationalState] - The current operationalStateId of the RvcOperationalState cluster. Defaults to Docked.
|
|
161
|
-
* @param {RvcOperationalState.ErrorStateStruct} [operationalError] - The current operational error of the RvcOperationalState cluster. Defaults to NoError.
|
|
162
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
163
|
-
*/
|
|
164
80
|
createDefaultRvcOperationalStateClusterServer(phaseList = null, currentPhase = null, operationalStateList, operationalState, operationalError) {
|
|
165
81
|
this.behaviors.require(MatterbridgeRvcOperationalStateServer, {
|
|
166
82
|
phaseList,
|
|
@@ -170,9 +86,9 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
170
86
|
{ operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
|
|
171
87
|
{ operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
|
|
172
88
|
{ operationalStateId: RvcOperationalState.OperationalState.Error, operationalStateLabel: 'Error' },
|
|
173
|
-
{ operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
|
|
174
|
-
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
|
175
|
-
{ 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' },
|
|
176
92
|
],
|
|
177
93
|
operationalState: operationalState ?? RvcOperationalState.OperationalState.Docked,
|
|
178
94
|
operationalError: operationalError ?? { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
|
|
@@ -227,7 +143,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
227
143
|
device.log.info(`Pause (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
228
144
|
device.commandHandler.executeHandler('pause', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
229
145
|
device.log.debug('MatterbridgeRvcOperationalStateServer: pause called setting operational state to Paused and currentMode to Idle');
|
|
230
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
146
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
231
147
|
this.state.operationalState = RvcOperationalState.OperationalState.Paused;
|
|
232
148
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
233
149
|
return {
|
|
@@ -239,7 +155,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
239
155
|
device.log.info(`Resume (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
240
156
|
device.commandHandler.executeHandler('resume', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
241
157
|
device.log.debug('MatterbridgeRvcOperationalStateServer: resume called setting operational state to Running and currentMode to Cleaning');
|
|
242
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
158
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
243
159
|
this.state.operationalState = RvcOperationalState.OperationalState.Running;
|
|
244
160
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
245
161
|
return {
|
|
@@ -247,12 +163,11 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
247
163
|
};
|
|
248
164
|
}
|
|
249
165
|
goHome() {
|
|
250
|
-
// const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
|
|
251
166
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
252
167
|
device.log.info(`GoHome (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
253
168
|
device.commandHandler.executeHandler('goHome', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
254
169
|
device.log.debug('MatterbridgeRvcOperationalStateServer: goHome called setting operational state to Docked and currentMode to Idle');
|
|
255
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
170
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
256
171
|
this.state.operationalState = RvcOperationalState.OperationalState.Docked;
|
|
257
172
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
258
173
|
return {
|
|
@@ -260,4 +175,3 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
260
175
|
};
|
|
261
176
|
}
|
|
262
177
|
}
|
|
263
|
-
//# 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/main';
|
|
26
2
|
import { DeviceEnergyManagement } from '@matter/main/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
|