matterbridge 3.0.7 → 3.0.8-dev-20250622-9a6255a
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 +25 -0
- package/bin/matterbridge +2 -0
- package/dist/cli.js +5 -66
- package/dist/clusters/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +2 -95
- package/dist/devices/export.js +0 -2
- package/dist/evse.js +9 -65
- package/dist/frontend.js +47 -383
- package/dist/globalMatterbridge.js +0 -20
- package/dist/helpers.js +4 -52
- package/dist/index.js +2 -29
- package/dist/laundryWasher.js +7 -92
- 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 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +53 -755
- package/dist/matterbridgeAccessoryPlatform.js +0 -34
- package/dist/matterbridgeBehaviors.js +1 -54
- package/dist/matterbridgeDeviceTypes.js +15 -578
- package/dist/matterbridgeDynamicPlatform.js +0 -34
- package/dist/matterbridgeEndpoint.js +45 -1000
- package/dist/matterbridgeEndpointHelpers.js +12 -206
- package/dist/matterbridgePlatform.js +13 -225
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +4 -270
- package/dist/roboticVacuumCleaner.js +9 -84
- package/dist/shelly.js +9 -156
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -53
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/commandLine.js +0 -53
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createDirectory.js +0 -31
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +0 -38
- package/dist/utils/deepEqual.js +1 -71
- package/dist/utils/export.js +0 -1
- package/dist/utils/hex.js +0 -57
- package/dist/utils/isvalid.js +0 -100
- package/dist/utils/network.js +6 -77
- package/dist/utils/spawn.js +0 -16
- package/dist/utils/wait.js +10 -58
- package/dist/waterHeater.js +5 -65
- package/frontend/build/matterbridge 1250x1250.png +0 -0
- package/frontend/build/matterbridge 624x624.png +0 -0
- package/frontend/package-lock.json +19176 -0
- package/frontend/package.json +79 -0
- package/frontend/public/Shelly.svg +1 -0
- package/frontend/public/bmc-button.svg +22 -0
- package/frontend/public/discord.svg +5 -0
- package/frontend/public/favicon.ico +0 -0
- package/frontend/public/index.html +19 -0
- package/frontend/public/manifest.json +15 -0
- package/frontend/public/matter.png +0 -0
- package/frontend/public/matterbridge 1250x1250.png +0 -0
- package/frontend/public/matterbridge 32x32.png +0 -0
- package/frontend/public/matterbridge 624x624.png +0 -0
- package/frontend/public/matterbridge 64x64.png +0 -0
- package/frontend/public/matterbridge.svg +50 -0
- package/frontend/public/robots.txt +3 -0
- package/npm-shrinkwrap.json +33 -42
- package/package.json +3 -4
- package/dist/cli.d.ts +0 -29
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.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 -27
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -114
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/export.d.ts +0 -5
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/evse.d.ts +0 -67
- package/dist/evse.d.ts.map +0 -1
- package/dist/evse.js.map +0 -1
- package/dist/frontend.d.ts +0 -256
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/globalMatterbridge.d.ts +0 -32
- package/dist/globalMatterbridge.d.ts.map +0 -1
- package/dist/globalMatterbridge.js.map +0 -1
- package/dist/helpers.d.ts +0 -47
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -37
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/laundryWasher.d.ts +0 -243
- package/dist/laundryWasher.d.ts.map +0 -1
- package/dist/laundryWasher.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 -445
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -40
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1333
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -644
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -40
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -1145
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -3083
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -290
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -196
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -273
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/roboticVacuumCleaner.d.ts +0 -102
- package/dist/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/roboticVacuumCleaner.js.map +0 -1
- package/dist/shelly.d.ts +0 -161
- 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 -58
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -58
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -32
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- 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 -48
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -102
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -12
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -52
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
- package/dist/waterHeater.d.ts +0 -90
- package/dist/waterHeater.d.ts.map +0 -1
- package/dist/waterHeater.js.map +0 -1
- package/tsconfig.jest.json +0 -8
- package/tsconfig.production.json +0 -13
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the RoboticVacuumCleaner class.
|
|
3
|
-
*
|
|
4
|
-
* @file roboticVacuumCleaner.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2025-05-01
|
|
7
|
-
* @version 1.1.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
// Matterbridge
|
|
24
|
-
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
25
|
-
import { roboticVacuumCleaner } from './matterbridgeDeviceTypes.js';
|
|
26
|
-
import { MatterbridgeServer, MatterbridgeServiceAreaServer } from './matterbridgeBehaviors.js';
|
|
27
1
|
import { RvcRunModeServer } from '@matter/main/behaviors/rvc-run-mode';
|
|
28
2
|
import { RvcOperationalStateServer } from '@matter/main/behaviors/rvc-operational-state';
|
|
29
3
|
import { RvcCleanModeServer } from '@matter/main/behaviors/rvc-clean-mode';
|
|
@@ -33,24 +7,10 @@ import { RvcCleanMode } from '@matter/main/clusters/rvc-clean-mode';
|
|
|
33
7
|
import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state';
|
|
34
8
|
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
35
9
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
10
|
+
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
11
|
+
import { roboticVacuumCleaner } from './matterbridgeDeviceTypes.js';
|
|
12
|
+
import { MatterbridgeServer, MatterbridgeServiceAreaServer } from './matterbridgeBehaviors.js';
|
|
36
13
|
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 {number} [currentRunMode] - The current run mode of the robotic vacuum cleaner. Defaults to 1 (Idle).
|
|
43
|
-
* @param {RvcRunMode.ModeOption[]} [supportedRunModes] - The supported run modes for the robotic vacuum cleaner. Defaults to a predefined set of modes.
|
|
44
|
-
* @param {number} [currentCleanMode] - The current clean mode of the robotic vacuum cleaner. Defaults to 1 (Vacuum).
|
|
45
|
-
* @param {RvcCleanMode.ModeOption[]} [supportedCleanModes] - The supported clean modes for the robotic vacuum cleaner. Defaults to a predefined set of modes.
|
|
46
|
-
* @param {number | null} [currentPhase] - The current phase of the robotic vacuum cleaner. Defaults to null.
|
|
47
|
-
* @param {string[] | null} [phaseList] - The list of phases for the robotic vacuum cleaner. Defaults to null.
|
|
48
|
-
* @param {RvcOperationalState.OperationalState} [operationalState] - The current operational state of the robotic vacuum cleaner. Defaults to Docked.
|
|
49
|
-
* @param {RvcOperationalState.OperationalStateStruct[]} [operationalStateList] - The list of operational states for the robotic vacuum cleaner. Defaults to a predefined set of states.
|
|
50
|
-
* @param {ServiceArea.Area[]} [supportedAreas] - The supported areas for the robotic vacuum cleaner. Defaults to a predefined set of areas.
|
|
51
|
-
* @param {number[]} [selectedAreas] - The selected areas for the robotic vacuum cleaner. Defaults to an empty array (all areas allowed).
|
|
52
|
-
* @param {number} [currentArea] - The current area of the robotic vacuum cleaner. Defaults to 1 (Living).
|
|
53
|
-
*/
|
|
54
14
|
constructor(name, serial, currentRunMode, supportedRunModes, currentCleanMode, supportedCleanModes, currentPhase = null, phaseList = null, operationalState, operationalStateList, supportedAreas, selectedAreas, currentArea) {
|
|
55
15
|
super(roboticVacuumCleaner, { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
56
16
|
this.createDefaultIdentifyClusterServer()
|
|
@@ -61,14 +21,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
61
21
|
.createDefaultRvcOperationalStateClusterServer(phaseList, currentPhase, operationalStateList, operationalState)
|
|
62
22
|
.createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea);
|
|
63
23
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Creates a default RvcRunMode Cluster Server.
|
|
66
|
-
*
|
|
67
|
-
* @param {number} [currentMode] - The current mode of the RvcRunMode cluster. Defaults to 1 (Idle).
|
|
68
|
-
* @param {RvcRunMode.ModeOption[]} [supportedModes] - The supported modes for the RvcRunMode cluster. Defaults to a predefined set of modes.
|
|
69
|
-
*
|
|
70
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
71
|
-
*/
|
|
72
24
|
createDefaultRvcRunModeClusterServer(currentMode, supportedModes) {
|
|
73
25
|
this.behaviors.require(MatterbridgeRvcRunModeServer, {
|
|
74
26
|
supportedModes: supportedModes ?? [
|
|
@@ -81,14 +33,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
81
33
|
});
|
|
82
34
|
return this;
|
|
83
35
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Creates a default RvcCleanMode Cluster Server.
|
|
86
|
-
*
|
|
87
|
-
* @param {number} [currentMode] - The current mode of the RvcCleanMode cluster. Defaults to 1 (Vacuum).
|
|
88
|
-
* @param {RvcCleanMode.ModeOption[]} [supportedModes] - The supported modes for the RvcCleanMode cluster. Defaults to a predefined set of modes.
|
|
89
|
-
*
|
|
90
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
91
|
-
*/
|
|
92
36
|
createDefaultRvcCleanModeClusterServer(currentMode, supportedModes) {
|
|
93
37
|
this.behaviors.require(MatterbridgeRvcCleanModeServer, {
|
|
94
38
|
supportedModes: supportedModes ?? [
|
|
@@ -100,13 +44,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
100
44
|
});
|
|
101
45
|
return this;
|
|
102
46
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Creates a default ServiceArea Cluster Server.
|
|
105
|
-
*
|
|
106
|
-
* @param {ServiceArea.Area[]} [supportedAreas] - The supported areas for the ServiceArea cluster. Defaults to a predefined set of areas.
|
|
107
|
-
* @param {number[]} [selectedAreas] - The selected areas for the ServiceArea cluster. Defaults to an empty array (all areas allowed).
|
|
108
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
109
|
-
*/
|
|
110
47
|
createDefaultServiceAreaClusterServer(supportedAreas, selectedAreas, currentArea) {
|
|
111
48
|
this.behaviors.require(MatterbridgeServiceAreaServer, {
|
|
112
49
|
supportedAreas: supportedAreas ?? [
|
|
@@ -137,16 +74,6 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
137
74
|
});
|
|
138
75
|
return this;
|
|
139
76
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Creates a default RvcOperationalState Cluster Server.
|
|
142
|
-
*
|
|
143
|
-
* @param {string[] | null} [phaseList] - The list of phases for the RvcOperationalState cluster. Defaults to null.
|
|
144
|
-
* @param {number | null} [currentPhase] - The current phase of the RvcOperationalState cluster. Defaults to null.
|
|
145
|
-
* @param {RvcOperationalState.OperationalStateStruct[]} [operationalStateList] - The list of operational states for the RvcOperationalState cluster. Defaults to a predefined set of states.
|
|
146
|
-
* @param {RvcOperationalState.OperationalState} [operationalState] - The current operational state of the RvcOperationalState cluster. Defaults to Docked.
|
|
147
|
-
* @param {RvcOperationalState.ErrorStateStruct} [operationalError] - The current operational error of the RvcOperationalState cluster. Defaults to NoError.
|
|
148
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
149
|
-
*/
|
|
150
77
|
createDefaultRvcOperationalStateClusterServer(phaseList = null, currentPhase = null, operationalStateList, operationalState, operationalError) {
|
|
151
78
|
this.behaviors.require(MatterbridgeRvcOperationalStateServer, {
|
|
152
79
|
phaseList,
|
|
@@ -156,9 +83,9 @@ export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
|
|
|
156
83
|
{ operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
|
|
157
84
|
{ operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
|
|
158
85
|
{ operationalStateId: RvcOperationalState.OperationalState.Error, operationalStateLabel: 'Error' },
|
|
159
|
-
{ operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
|
|
160
|
-
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
|
161
|
-
{ operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
|
|
86
|
+
{ operationalStateId: RvcOperationalState.OperationalState.SeekingCharger, operationalStateLabel: 'SeekingCharger' },
|
|
87
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
|
88
|
+
{ operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
|
|
162
89
|
],
|
|
163
90
|
operationalState: operationalState ?? RvcOperationalState.OperationalState.Docked,
|
|
164
91
|
operationalError: operationalError ?? { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
|
|
@@ -213,7 +140,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
213
140
|
device.log.info(`Pause (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
214
141
|
device.commandHandler.executeHandler('pause', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
215
142
|
device.log.debug('MatterbridgeRvcOperationalStateServer: pause called setting operational state to Paused and currentMode to Idle');
|
|
216
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
143
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
217
144
|
this.state.operationalState = RvcOperationalState.OperationalState.Paused;
|
|
218
145
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
219
146
|
return {
|
|
@@ -225,7 +152,7 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
225
152
|
device.log.info(`Resume (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
226
153
|
device.commandHandler.executeHandler('resume', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
227
154
|
device.log.debug('MatterbridgeRvcOperationalStateServer: resume called setting operational state to Running and currentMode to Cleaning');
|
|
228
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
155
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
229
156
|
this.state.operationalState = RvcOperationalState.OperationalState.Running;
|
|
230
157
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
231
158
|
return {
|
|
@@ -233,12 +160,11 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
233
160
|
};
|
|
234
161
|
}
|
|
235
162
|
goHome() {
|
|
236
|
-
// const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
|
|
237
163
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
238
164
|
device.log.info(`GoHome (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
239
165
|
device.commandHandler.executeHandler('goHome', { request: {}, cluster: RvcOperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
|
|
240
166
|
device.log.debug('MatterbridgeRvcOperationalStateServer: goHome called setting operational state to Docked and currentMode to Idle');
|
|
241
|
-
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
167
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
242
168
|
this.state.operationalState = RvcOperationalState.OperationalState.Docked;
|
|
243
169
|
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
244
170
|
return {
|
|
@@ -246,4 +172,3 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateSe
|
|
|
246
172
|
};
|
|
247
173
|
}
|
|
248
174
|
}
|
|
249
|
-
//# sourceMappingURL=roboticVacuumCleaner.js.map
|
package/dist/shelly.js
CHANGED
|
@@ -1,53 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
* This file contains the shelly api functions.
|
|
3
|
-
*
|
|
4
|
-
* @file shelly.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2025-02-19
|
|
7
|
-
* @version 1.1.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 { debugStringify } from 'node-ansi-logger';
|
|
23
2
|
import { WS_ID_SHELLY_MAIN_UPDATE, WS_ID_SHELLY_SYS_UPDATE } from './frontend.js';
|
|
24
|
-
import { debugStringify } from './logger/export.js';
|
|
25
3
|
let verifyIntervalSecs = 15;
|
|
26
4
|
let verifyTimeoutSecs = 600;
|
|
27
|
-
/**
|
|
28
|
-
* Sets the interval for verification in seconds.
|
|
29
|
-
*
|
|
30
|
-
* @param {number} seconds - The interval in seconds.
|
|
31
|
-
* @returns {void}
|
|
32
|
-
*/
|
|
33
5
|
export function setVerifyIntervalSecs(seconds) {
|
|
34
6
|
verifyIntervalSecs = seconds;
|
|
35
7
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Sets the timeout for verification in seconds.
|
|
38
|
-
*
|
|
39
|
-
* @param {number} seconds - The timeout in seconds.
|
|
40
|
-
* @returns {void}
|
|
41
|
-
*/
|
|
42
8
|
export function setVerifyTimeoutSecs(seconds) {
|
|
43
9
|
verifyTimeoutSecs = seconds;
|
|
44
10
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Fetches Shelly system updates. If available: logs the result, sends a snackbar message, and broadcasts the message.
|
|
47
|
-
*
|
|
48
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
49
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
50
|
-
*/
|
|
51
11
|
export async function getShellySysUpdate(matterbridge) {
|
|
52
12
|
try {
|
|
53
13
|
const updates = (await getShelly('/api/updates/sys/check'));
|
|
@@ -66,33 +26,19 @@ export async function getShellySysUpdate(matterbridge) {
|
|
|
66
26
|
matterbridge.log.error(`Error getting Shelly system updates: ${err instanceof Error ? err.message : String(err)}`);
|
|
67
27
|
}
|
|
68
28
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Triggers Shelly system updates.
|
|
71
|
-
*
|
|
72
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
73
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
74
|
-
*/
|
|
75
29
|
export async function triggerShellySysUpdate(matterbridge) {
|
|
76
30
|
try {
|
|
77
|
-
// Trigger the update request
|
|
78
31
|
await getShelly('/api/updates/sys/perform');
|
|
79
32
|
matterbridge.log.notice('Installing Shelly system update...');
|
|
80
33
|
matterbridge.matterbridgeInformation.shellySysUpdate = false;
|
|
81
34
|
matterbridge.frontend.wssSendSnackbarMessage('Installing Shelly system update...', 15);
|
|
82
35
|
matterbridge.frontend.wssBroadcastMessage(WS_ID_SHELLY_SYS_UPDATE, 'shelly-sys-update', { available: false });
|
|
83
|
-
// Begin polling update status
|
|
84
36
|
await verifyShellyUpdate(matterbridge, '/api/updates/sys/status', 'Shelly system update');
|
|
85
37
|
}
|
|
86
38
|
catch (err) {
|
|
87
39
|
matterbridge.log.error(`Error triggering Shelly system update: ${err instanceof Error ? err.message : String(err)}`);
|
|
88
40
|
}
|
|
89
41
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Fetches Shelly main updates. If available: logs the result, sends a snackbar message, and broadcasts the message.
|
|
92
|
-
*
|
|
93
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
94
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
95
|
-
*/
|
|
96
42
|
export async function getShellyMainUpdate(matterbridge) {
|
|
97
43
|
try {
|
|
98
44
|
const updates = (await getShelly('/api/updates/main/check'));
|
|
@@ -111,33 +57,19 @@ export async function getShellyMainUpdate(matterbridge) {
|
|
|
111
57
|
matterbridge.log.error(`Error getting Shelly main updates: ${err instanceof Error ? err.message : String(err)}`);
|
|
112
58
|
}
|
|
113
59
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Triggers Shelly main updates.
|
|
116
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
117
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
118
|
-
*/
|
|
119
60
|
export async function triggerShellyMainUpdate(matterbridge) {
|
|
120
61
|
try {
|
|
121
|
-
// Trigger the perform-update request
|
|
122
62
|
await getShelly('/api/updates/main/perform');
|
|
123
63
|
matterbridge.log.notice('Installing Shelly software update...');
|
|
124
64
|
matterbridge.matterbridgeInformation.shellyMainUpdate = false;
|
|
125
65
|
matterbridge.frontend.wssSendSnackbarMessage('Installing Shelly software update...', 15);
|
|
126
66
|
matterbridge.frontend.wssBroadcastMessage(WS_ID_SHELLY_MAIN_UPDATE, 'shelly-main-update', { available: false });
|
|
127
|
-
// Begin polling the update status
|
|
128
67
|
await verifyShellyUpdate(matterbridge, '/api/updates/main/status', 'Shelly software update');
|
|
129
68
|
}
|
|
130
69
|
catch (err) {
|
|
131
70
|
matterbridge.log.error(`Error triggering Shelly main update: ${err instanceof Error ? err.message : String(err)}`);
|
|
132
71
|
}
|
|
133
72
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Verifies Shelly update.
|
|
136
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
137
|
-
* @param {string} api - The api to call: /api/updates/sys/status or /api/updates/main/status
|
|
138
|
-
* @param {string} name - The name of the update.
|
|
139
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
140
|
-
*/
|
|
141
73
|
export async function verifyShellyUpdate(matterbridge, api, name) {
|
|
142
74
|
return new Promise((resolve) => {
|
|
143
75
|
const timeout = setTimeout(() => {
|
|
@@ -145,9 +77,9 @@ export async function verifyShellyUpdate(matterbridge, api, name) {
|
|
|
145
77
|
matterbridge.frontend.wssSendCloseSnackbarMessage(`${name} in progress...`);
|
|
146
78
|
clearInterval(interval);
|
|
147
79
|
resolve();
|
|
148
|
-
}, verifyTimeoutSecs * 1000);
|
|
80
|
+
}, verifyTimeoutSecs * 1000);
|
|
149
81
|
const interval = setInterval(() => {
|
|
150
|
-
getShelly(api, 10 * 1000)
|
|
82
|
+
getShelly(api, 10 * 1000)
|
|
151
83
|
.then(async (data) => {
|
|
152
84
|
if (data.updatingInProgress) {
|
|
153
85
|
matterbridge.log.debug(`${name} in progress...`);
|
|
@@ -161,6 +93,7 @@ export async function verifyShellyUpdate(matterbridge, api, name) {
|
|
|
161
93
|
clearTimeout(timeout);
|
|
162
94
|
resolve();
|
|
163
95
|
}
|
|
96
|
+
return;
|
|
164
97
|
})
|
|
165
98
|
.catch((error) => {
|
|
166
99
|
matterbridge.log.error(`Error getting status of ${name}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -169,15 +102,9 @@ export async function verifyShellyUpdate(matterbridge, api, name) {
|
|
|
169
102
|
clearTimeout(timeout);
|
|
170
103
|
resolve();
|
|
171
104
|
});
|
|
172
|
-
}, verifyIntervalSecs * 1000);
|
|
105
|
+
}, verifyIntervalSecs * 1000);
|
|
173
106
|
});
|
|
174
107
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Triggers Shelly change network configuration.
|
|
177
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
178
|
-
* @param {object} config - The network configuration.
|
|
179
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
180
|
-
*/
|
|
181
108
|
export async function triggerShellyChangeIp(matterbridge, config) {
|
|
182
109
|
const api = config.type === 'static' ? '/api/network/connection/static' : '/api/network/connection/dynamic';
|
|
183
110
|
const data = { interface: 'end0' };
|
|
@@ -200,11 +127,6 @@ export async function triggerShellyChangeIp(matterbridge, config) {
|
|
|
200
127
|
matterbridge.frontend.wssSendSnackbarMessage('Error changing Shelly network configuration', 10, 'error');
|
|
201
128
|
}
|
|
202
129
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Triggers Shelly system reboot.
|
|
205
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
206
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
207
|
-
*/
|
|
208
130
|
export async function triggerShellyReboot(matterbridge) {
|
|
209
131
|
matterbridge.log.debug(`Triggering Shelly system reboot`);
|
|
210
132
|
try {
|
|
@@ -222,13 +144,6 @@ export async function triggerShellyReboot(matterbridge) {
|
|
|
222
144
|
matterbridge.frontend.wssSendSnackbarMessage('Error rebooting Shelly board', 10, 'error');
|
|
223
145
|
}
|
|
224
146
|
}
|
|
225
|
-
/**
|
|
226
|
-
* Triggers Shelly soft reset.
|
|
227
|
-
* It will replaces network config with the default one (edn0 on dhcp).
|
|
228
|
-
*
|
|
229
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
230
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
231
|
-
*/
|
|
232
147
|
export async function triggerShellySoftReset(matterbridge) {
|
|
233
148
|
matterbridge.log.debug(`Triggering Shelly soft reset`);
|
|
234
149
|
try {
|
|
@@ -246,13 +161,6 @@ export async function triggerShellySoftReset(matterbridge) {
|
|
|
246
161
|
matterbridge.frontend.wssSendSnackbarMessage('Error resetting the network parameters on Shelly board', 10, 'error');
|
|
247
162
|
}
|
|
248
163
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Triggers Shelly hard reset.
|
|
251
|
-
* It will do a hard reset and will remove both directories .matterbridge Matterbridge.
|
|
252
|
-
*
|
|
253
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
254
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
255
|
-
*/
|
|
256
164
|
export async function triggerShellyHardReset(matterbridge) {
|
|
257
165
|
matterbridge.log.debug(`Triggering Shelly hard reset`);
|
|
258
166
|
try {
|
|
@@ -270,12 +178,6 @@ export async function triggerShellyHardReset(matterbridge) {
|
|
|
270
178
|
matterbridge.frontend.wssSendSnackbarMessage('Error while factory resetting the Shelly board', 10, 'error');
|
|
271
179
|
}
|
|
272
180
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Fetches Shelly system log and write it to shelly.log.
|
|
275
|
-
*
|
|
276
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
277
|
-
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
278
|
-
*/
|
|
279
181
|
export async function createShellySystemLog(matterbridge) {
|
|
280
182
|
const { promises: fs } = await import('node:fs');
|
|
281
183
|
const path = await import('node:path');
|
|
@@ -290,27 +192,6 @@ export async function createShellySystemLog(matterbridge) {
|
|
|
290
192
|
matterbridge.log.error(`Error getting Shelly system log: ${error instanceof Error ? error.message : error}`);
|
|
291
193
|
}
|
|
292
194
|
}
|
|
293
|
-
/**
|
|
294
|
-
* Perform a GET to Shelly board apis.
|
|
295
|
-
* @param {string} api - The api to call:
|
|
296
|
-
*
|
|
297
|
-
* /api/updates/sys/check => [{name:string; ...}]
|
|
298
|
-
* /api/updates/sys/perform => {"updatingInProgress":true} or {"updatingInProgress":false}
|
|
299
|
-
* /api/updates/sys/status => {"updatingInProgress":true} or {"updatingInProgress":false}
|
|
300
|
-
* /api/updates/main/check => [{name:string; ...}]
|
|
301
|
-
* /api/updates/main/perform => {"updatingInProgress":true} or {"updatingInProgress":false}
|
|
302
|
-
* /api/updates/main/status => {"updatingInProgress":true} or {"updatingInProgress":false}
|
|
303
|
-
*
|
|
304
|
-
* /api/logs/system => text
|
|
305
|
-
*
|
|
306
|
-
* /api/reset/soft => "ok" Replaces network config with default one (edn0 on dhcp)
|
|
307
|
-
* /api/reset/hard => reboot on success Hard reset makes soft reset + removing both directories .matterbridge Matterbridge + reboot
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* @param {number} [timeout=60000] - The timeout duration in milliseconds (default is 60000ms).
|
|
311
|
-
* @returns {Promise<any>} A promise that resolves to the response.
|
|
312
|
-
* @throws {Error} If the request fails.
|
|
313
|
-
*/
|
|
314
195
|
export async function getShelly(api, timeout = 60000) {
|
|
315
196
|
const http = await import('node:http');
|
|
316
197
|
return new Promise((resolve, reject) => {
|
|
@@ -324,13 +205,12 @@ export async function getShelly(api, timeout = 60000) {
|
|
|
324
205
|
let data = '';
|
|
325
206
|
if (res.statusCode !== 200) {
|
|
326
207
|
clearTimeout(timeoutId);
|
|
327
|
-
res.resume();
|
|
328
|
-
req.destroy();
|
|
208
|
+
res.resume();
|
|
209
|
+
req.destroy();
|
|
329
210
|
reject(new Error(`Failed to fetch data. Status code: ${res.statusCode}`));
|
|
330
211
|
return;
|
|
331
212
|
}
|
|
332
213
|
res.on('data', (chunk) => {
|
|
333
|
-
// console.log(chunk);
|
|
334
214
|
data += chunk;
|
|
335
215
|
});
|
|
336
216
|
res.on('end', () => {
|
|
@@ -345,7 +225,6 @@ export async function getShelly(api, timeout = 60000) {
|
|
|
345
225
|
}
|
|
346
226
|
}
|
|
347
227
|
else {
|
|
348
|
-
// console.log(data);
|
|
349
228
|
resolve(data);
|
|
350
229
|
}
|
|
351
230
|
});
|
|
@@ -356,29 +235,6 @@ export async function getShelly(api, timeout = 60000) {
|
|
|
356
235
|
});
|
|
357
236
|
});
|
|
358
237
|
}
|
|
359
|
-
/**
|
|
360
|
-
* Perform a POST request to Shelly board apis.
|
|
361
|
-
* @param {string} api - The api to call:
|
|
362
|
-
*
|
|
363
|
-
* Set static ip
|
|
364
|
-
* /api/network/connection/static -d '{"interface": "end0", "addr": "10.11.12.101", "mask": "255.255.255.0", "gw": "10.11.12.1", "dns": "1.1.1.1"}' => {}
|
|
365
|
-
*
|
|
366
|
-
* Set dhcp
|
|
367
|
-
* /api/network/connection/dynamic -d '{"interface": "end0"}' => {}
|
|
368
|
-
*
|
|
369
|
-
* Reboot
|
|
370
|
-
* /api/system/reboot => {"success":true}
|
|
371
|
-
*
|
|
372
|
-
* curl -H "Content-Type: application/json" -X POST http://127.0.0.1:8101/api/network/connection/dynamic
|
|
373
|
-
* -d '{"interface": "end0"}'
|
|
374
|
-
*
|
|
375
|
-
* curl -H "Content-Type: application/json" -X POST http://127.0.0.1:8101/api/network/connection/static
|
|
376
|
-
* -d '{"interface": "end0", "addr": "192.168.1.64", "mask": "255.255.255.0", "gw": "192.168.1.1", "dns": "192.168.1.1"}'
|
|
377
|
-
*
|
|
378
|
-
* @param {number} [timeout=60000] - The timeout duration in milliseconds (default is 60000ms).
|
|
379
|
-
* @returns {Promise<any>} A promise that resolves to the response.
|
|
380
|
-
* @throws {Error} If the request fails.
|
|
381
|
-
*/
|
|
382
238
|
export async function postShelly(api, data, timeout = 60000) {
|
|
383
239
|
const http = await import('node:http');
|
|
384
240
|
return new Promise((resolve, reject) => {
|
|
@@ -399,11 +255,10 @@ export async function postShelly(api, data, timeout = 60000) {
|
|
|
399
255
|
};
|
|
400
256
|
const req = http.request(url, options, (res) => {
|
|
401
257
|
let responseData = '';
|
|
402
|
-
// Check for non-success status codes (e.g., 300+)
|
|
403
258
|
if (res.statusCode && res.statusCode >= 300) {
|
|
404
259
|
clearTimeout(timeoutId);
|
|
405
|
-
res.resume();
|
|
406
|
-
req.destroy();
|
|
260
|
+
res.resume();
|
|
261
|
+
req.destroy();
|
|
407
262
|
return reject(new Error(`Failed to post data. Status code: ${res.statusCode}`));
|
|
408
263
|
}
|
|
409
264
|
res.on('data', (chunk) => {
|
|
@@ -424,9 +279,7 @@ export async function postShelly(api, data, timeout = 60000) {
|
|
|
424
279
|
clearTimeout(timeoutId);
|
|
425
280
|
reject(new Error(`Request failed: ${error instanceof Error ? error.message : error}`));
|
|
426
281
|
});
|
|
427
|
-
// Send the JSON data
|
|
428
282
|
req.write(jsonData);
|
|
429
283
|
req.end();
|
|
430
284
|
});
|
|
431
285
|
}
|
|
432
|
-
//# sourceMappingURL=shelly.js.map
|
package/dist/storage/export.js
CHANGED
package/dist/update.js
CHANGED
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the check updates functions.
|
|
3
|
-
*
|
|
4
|
-
* @file update.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2025-02-24
|
|
7
|
-
* @version 1.0.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
|
-
// AnsiLogger module
|
|
24
1
|
import { db, nt, wr } from 'node-ansi-logger';
|
|
25
2
|
import { plg } from './matterbridgeTypes.js';
|
|
26
|
-
/**
|
|
27
|
-
* Checks for updates for Matterbridge and its plugins.
|
|
28
|
-
* If the 'shelly' parameter is present, also checks for Shelly updates.
|
|
29
|
-
*
|
|
30
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
31
|
-
* @returns {Promise<void>} A promise that resolves when the update checks are complete.
|
|
32
|
-
*/
|
|
33
3
|
export async function checkUpdates(matterbridge) {
|
|
34
4
|
const { hasParameter } = await import('./utils/commandLine.js');
|
|
35
5
|
const latestVersion = getMatterbridgeLatestVersion(matterbridge);
|
|
@@ -49,13 +19,6 @@ export async function checkUpdates(matterbridge) {
|
|
|
49
19
|
}
|
|
50
20
|
await Promise.all([latestVersion, devVersion, ...pluginsVersions, ...shellyUpdates]);
|
|
51
21
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Retrieves the latest version of Matterbridge and updates the matterbridgeLatestVersion property.
|
|
54
|
-
* If there is an error retrieving the latest version, logs an error message.
|
|
55
|
-
*
|
|
56
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
57
|
-
* @returns {Promise<String | undefined>} A promise that resolves when the latest version is retrieved.
|
|
58
|
-
*/
|
|
59
22
|
export async function getMatterbridgeLatestVersion(matterbridge) {
|
|
60
23
|
const { getNpmPackageVersion } = await import('./utils/network.js');
|
|
61
24
|
try {
|
|
@@ -77,13 +40,6 @@ export async function getMatterbridgeLatestVersion(matterbridge) {
|
|
|
77
40
|
matterbridge.log.warn(`Error getting Matterbridge latest version: ${error instanceof Error ? error.message : error}`);
|
|
78
41
|
}
|
|
79
42
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Retrieves the latest dev version of Matterbridge and updates the matterbridgeDevVersion property.
|
|
82
|
-
* If there is an error retrieving the latest version, logs an error message.
|
|
83
|
-
*
|
|
84
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
85
|
-
* @returns {Promise<string | undefined>} A promise that resolves when the latest dev version is retrieved.
|
|
86
|
-
*/
|
|
87
43
|
export async function getMatterbridgeDevVersion(matterbridge) {
|
|
88
44
|
const { getNpmPackageVersion } = await import('./utils/network.js');
|
|
89
45
|
try {
|
|
@@ -105,14 +61,6 @@ export async function getMatterbridgeDevVersion(matterbridge) {
|
|
|
105
61
|
matterbridge.log.warn(`Error getting Matterbridge latest dev version: ${error instanceof Error ? error.message : error}`);
|
|
106
62
|
}
|
|
107
63
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Retrieves the latest version of a plugin and updates the plugin's latestVersion property.
|
|
110
|
-
* If there is an error retrieving the latest version, logs an error message.
|
|
111
|
-
*
|
|
112
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
113
|
-
* @param {RegisteredPlugin} plugin - The plugin for which to retrieve the latest version.
|
|
114
|
-
* @returns {Promise<string | undefined>} A promise that resolves when the latest version is retrieved.
|
|
115
|
-
*/
|
|
116
64
|
export async function getPluginLatestVersion(matterbridge, plugin) {
|
|
117
65
|
const { getNpmPackageVersion } = await import('./utils/network.js');
|
|
118
66
|
try {
|
|
@@ -131,4 +79,3 @@ export async function getPluginLatestVersion(matterbridge, plugin) {
|
|
|
131
79
|
matterbridge.log.warn(`Error getting plugin ${plg}${plugin.name}${wr} latest version: ${error instanceof Error ? error.message : error}`);
|
|
132
80
|
}
|
|
133
81
|
}
|
|
134
|
-
//# sourceMappingURL=update.js.map
|