matterbridge 3.1.4 → 3.1.5-dev-20250720-5a0b41e
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 +19 -0
- package/README-DEV.md +59 -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/evse.js +10 -74
- package/dist/devices/export.js +0 -2
- 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 +17 -97
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/waterHeater.js +2 -82
- package/dist/frontend.js +22 -430
- 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 +66 -802
- package/dist/matterbridgeAccessoryPlatform.js +0 -36
- package/dist/matterbridgeBehaviors.js +1 -61
- package/dist/matterbridgeDeviceTypes.js +15 -579
- package/dist/matterbridgeDynamicPlatform.js +0 -36
- package/dist/matterbridgeEndpoint.js +42 -1106
- package/dist/matterbridgeEndpointHelpers.js +12 -322
- package/dist/matterbridgePlatform.js +0 -233
- package/dist/matterbridgeTypes.js +0 -25
- package/dist/pluginManager.js +46 -350
- package/dist/shelly.js +7 -168
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -54
- package/dist/utils/colorUtils.js +2 -263
- 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 +9 -0
- package/dist/utils/export.js +0 -1
- package/dist/utils/hex.js +0 -58
- package/dist/utils/isvalid.js +0 -101
- package/dist/utils/network.js +5 -81
- package/dist/utils/spawn.js +0 -18
- package/dist/utils/wait.js +9 -62
- package/npm-shrinkwrap.json +5 -5
- 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/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 -9
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.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 -110
- 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/frontend.d.ts +0 -304
- 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 -444
- 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 -1340
- 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 -1250
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -3198
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -310
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -195
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -291
- 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 -59
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -117
- 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/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 -49
- 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 -74
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -11
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -56
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
|
@@ -1,25 +1,4 @@
|
|
|
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
|
-
*/
|
|
1
|
+
import { AreaNamespaceTag } from '@matter/main';
|
|
23
2
|
import { RvcRunModeServer } from '@matter/main/behaviors/rvc-run-mode';
|
|
24
3
|
import { RvcOperationalStateServer } from '@matter/main/behaviors/rvc-operational-state';
|
|
25
4
|
import { RvcCleanModeServer } from '@matter/main/behaviors/rvc-clean-mode';
|
|
@@ -27,32 +6,14 @@ import { PowerSource } from '@matter/main/clusters/power-source';
|
|
|
27
6
|
import { RvcRunMode } from '@matter/main/clusters/rvc-run-mode';
|
|
28
7
|
import { RvcCleanMode } from '@matter/main/clusters/rvc-clean-mode';
|
|
29
8
|
import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state';
|
|
9
|
+
import { ServiceArea } from '@matter/main/clusters/service-area';
|
|
30
10
|
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
31
11
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
32
|
-
// Matterbridge
|
|
33
12
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
34
13
|
import { powerSource, roboticVacuumCleaner } from '../matterbridgeDeviceTypes.js';
|
|
35
14
|
import { MatterbridgeServer, MatterbridgeServiceAreaServer } from '../matterbridgeBehaviors.js';
|
|
36
15
|
export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
37
|
-
|
|
38
|
-
* Creates an instance of the RoboticVacuumCleaner class.
|
|
39
|
-
*
|
|
40
|
-
* @param {string} name - The name of the robotic vacuum cleaner.
|
|
41
|
-
* @param {string} serial - The serial number of the robotic vacuum cleaner.
|
|
42
|
-
* @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.
|
|
43
|
-
* @param {number} [currentRunMode] - The current run mode of the robotic vacuum cleaner. Defaults to 1 (Idle).
|
|
44
|
-
* @param {RvcRunMode.ModeOption[]} [supportedRunModes] - The supported run modes for the robotic vacuum cleaner. Defaults to a predefined set of modes.
|
|
45
|
-
* @param {number} [currentCleanMode] - The current clean mode of the robotic vacuum cleaner. Defaults to 1 (Vacuum).
|
|
46
|
-
* @param {RvcCleanMode.ModeOption[]} [supportedCleanModes] - The supported clean modes for the robotic vacuum cleaner. Defaults to a predefined set of modes.
|
|
47
|
-
* @param {number | null} [currentPhase] - The current phase of the robotic vacuum cleaner. Defaults to null.
|
|
48
|
-
* @param {string[] | null} [phaseList] - The list of phases for the robotic vacuum cleaner. Defaults to null.
|
|
49
|
-
* @param {RvcOperationalState.OperationalState} [operationalState] - The current operational state of the robotic vacuum cleaner. Defaults to Docked.
|
|
50
|
-
* @param {RvcOperationalState.OperationalStateStruct[]} [operationalStateList] - The list of operational states for the robotic vacuum cleaner. Defaults to a predefined set of states.
|
|
51
|
-
* @param {ServiceArea.Area[]} [supportedAreas] - The supported areas for the robotic vacuum cleaner. Defaults to a predefined set of areas.
|
|
52
|
-
* @param {number[]} [selectedAreas] - The selected areas for the robotic vacuum cleaner. Defaults to an empty array (all areas allowed).
|
|
53
|
-
* @param {number} [currentArea] - The current area of the robotic vacuum cleaner. Defaults to 1 (Living).
|
|
54
|
-
*/
|
|
55
|
-
constructor(name, serial, mode = undefined, currentRunMode, supportedRunModes, currentCleanMode, supportedCleanModes, currentPhase = null, phaseList = null, operationalState, operationalStateList, supportedAreas, selectedAreas, currentArea) {
|
|
16
|
+
constructor(name, serial, mode = undefined, currentRunMode, supportedRunModes, currentCleanMode, supportedCleanModes, currentPhase = null, phaseList = null, operationalState, operationalStateList, supportedAreas, selectedAreas, currentArea, supportedMaps) {
|
|
56
17
|
super([roboticVacuumCleaner, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, mode }, true);
|
|
57
18
|
this.createDefaultIdentifyClusterServer()
|
|
58
19
|
.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Robot Vacuum Cleaner')
|
|
@@ -60,19 +21,8 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
60
21
|
.createDefaultRvcRunModeClusterServer(currentRunMode, supportedRunModes)
|
|
61
22
|
.createDefaultRvcCleanModeClusterServer(currentCleanMode, supportedCleanModes)
|
|
62
23
|
.createDefaultRvcOperationalStateClusterServer(phaseList, currentPhase, operationalStateList, operationalState)
|
|
63
|
-
.createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea);
|
|
24
|
+
.createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea, supportedMaps);
|
|
64
25
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Creates a default RvcRunMode Cluster Server.
|
|
67
|
-
*
|
|
68
|
-
* @param {number} [currentMode] - The current mode of the RvcRunMode cluster. Defaults to 1 (Idle).
|
|
69
|
-
* @param {RvcRunMode.ModeOption[]} [supportedModes] - The supported modes for the RvcRunMode cluster. Defaults to a predefined set of modes.
|
|
70
|
-
*
|
|
71
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
72
|
-
*
|
|
73
|
-
* @remarks
|
|
74
|
-
* - supportedModes is a fixed attribute that defines the run modes available for the robotic vacuum cleaner.
|
|
75
|
-
*/
|
|
76
26
|
createDefaultRvcRunModeClusterServer(currentMode, supportedModes) {
|
|
77
27
|
this.behaviors.require(MatterbridgeRvcRunModeServer, {
|
|
78
28
|
supportedModes: supportedModes ?? [
|
|
@@ -85,17 +35,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
85
35
|
});
|
|
86
36
|
return this;
|
|
87
37
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Creates a default RvcCleanMode Cluster Server.
|
|
90
|
-
*
|
|
91
|
-
* @param {number} [currentMode] - The current mode of the RvcCleanMode cluster. Defaults to 1 (Vacuum).
|
|
92
|
-
* @param {RvcCleanMode.ModeOption[]} [supportedModes] - The supported modes for the RvcCleanMode cluster. Defaults to a predefined set of modes.
|
|
93
|
-
*
|
|
94
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
95
|
-
*
|
|
96
|
-
* @remarks
|
|
97
|
-
* - supportedModes is a fixed attribute that defines the clean modes available for the robotic vacuum cleaner.
|
|
98
|
-
*/
|
|
99
38
|
createDefaultRvcCleanModeClusterServer(currentMode, supportedModes) {
|
|
100
39
|
this.behaviors.require(MatterbridgeRvcCleanModeServer, {
|
|
101
40
|
supportedModes: supportedModes ?? [
|
|
@@ -107,54 +46,37 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
107
46
|
});
|
|
108
47
|
return this;
|
|
109
48
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*
|
|
113
|
-
* @param {ServiceArea.Area[]} [supportedAreas] - The supported areas for the ServiceArea cluster. Defaults to a predefined set of areas.
|
|
114
|
-
* @param {number[]} [selectedAreas] - The selected areas for the ServiceArea cluster. Defaults to an empty array (all areas allowed).
|
|
115
|
-
* @param {number} [currentArea] - The current areaId (not the index in the array!) of the ServiceArea cluster. Defaults to 1 (Living).
|
|
116
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
117
|
-
*/
|
|
118
|
-
createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea) {
|
|
119
|
-
this.behaviors.require(MatterbridgeServiceAreaServer, {
|
|
49
|
+
createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea, supportedMaps) {
|
|
50
|
+
this.behaviors.require(MatterbridgeServiceAreaServer.with(ServiceArea.Feature.Maps), {
|
|
120
51
|
supportedAreas: supportedAreas ?? [
|
|
121
52
|
{
|
|
122
53
|
areaId: 1,
|
|
123
54
|
mapId: null,
|
|
124
|
-
areaInfo: { locationInfo: { locationName: 'Living', floorNumber:
|
|
55
|
+
areaInfo: { locationInfo: { locationName: 'Living', floorNumber: 0, areaType: AreaNamespaceTag.LivingRoom.tag }, landmarkInfo: null },
|
|
125
56
|
},
|
|
126
57
|
{
|
|
127
58
|
areaId: 2,
|
|
128
59
|
mapId: null,
|
|
129
|
-
areaInfo: { locationInfo: { locationName: 'Kitchen', floorNumber:
|
|
60
|
+
areaInfo: { locationInfo: { locationName: 'Kitchen', floorNumber: 0, areaType: AreaNamespaceTag.Kitchen.tag }, landmarkInfo: null },
|
|
130
61
|
},
|
|
131
62
|
{
|
|
132
63
|
areaId: 3,
|
|
133
64
|
mapId: null,
|
|
134
|
-
areaInfo: { locationInfo: { locationName: 'Bedroom', floorNumber:
|
|
65
|
+
areaInfo: { locationInfo: { locationName: 'Bedroom', floorNumber: 1, areaType: AreaNamespaceTag.Bedroom.tag }, landmarkInfo: null },
|
|
135
66
|
},
|
|
136
67
|
{
|
|
137
68
|
areaId: 4,
|
|
138
69
|
mapId: null,
|
|
139
|
-
areaInfo: { locationInfo: { locationName: 'Bathroom', floorNumber:
|
|
70
|
+
areaInfo: { locationInfo: { locationName: 'Bathroom', floorNumber: 1, areaType: AreaNamespaceTag.Bathroom.tag }, landmarkInfo: null },
|
|
140
71
|
},
|
|
141
72
|
],
|
|
142
73
|
selectedAreas: selectedAreas ?? [],
|
|
143
74
|
currentArea: currentArea ?? 1,
|
|
75
|
+
supportedMaps: supportedMaps ?? [],
|
|
144
76
|
estimatedEndTime: null,
|
|
145
77
|
});
|
|
146
78
|
return this;
|
|
147
79
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Creates a default RvcOperationalState Cluster Server.
|
|
150
|
-
*
|
|
151
|
-
* @param {string[] | null} [phaseList] - The list of phases for the RvcOperationalState cluster. Defaults to null.
|
|
152
|
-
* @param {number | null} [currentPhase] - The current phase (the index of the phaseList) of the RvcOperationalState cluster. Defaults to null.
|
|
153
|
-
* @param {RvcOperationalState.OperationalStateStruct[]} [operationalStateList] - The list of operational states for the RvcOperationalState cluster. Defaults to a predefined set of states.
|
|
154
|
-
* @param {RvcOperationalState.OperationalState} [operationalState] - The current operationalStateId of the RvcOperationalState cluster. Defaults to Docked.
|
|
155
|
-
* @param {RvcOperationalState.ErrorStateStruct} [operationalError] - The current operational error of the RvcOperationalState cluster. Defaults to NoError.
|
|
156
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
157
|
-
*/
|
|
158
80
|
createDefaultRvcOperationalStateClusterServer(phaseList = null, currentPhase = null, operationalStateList, operationalState, operationalError) {
|
|
159
81
|
this.behaviors.require(MatterbridgeRvcOperationalStateServer, {
|
|
160
82
|
phaseList,
|
|
@@ -164,9 +86,9 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
164
86
|
{ operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
|
|
165
87
|
{ operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
|
|
166
88
|
{ operationalStateId: RvcOperationalState.OperationalState.Error, operationalStateLabel: 'Error' },
|
|
167
|
-
{ operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
|
|
168
|
-
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
|
169
|
-
{ 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' },
|
|
170
92
|
],
|
|
171
93
|
operationalState: operationalState ?? RvcOperationalState.OperationalState.Docked,
|
|
172
94
|
operationalError: operationalError ?? { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
|
|
@@ -221,7 +143,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
221
143
|
device.log.info(`Pause (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
222
144
|
device.commandHandler.executeHandler('pause', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
223
145
|
device.log.debug('MatterbridgeRvcOperationalStateServer: pause called setting operational state to Paused and currentMode to Idle');
|
|
224
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
146
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
225
147
|
this.state.operationalState = RvcOperationalState.OperationalState.Paused;
|
|
226
148
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
227
149
|
return {
|
|
@@ -233,7 +155,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
233
155
|
device.log.info(`Resume (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
234
156
|
device.commandHandler.executeHandler('resume', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
235
157
|
device.log.debug('MatterbridgeRvcOperationalStateServer: resume called setting operational state to Running and currentMode to Cleaning');
|
|
236
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
158
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
237
159
|
this.state.operationalState = RvcOperationalState.OperationalState.Running;
|
|
238
160
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
239
161
|
return {
|
|
@@ -241,12 +163,11 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
241
163
|
};
|
|
242
164
|
}
|
|
243
165
|
goHome() {
|
|
244
|
-
// const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
|
|
245
166
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
246
167
|
device.log.info(`GoHome (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
247
168
|
device.commandHandler.executeHandler('goHome', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
248
169
|
device.log.debug('MatterbridgeRvcOperationalStateServer: goHome called setting operational state to Docked and currentMode to Idle');
|
|
249
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
170
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
250
171
|
this.state.operationalState = RvcOperationalState.OperationalState.Docked;
|
|
251
172
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
252
173
|
return {
|
|
@@ -254,4 +175,3 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
254
175
|
};
|
|
255
176
|
}
|
|
256
177
|
}
|
|
257
|
-
//# 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
|