matterbridge 3.2.1 → 3.2.3-dev-20250812-77f592b
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 +20 -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 +3 -78
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.js +0 -2
- package/dist/devices/extractorHood.js +0 -42
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.js +6 -83
- package/dist/devices/laundryWasher.js +7 -91
- package/dist/devices/roboticVacuumCleaner.js +7 -93
- package/dist/devices/solarPower.js +0 -38
- 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,25 +1,3 @@
|
|
|
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
3
|
import { TemperatureControl } from '@matter/main/clusters/temperature-control';
|
|
@@ -27,34 +5,10 @@ import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
|
27
5
|
import { TemperatureControlServer } from '@matter/main/behaviors/temperature-control';
|
|
28
6
|
import { LaundryWasherModeServer } from '@matter/main/behaviors/laundry-washer-mode';
|
|
29
7
|
import { LaundryWasherControlsServer } from '@matter/main/behaviors/laundry-washer-controls';
|
|
30
|
-
// Matterbridge
|
|
31
8
|
import { laundryWasher, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
32
9
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
33
10
|
import { MatterbridgeOnOffServer, MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
34
11
|
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
12
|
constructor(name, serial, currentMode, supportedModes, spinSpeedCurrent, spinSpeeds, numberOfRinses, supportedRinses, selectedTemperatureLevel, supportedTemperatureLevels, temperatureSetpoint, minTemperature, maxTemperature, step, operationalState) {
|
|
59
13
|
super([laundryWasher, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
60
14
|
this.createDefaultIdentifyClusterServer();
|
|
@@ -69,14 +23,6 @@ export class LaundryWasher extends MatterbridgeEndpoint {
|
|
|
69
23
|
this.createLevelTemperatureControlClusterServer(selectedTemperatureLevel, supportedTemperatureLevels);
|
|
70
24
|
this.createDefaultOperationalStateClusterServer(operationalState);
|
|
71
25
|
}
|
|
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
26
|
createDefaultLaundryWasherModeClusterServer(currentMode = 2, supportedModes = [
|
|
81
27
|
{ label: 'Delicate', mode: 1, modeTags: [{ value: LaundryWasherMode.ModeTag.Delicate }] },
|
|
82
28
|
{ label: 'Normal', mode: 2, modeTags: [{ value: LaundryWasherMode.ModeTag.Normal }] },
|
|
@@ -84,38 +30,20 @@ export class LaundryWasher extends MatterbridgeEndpoint {
|
|
|
84
30
|
{ label: 'Whites', mode: 4, modeTags: [{ value: LaundryWasherMode.ModeTag.Whites }] },
|
|
85
31
|
]) {
|
|
86
32
|
this.behaviors.require(MatterbridgeLaundryWasherModeServer, {
|
|
87
|
-
supportedModes,
|
|
88
|
-
currentMode,
|
|
33
|
+
supportedModes,
|
|
34
|
+
currentMode,
|
|
89
35
|
});
|
|
90
36
|
return this;
|
|
91
37
|
}
|
|
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
38
|
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
39
|
this.behaviors.require(LaundryWasherControlsServer.with(LaundryWasherControls.Feature.Spin, LaundryWasherControls.Feature.Rinse), {
|
|
104
40
|
spinSpeeds,
|
|
105
|
-
spinSpeedCurrent,
|
|
41
|
+
spinSpeedCurrent,
|
|
106
42
|
supportedRinses,
|
|
107
|
-
numberOfRinses,
|
|
43
|
+
numberOfRinses,
|
|
108
44
|
});
|
|
109
45
|
return this;
|
|
110
46
|
}
|
|
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
47
|
createLevelTemperatureControlClusterServer(selectedTemperatureLevel = 1, supportedTemperatureLevels = ['Cold', 'Warm', 'Hot', '30°', '40°', '60°', '80°']) {
|
|
120
48
|
this.behaviors.require(MatterbridgeLevelTemperatureControlServer.with(TemperatureControl.Feature.TemperatureLevel), {
|
|
121
49
|
selectedTemperatureLevel,
|
|
@@ -123,22 +51,12 @@ export class LaundryWasher extends MatterbridgeEndpoint {
|
|
|
123
51
|
});
|
|
124
52
|
return this;
|
|
125
53
|
}
|
|
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
54
|
createNumberTemperatureControlClusterServer(temperatureSetpoint = 40 * 100, minTemperature = 30 * 100, maxTemperature = 60 * 100, step = 10 * 100) {
|
|
137
55
|
this.behaviors.require(MatterbridgeNumberTemperatureControlServer.with(TemperatureControl.Feature.TemperatureNumber, TemperatureControl.Feature.TemperatureStep), {
|
|
138
56
|
temperatureSetpoint,
|
|
139
|
-
minTemperature,
|
|
140
|
-
maxTemperature,
|
|
141
|
-
step,
|
|
57
|
+
minTemperature,
|
|
58
|
+
maxTemperature,
|
|
59
|
+
step,
|
|
142
60
|
});
|
|
143
61
|
return this;
|
|
144
62
|
}
|
|
@@ -187,7 +105,6 @@ export class MatterbridgeLaundryWasherModeServer extends LaundryWasherModeServer
|
|
|
187
105
|
device.log.info(`MatterbridgeLaundryWasherModeServer initialized: currentMode is ${this.state.currentMode}`);
|
|
188
106
|
this.reactTo(this.agent.get(MatterbridgeOnOffServer).events.onOff$Changed, this.handleOnOffChange);
|
|
189
107
|
}
|
|
190
|
-
// Dead Front OnOff Cluster
|
|
191
108
|
handleOnOffChange(onOff) {
|
|
192
109
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
193
110
|
device.log.info(`HandleOnOffChange (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
@@ -212,4 +129,3 @@ export class MatterbridgeLaundryWasherModeServer extends LaundryWasherModeServer
|
|
|
212
129
|
}
|
|
213
130
|
}
|
|
214
131
|
}
|
|
215
|
-
//# sourceMappingURL=laundryWasher.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/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
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the WaterHeater class.
|
|
3
|
-
* @file src/devices/waterHeater.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @contributor Ludovic BOUÉ
|
|
6
|
-
* @created 2025-05-18
|
|
7
|
-
* @version 1.1.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
1
|
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
25
2
|
import { WaterHeaterManagement } from '@matter/main/clusters/water-heater-management';
|
|
26
3
|
import { WaterHeaterMode } from '@matter/main/clusters/water-heater-mode';
|
|
@@ -31,29 +8,6 @@ import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
|
31
8
|
import { electricalSensor, powerSource, waterHeater } from '../matterbridgeDeviceTypes.js';
|
|
32
9
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
33
10
|
export class WaterHeater extends MatterbridgeEndpoint {
|
|
34
|
-
/**
|
|
35
|
-
* Creates an instance of the WaterHeater class.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} name - The name of the water heater.
|
|
38
|
-
* @param {string} serial - The serial number of the water heater.
|
|
39
|
-
* @param {number} [waterTemperature] - The current water temperature. Defaults to 50.
|
|
40
|
-
* @param {number} [targetWaterTemperature] - The target water temperature. Defaults to 55.
|
|
41
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit. Defaults to 20.
|
|
42
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit. Defaults to 80.
|
|
43
|
-
* @param {{ immersionElement1?: boolean; immersionElement2?: boolean; heatPump?: boolean; boiler?: boolean; other?: boolean }} [heaterTypes] - Indicates the heat sources that the water heater can call on for heating. Defaults to { immersionElement1: true }.
|
|
44
|
-
* @param {boolean} heaterTypes.immersionElement1 - Indicates if the water heater has an immersion element 1. Defaults to true.
|
|
45
|
-
* @param {boolean} heaterTypes.immersionElement2 - Indicates if the water heater has an immersion element 2.
|
|
46
|
-
* @param {boolean} heaterTypes.heatPump - Indicates if the water heater has a heat pump.
|
|
47
|
-
* @param {boolean} heaterTypes.boiler - Indicates if the water heater has a boiler.
|
|
48
|
-
* @param {boolean} heaterTypes.other - Indicates if the water heater has other types of heating sources.
|
|
49
|
-
* @param {number} [tankPercentage] - The current tank percentage of the WaterHeaterManagement cluster. Defaults to 90.
|
|
50
|
-
* @param {number} [voltage] - The voltage value in millivolts. Defaults to null if not provided.
|
|
51
|
-
* @param {number} [current] - The current value in milliamperes. Defaults to null if not provided.
|
|
52
|
-
* @param {number} [power] - The power value in milliwatts. Defaults to null if not provided.
|
|
53
|
-
* @param {number} [energy] - The total consumption value in mW/h. Defaults to null if not provided.
|
|
54
|
-
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
55
|
-
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
56
|
-
*/
|
|
57
11
|
constructor(name, serial, waterTemperature = 50, targetWaterTemperature = 55, minHeatSetpointLimit = 20, maxHeatSetpointLimit = 80, heaterTypes = { immersionElement1: true }, tankPercentage = 90, voltage = null, current = null, power = null, energy = null, absMinPower = 0, absMaxPower = 0) {
|
|
58
12
|
super([waterHeater, powerSource, electricalSensor], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
59
13
|
this.createDefaultIdentifyClusterServer()
|
|
@@ -68,42 +22,15 @@ export class WaterHeater extends MatterbridgeEndpoint {
|
|
|
68
22
|
.createDefaultDeviceEnergyManagementClusterServer(DeviceEnergyManagement.EsaType.WaterHeating, true, DeviceEnergyManagement.EsaState.Online, absMinPower, absMaxPower)
|
|
69
23
|
.createDefaultDeviceEnergyManagementModeClusterServer();
|
|
70
24
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Creates a default WaterHeaterManagement Cluster Server.
|
|
73
|
-
*
|
|
74
|
-
* @param {{ immersionElement1?: boolean; immersionElement2?: boolean; heatPump?: boolean; boiler?: boolean; other?: boolean }} [heaterTypes] - Indicates the heat sources that the water heater can call on for heating. Defaults to { immersionElement1: true }.
|
|
75
|
-
* @param {boolean} heaterTypes.immersionElement1 - Indicates if the water heater has an immersion element 1. Defaults to true.
|
|
76
|
-
* @param {boolean} heaterTypes.immersionElement2 - Indicates if the water heater has an immersion element 2.
|
|
77
|
-
* @param {boolean} heaterTypes.heatPump - Indicates if the water heater has a heat pump.
|
|
78
|
-
* @param {boolean} heaterTypes.boiler - Indicates if the water heater has a boiler.
|
|
79
|
-
* @param {boolean} heaterTypes.other - Indicates if the water heater has other types of heating sources.
|
|
80
|
-
* @param {{ immersionElement1?: boolean; immersionElement2?: boolean; heatPump?: boolean; boiler?: boolean; other?: boolean }} [heatDemand] - Indicates if the water heater is heating water. Defaults to all heat sources unset.
|
|
81
|
-
* @param {boolean} heatDemand.immersionElement1 - Indicates if the water heater is heating water with immersion element 1. Defaults to false.
|
|
82
|
-
* @param {boolean} heatDemand.immersionElement2 - Indicates if the water heater is heating water with immersion element 2.
|
|
83
|
-
* @param {boolean} heatDemand.heatPump - Indicates if the water heater is heating water with a heat pump.
|
|
84
|
-
* @param {boolean} heatDemand.boiler - Indicates if the water heater is heating water with a boiler.
|
|
85
|
-
* @param {boolean} heatDemand.other - Indicates if the water heater is heating water with other types of heating sources.
|
|
86
|
-
* @param {number} [tankPercentage] - The current tank percentage of the WaterHeaterManagement cluster. Defaults to 100.
|
|
87
|
-
* @param {WaterHeaterManagement.BoostState} [boostState] - The current boost state of the WaterHeaterManagement cluster. Defaults to Inactive.
|
|
88
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
89
|
-
*/
|
|
90
25
|
createDefaultWaterHeaterManagementClusterServer(heaterTypes, heatDemand, tankPercentage, boostState) {
|
|
91
26
|
this.behaviors.require(MatterbridgeWaterHeaterManagementServer.with(WaterHeaterManagement.Feature.TankPercent), {
|
|
92
|
-
heaterTypes: heaterTypes ?? { immersionElement1: true },
|
|
27
|
+
heaterTypes: heaterTypes ?? { immersionElement1: true },
|
|
93
28
|
heatDemand: heatDemand ?? {},
|
|
94
29
|
tankPercentage: tankPercentage ?? 100,
|
|
95
30
|
boostState: boostState ?? WaterHeaterManagement.BoostState.Inactive,
|
|
96
31
|
});
|
|
97
32
|
return this;
|
|
98
33
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Creates a default WaterHeaterMode Cluster Server.
|
|
101
|
-
*
|
|
102
|
-
* @param {number} [currentMode] - The current mode of the WaterHeaterMode cluster. Defaults to mode 1 (WaterHeaterMode.ModeTag.Auto).
|
|
103
|
-
* @param {WaterHeaterMode.ModeOption[]} [supportedModes] - The supported modes for the WaterHeaterMode cluster. Defaults all cluster modes.
|
|
104
|
-
*
|
|
105
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
106
|
-
*/
|
|
107
34
|
createDefaultWaterHeaterModeClusterServer(currentMode, supportedModes) {
|
|
108
35
|
this.behaviors.require(MatterbridgeWaterHeaterModeServer, {
|
|
109
36
|
supportedModes: supportedModes ?? [
|
|
@@ -120,7 +47,7 @@ export class WaterHeater extends MatterbridgeEndpoint {
|
|
|
120
47
|
{ label: 'Off', mode: 11, modeTags: [{ value: WaterHeaterMode.ModeTag.Off }] },
|
|
121
48
|
{ label: 'Manual', mode: 12, modeTags: [{ value: WaterHeaterMode.ModeTag.Manual }] },
|
|
122
49
|
{ label: 'Timed', mode: 13, modeTags: [{ value: WaterHeaterMode.ModeTag.Timed }] },
|
|
123
|
-
],
|
|
50
|
+
],
|
|
124
51
|
currentMode: currentMode ?? 1,
|
|
125
52
|
});
|
|
126
53
|
return this;
|
|
@@ -133,9 +60,6 @@ export class MatterbridgeWaterHeaterManagementServer extends WaterHeaterManageme
|
|
|
133
60
|
device.commandHandler.executeHandler('boost', { request, cluster: WaterHeaterManagementServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
134
61
|
device.log.debug(`MatterbridgeWaterHeaterManagementServer boost called with: ${JSON.stringify(request)}`);
|
|
135
62
|
this.state.boostState = WaterHeaterManagement.BoostState.Active;
|
|
136
|
-
// The implementation is responsible for setting the device accordingly with the boostInfo of the boost command
|
|
137
|
-
// super.boost({ boostInfo });
|
|
138
|
-
// boost is not implemented in matter.js
|
|
139
63
|
}
|
|
140
64
|
cancelBoost() {
|
|
141
65
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -143,9 +67,6 @@ export class MatterbridgeWaterHeaterManagementServer extends WaterHeaterManageme
|
|
|
143
67
|
device.commandHandler.executeHandler('cancelBoost', { request: {}, cluster: WaterHeaterManagementServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
144
68
|
device.log.debug(`MatterbridgeWaterHeaterManagementServer cancelBoost called`);
|
|
145
69
|
this.state.boostState = WaterHeaterManagement.BoostState.Inactive;
|
|
146
|
-
// The implementation is responsible for setting the device accordingly with the cancelBoost command
|
|
147
|
-
// super.cancelBoost();
|
|
148
|
-
// cancelBoost is not implemented in matter.js
|
|
149
70
|
}
|
|
150
71
|
}
|
|
151
72
|
export class MatterbridgeWaterHeaterModeServer extends WaterHeaterModeServer {
|
|
@@ -163,4 +84,3 @@ export class MatterbridgeWaterHeaterModeServer extends WaterHeaterModeServer {
|
|
|
163
84
|
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Success' };
|
|
164
85
|
}
|
|
165
86
|
}
|
|
166
|
-
//# sourceMappingURL=waterHeater.js.map
|