@matterbridge/core 3.11.2 → 3.11.3-dev-20261109-ca46ffb
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/dist/backend.d.ts +4 -2
- package/dist/backend.js +13 -5
- package/dist/backendExpress.d.ts +0 -1
- package/dist/backendExpress.js +19 -9
- package/dist/backendWsServer.d.ts +2 -1
- package/dist/backendWsServer.js +124 -6
- package/dist/behaviors/export.d.ts +3 -0
- package/dist/behaviors/export.js +3 -0
- package/dist/behaviors/timeSynchronizationServer.d.ts +34 -0
- package/dist/behaviors/timeSynchronizationServer.js +202 -0
- package/dist/behaviors/tlsCertificateManagementServer.d.ts +58 -0
- package/dist/behaviors/tlsCertificateManagementServer.js +352 -0
- package/dist/behaviors/tlsClientManagementServer.d.ts +21 -0
- package/dist/behaviors/tlsClientManagementServer.js +110 -0
- package/dist/behaviors/windowCoveringServer.d.ts +63 -0
- package/dist/behaviors/windowCoveringServer.js +3 -0
- package/dist/cli.js +1 -1
- package/dist/deviceManager.d.ts +2 -4
- package/dist/deviceManager.js +7 -24
- package/dist/frontend.d.ts +2 -3
- package/dist/frontend.js +81 -90
- package/dist/matterNode.d.ts +4 -1
- package/dist/matterNode.js +62 -24
- package/dist/matterNodeHelpers.d.ts +104 -2
- package/dist/matterNodeHelpers.js +45 -1
- package/dist/matterbridge.js +15 -19
- package/dist/matterbridgeEndpoint.js +5 -63
- package/dist/matterbridgeEndpointCommandHandler.d.ts +0 -25
- package/dist/matterbridgeEndpointHelpers.d.ts +5 -0
- package/dist/matterbridgeEndpointHelpers.js +82 -3
- package/dist/matterbridgePlatform.js +52 -0
- package/dist/pluginManager.js +24 -1
- package/package.json +6 -6
|
@@ -83,10 +83,10 @@ import { MatterbridgeTemperatureAlarmServer } from './behaviors/temperatureAlarm
|
|
|
83
83
|
import { MatterbridgeThermostatServer } from './behaviors/thermostatServer.js';
|
|
84
84
|
import { MatterbridgeValveConfigurationAndControlServer } from './behaviors/valveConfigurationAndControlServer.js';
|
|
85
85
|
import { MatterbridgeWaterTankLevelMonitoringServer } from './behaviors/waterTankLevelMonitoringServer.js';
|
|
86
|
-
import {
|
|
86
|
+
import { MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeTiltWindowCoveringServer } from './behaviors/windowCoveringServer.js';
|
|
87
87
|
import { DeviceClasses } from './matterbridgeDeviceTypes.js';
|
|
88
88
|
import { CommandHandler, } from './matterbridgeEndpointCommandHandler.js';
|
|
89
|
-
import { addClusterClients, addClusterServers, addFixedLabel, addOptionalClusterClients, addOptionalClusterServers, addRequiredClusterClients, addRequiredClusterServers, addUserLabel, checkNotLatinCharacters, createUniqueId, defaultFor, emitCommand, featuresFor, generateUniqueId, getApparentElectricalPowerMeasurementClusterServer, getAttribute, getAttributeId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getCluster, getClusterId, getDefaultDeviceEnergyManagementClusterServer, getDefaultDeviceEnergyManagementModeClusterServer, getDefaultElectricalEnergyMeasurementClusterServer, getDefaultElectricalPowerMeasurementClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultOccupancySensingClusterServer, getDefaultOperationalStateClusterServer, getDefaultPowerSourceBatteryClusterServer, getDefaultPowerSourceRechargeableBatteryClusterServer, getDefaultPowerSourceReplaceableBatteryClusterServer, getDefaultPowerSourceWiredClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultSoilMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getExportedElectricalEnergyMeasurementClusterServer, getImportedElectricalEnergyMeasurementClusterServer, invokeBehaviorCommand, lowercaseFirstLetter, setAttribute, setCluster, subscribeAttribute, subscribeCommand, triggerEvent, updateAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
89
|
+
import { addClusterClients, addClusterServers, addFixedLabel, addOptionalClusterClients, addOptionalClusterServers, addRequiredClusterClients, addRequiredClusterServers, addUserLabel, checkNotLatinCharacters, createUniqueId, defaultFor, emitCommand, featuresFor, generateUniqueId, getApparentElectricalPowerMeasurementClusterServer, getAttribute, getAttributeId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getCluster, getClusterId, getDefaultDeviceEnergyManagementClusterServer, getDefaultDeviceEnergyManagementModeClusterServer, getDefaultElectricalEnergyMeasurementClusterServer, getDefaultElectricalPowerMeasurementClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultLiftTiltWindowCoveringClusterServer, getDefaultOccupancySensingClusterServer, getDefaultOperationalStateClusterServer, getDefaultPowerSourceBatteryClusterServer, getDefaultPowerSourceRechargeableBatteryClusterServer, getDefaultPowerSourceReplaceableBatteryClusterServer, getDefaultPowerSourceWiredClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultSoilMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultTiltWindowCoveringClusterServer, getDefaultWindowCoveringClusterServer, getExportedElectricalEnergyMeasurementClusterServer, getImportedElectricalEnergyMeasurementClusterServer, invokeBehaviorCommand, lowercaseFirstLetter, setAttribute, setCluster, subscribeAttribute, subscribeCommand, triggerEvent, updateAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
90
90
|
logModuleLoaded('MatterbridgeEndpoint');
|
|
91
91
|
const deviceClassifications = {
|
|
92
92
|
[DeviceClasses.Node]: DeviceClassification.Node,
|
|
@@ -844,73 +844,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
createDefaultWindowCoveringClusterServer(positionPercent100ths = 0, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade, movementDuration = 0) {
|
|
847
|
-
this.behaviors.require(
|
|
848
|
-
type,
|
|
849
|
-
numberOfActuationsLift: 0,
|
|
850
|
-
configStatus: {
|
|
851
|
-
operational: true,
|
|
852
|
-
liftMovementReversed: false,
|
|
853
|
-
liftPositionAware: true,
|
|
854
|
-
tiltPositionAware: false,
|
|
855
|
-
liftEncoderControlled: false,
|
|
856
|
-
tiltEncoderControlled: false,
|
|
857
|
-
},
|
|
858
|
-
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped },
|
|
859
|
-
endProductType,
|
|
860
|
-
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
861
|
-
targetPositionLiftPercent100ths: positionPercent100ths,
|
|
862
|
-
currentPositionLiftPercent100ths: positionPercent100ths,
|
|
863
|
-
currentPositionLiftPercentage: positionPercent100ths === null ? null : Math.floor(positionPercent100ths / 100),
|
|
864
|
-
movementDuration,
|
|
865
|
-
});
|
|
847
|
+
this.behaviors.require(MatterbridgeLiftWindowCoveringServer, getDefaultWindowCoveringClusterServer(positionPercent100ths, type, endProductType, movementDuration));
|
|
866
848
|
return this;
|
|
867
849
|
}
|
|
868
850
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths = 0, positionTiltPercent100ths = 0, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind, movementDuration = 0) {
|
|
869
|
-
this.behaviors.require(
|
|
870
|
-
type,
|
|
871
|
-
numberOfActuationsLift: 0,
|
|
872
|
-
numberOfActuationsTilt: 0,
|
|
873
|
-
configStatus: {
|
|
874
|
-
operational: true,
|
|
875
|
-
liftMovementReversed: false,
|
|
876
|
-
liftPositionAware: true,
|
|
877
|
-
tiltPositionAware: true,
|
|
878
|
-
liftEncoderControlled: false,
|
|
879
|
-
tiltEncoderControlled: false,
|
|
880
|
-
},
|
|
881
|
-
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
882
|
-
endProductType,
|
|
883
|
-
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
884
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths,
|
|
885
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths,
|
|
886
|
-
currentPositionLiftPercentage: positionLiftPercent100ths === null ? null : Math.floor(positionLiftPercent100ths / 100),
|
|
887
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
888
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
889
|
-
currentPositionTiltPercentage: positionTiltPercent100ths === null ? null : Math.floor(positionTiltPercent100ths / 100),
|
|
890
|
-
movementDuration,
|
|
891
|
-
});
|
|
851
|
+
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer, getDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type, endProductType, movementDuration));
|
|
892
852
|
return this;
|
|
893
853
|
}
|
|
894
854
|
createDefaultTiltWindowCoveringClusterServer(positionTiltPercent100ths = 0, type = WindowCovering.WindowCoveringType.TiltBlindTiltOnly, endProductType = WindowCovering.EndProductType.TiltOnlyInteriorBlind, movementDuration = 0) {
|
|
895
|
-
this.behaviors.require(
|
|
896
|
-
type,
|
|
897
|
-
numberOfActuationsTilt: 0,
|
|
898
|
-
configStatus: {
|
|
899
|
-
operational: true,
|
|
900
|
-
liftMovementReversed: false,
|
|
901
|
-
liftPositionAware: false,
|
|
902
|
-
tiltPositionAware: true,
|
|
903
|
-
liftEncoderControlled: false,
|
|
904
|
-
tiltEncoderControlled: false,
|
|
905
|
-
},
|
|
906
|
-
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
907
|
-
endProductType,
|
|
908
|
-
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
909
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
910
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
911
|
-
currentPositionTiltPercentage: positionTiltPercent100ths === null ? null : Math.floor(positionTiltPercent100ths / 100),
|
|
912
|
-
movementDuration,
|
|
913
|
-
});
|
|
855
|
+
this.behaviors.require(MatterbridgeTiltWindowCoveringServer, getDefaultTiltWindowCoveringClusterServer(positionTiltPercent100ths, type, endProductType, movementDuration));
|
|
914
856
|
return this;
|
|
915
857
|
}
|
|
916
858
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
@@ -38,7 +38,6 @@ import type { TemperatureAlarm } from '@matter/types/clusters/temperature-alarm'
|
|
|
38
38
|
import type { TemperatureControl } from '@matter/types/clusters/temperature-control';
|
|
39
39
|
import type { Thermostat } from '@matter/types/clusters/thermostat';
|
|
40
40
|
import type { ThreadNetworkDiagnostics } from '@matter/types/clusters/thread-network-diagnostics';
|
|
41
|
-
import type { TimeSynchronization } from '@matter/types/clusters/time-synchronization';
|
|
42
41
|
import type { ValveConfigurationAndControl } from '@matter/types/clusters/valve-configuration-and-control';
|
|
43
42
|
import type { WaterHeaterManagement } from '@matter/types/clusters/water-heater-management';
|
|
44
43
|
import type { WaterHeaterMode } from '@matter/types/clusters/water-heater-mode';
|
|
@@ -729,30 +728,6 @@ export type CommandHandlerDataMap = {
|
|
|
729
728
|
attributes: ClusterAttributeValues<(typeof ThreadNetworkDiagnostics)['attributes']>;
|
|
730
729
|
endpoint: MatterbridgeEndpoint;
|
|
731
730
|
};
|
|
732
|
-
'setUtcTime': CommandHandlerData<'TimeSynchronization.setUtcTime'>;
|
|
733
|
-
'setTimeZone': CommandHandlerData<'TimeSynchronization.setTimeZone'>;
|
|
734
|
-
'setDstOffset': CommandHandlerData<'TimeSynchronization.setDstOffset'>;
|
|
735
|
-
'TimeSynchronization.setUtcTime': {
|
|
736
|
-
command: 'setUtcTime';
|
|
737
|
-
request: TimeSynchronization.SetUtcTimeRequest;
|
|
738
|
-
cluster: 'timeSynchronization';
|
|
739
|
-
attributes: ClusterAttributeValues<(typeof TimeSynchronization)['attributes']>;
|
|
740
|
-
endpoint: MatterbridgeEndpoint;
|
|
741
|
-
};
|
|
742
|
-
'TimeSynchronization.setTimeZone': {
|
|
743
|
-
command: 'setTimeZone';
|
|
744
|
-
request: TimeSynchronization.SetTimeZoneRequest;
|
|
745
|
-
cluster: 'timeSynchronization';
|
|
746
|
-
attributes: ClusterAttributeValues<(typeof TimeSynchronization)['attributes']>;
|
|
747
|
-
endpoint: MatterbridgeEndpoint;
|
|
748
|
-
};
|
|
749
|
-
'TimeSynchronization.setDstOffset': {
|
|
750
|
-
command: 'setDstOffset';
|
|
751
|
-
request: TimeSynchronization.SetDstOffsetRequest;
|
|
752
|
-
cluster: 'timeSynchronization';
|
|
753
|
-
attributes: ClusterAttributeValues<(typeof TimeSynchronization)['attributes']>;
|
|
754
|
-
endpoint: MatterbridgeEndpoint;
|
|
755
|
-
};
|
|
756
731
|
'pauseRequest': CommandHandlerData<'DeviceEnergyManagement.pauseRequest'>;
|
|
757
732
|
'resumeRequest': CommandHandlerData<'DeviceEnergyManagement.resumeRequest'>;
|
|
758
733
|
'powerAdjustRequest': CommandHandlerData<'DeviceEnergyManagement.powerAdjustRequest'>;
|
|
@@ -15,6 +15,7 @@ import { PressureMeasurement } from '@matter/types/clusters/pressure-measurement
|
|
|
15
15
|
import { RelativeHumidityMeasurement } from '@matter/types/clusters/relative-humidity-measurement';
|
|
16
16
|
import { SoilMeasurement } from '@matter/types/clusters/soil-measurement';
|
|
17
17
|
import { TemperatureMeasurement } from '@matter/types/clusters/temperature-measurement';
|
|
18
|
+
import { WindowCovering } from '@matter/types/clusters/window-covering';
|
|
18
19
|
import { type ClusterId, type VendorId } from '@matter/types/datatype';
|
|
19
20
|
import { type MeasurementAccuracy, type Semtag } from '@matter/types/globals';
|
|
20
21
|
import { type AnsiLogger } from 'node-ansi-logger';
|
|
@@ -22,6 +23,7 @@ import { MatterbridgeDeviceEnergyManagementModeServer } from './behaviors/device
|
|
|
22
23
|
import { MatterbridgeDeviceEnergyManagementServer } from './behaviors/deviceEnergyManagementServer.js';
|
|
23
24
|
import { MatterbridgeOperationalStateServer } from './behaviors/operationalStateServer.js';
|
|
24
25
|
import { MatterbridgePowerSourceServer } from './behaviors/powerSourceServer.js';
|
|
26
|
+
import { MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeTiltWindowCoveringServer } from './behaviors/windowCoveringServer.js';
|
|
25
27
|
import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
26
28
|
import type { CommandHandlers } from './matterbridgeEndpointCommandHandler.js';
|
|
27
29
|
import type { SubscribeCommandListener } from './matterbridgeEndpointTypes.js';
|
|
@@ -227,6 +229,9 @@ export declare function getDefaultDeviceEnergyManagementClusterServer(esaType?:
|
|
|
227
229
|
export declare function getDefaultDeviceEnergyManagementModeClusterServer(currentMode?: number, supportedModes?: DeviceEnergyManagementMode.ModeOption[]): Partial<import("@matter/node").ClusterState.Type<ClusterType.WithSupportedFeatures<DeviceEnergyManagementMode, {
|
|
228
230
|
onOff: false;
|
|
229
231
|
}>, typeof MatterbridgeDeviceEnergyManagementModeServer>>;
|
|
232
|
+
export declare function getDefaultWindowCoveringClusterServer(positionPercent100ths?: number | null, type?: WindowCovering.WindowCoveringType, endProductType?: WindowCovering.EndProductType, movementDuration?: number): Behavior.Options<typeof MatterbridgeLiftWindowCoveringServer>;
|
|
233
|
+
export declare function getDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths?: number | null, positionTiltPercent100ths?: number | null, type?: WindowCovering.WindowCoveringType, endProductType?: WindowCovering.EndProductType, movementDuration?: number): Behavior.Options<typeof MatterbridgeLiftTiltWindowCoveringServer>;
|
|
234
|
+
export declare function getDefaultTiltWindowCoveringClusterServer(positionTiltPercent100ths?: number | null, type?: WindowCovering.WindowCoveringType, endProductType?: WindowCovering.EndProductType, movementDuration?: number): Behavior.Options<typeof MatterbridgeTiltWindowCoveringServer>;
|
|
230
235
|
export declare function getDefaultOperationalStateClusterServer(operationalState?: OperationalState.OperationalStateEnum, operationalStateList?: OperationalState.OperationalStateStruct[], operationalError?: OperationalState.ErrorStateStruct, phaseList?: string[] | null, currentPhase?: number | null): Partial<import("@matter/node").ClusterState.Type<ClusterType.WithSupportedFeatures<ClusterType.WithEnabledAttributes<ClusterType.WithEnabledEvents<OperationalState, "operationCompletion">, never>, {}>, typeof MatterbridgeOperationalStateServer>>;
|
|
231
236
|
export declare function getDefaultTemperatureMeasurementClusterServer(measuredValue?: number | null, minMeasuredValue?: number | null, maxMeasuredValue?: number | null, tolerance?: number): Partial<import("@matter/node").ClusterState.Type<TemperatureMeasurement, typeof ClusterBehavior>>;
|
|
232
237
|
export declare function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue?: number | null, minMeasuredValue?: number | null, maxMeasuredValue?: number | null, tolerance?: number): Partial<import("@matter/node").ClusterState.Type<RelativeHumidityMeasurement, typeof ClusterBehavior>>;
|
|
@@ -113,7 +113,7 @@ import { NodeId } from '@matter/types/datatype';
|
|
|
113
113
|
import { MeasurementType } from '@matter/types/globals';
|
|
114
114
|
import { deepEqual } from '@matterbridge/utils/deep-equal';
|
|
115
115
|
import { logModuleLoaded } from '@matterbridge/utils/loader';
|
|
116
|
-
import { isValidArray } from '@matterbridge/utils/validate';
|
|
116
|
+
import { isValidArray, isValidNumber } from '@matterbridge/utils/validate';
|
|
117
117
|
import { waiter } from '@matterbridge/utils/wait';
|
|
118
118
|
import { BLUE, CYAN, db, debugStringify, er, hk, nf, or, wr, YELLOW, zb } from 'node-ansi-logger';
|
|
119
119
|
import { MatterbridgeBindingServer } from './behaviors/bindingServer.js';
|
|
@@ -135,7 +135,7 @@ import { MatterbridgeSmokeCoAlarmServer } from './behaviors/smokeCoAlarmServer.j
|
|
|
135
135
|
import { MatterbridgeTemperatureAlarmServer } from './behaviors/temperatureAlarmServer.js';
|
|
136
136
|
import { MatterbridgeThermostatServer } from './behaviors/thermostatServer.js';
|
|
137
137
|
import { MatterbridgeValveConfigurationAndControlServer } from './behaviors/valveConfigurationAndControlServer.js';
|
|
138
|
-
import {
|
|
138
|
+
import { MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeTiltWindowCoveringServer } from './behaviors/windowCoveringServer.js';
|
|
139
139
|
logModuleLoaded('MatterbridgeEndpointHelpers');
|
|
140
140
|
export function capitalizeFirstLetter(name) {
|
|
141
141
|
if (!name)
|
|
@@ -288,7 +288,7 @@ export function getBehaviourTypeFromClusterServerId(clusterId) {
|
|
|
288
288
|
if (clusterId === ColorControl.id)
|
|
289
289
|
return MatterbridgeColorControlServer;
|
|
290
290
|
if (clusterId === WindowCovering.id)
|
|
291
|
-
return
|
|
291
|
+
return MatterbridgeLiftWindowCoveringServer;
|
|
292
292
|
if (clusterId === Thermostat.id)
|
|
293
293
|
return MatterbridgeThermostatServer.with('AutoMode', 'Heating', 'Cooling');
|
|
294
294
|
if (clusterId === ThermostatUserInterfaceConfiguration.id)
|
|
@@ -1116,6 +1116,85 @@ export function getDefaultDeviceEnergyManagementModeClusterServer(currentMode, s
|
|
|
1116
1116
|
currentMode: currentMode ?? 1,
|
|
1117
1117
|
});
|
|
1118
1118
|
}
|
|
1119
|
+
function windowCoveringPercentage(positionPercent100ths, name) {
|
|
1120
|
+
if (positionPercent100ths === null)
|
|
1121
|
+
return null;
|
|
1122
|
+
if (!isValidNumber(positionPercent100ths, 0, 10000) || !Number.isInteger(positionPercent100ths)) {
|
|
1123
|
+
throw new Error(`Invalid WindowCovering ${name} ${positionPercent100ths}: expected an integer from 0 to 10000 or null`);
|
|
1124
|
+
}
|
|
1125
|
+
return Math.floor(positionPercent100ths / 100);
|
|
1126
|
+
}
|
|
1127
|
+
export function getDefaultWindowCoveringClusterServer(positionPercent100ths = 0, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade, movementDuration = 0) {
|
|
1128
|
+
const currentPositionLiftPercentage = windowCoveringPercentage(positionPercent100ths, 'positionPercent100ths');
|
|
1129
|
+
return optionsFor(MatterbridgeLiftWindowCoveringServer, {
|
|
1130
|
+
type,
|
|
1131
|
+
numberOfActuationsLift: 0,
|
|
1132
|
+
configStatus: {
|
|
1133
|
+
operational: true,
|
|
1134
|
+
liftMovementReversed: false,
|
|
1135
|
+
liftPositionAware: true,
|
|
1136
|
+
tiltPositionAware: false,
|
|
1137
|
+
liftEncoderControlled: false,
|
|
1138
|
+
tiltEncoderControlled: false,
|
|
1139
|
+
},
|
|
1140
|
+
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped },
|
|
1141
|
+
endProductType,
|
|
1142
|
+
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1143
|
+
targetPositionLiftPercent100ths: positionPercent100ths,
|
|
1144
|
+
currentPositionLiftPercent100ths: positionPercent100ths,
|
|
1145
|
+
currentPositionLiftPercentage,
|
|
1146
|
+
movementDuration,
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
export function getDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths = 0, positionTiltPercent100ths = 0, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind, movementDuration = 0) {
|
|
1150
|
+
const currentPositionLiftPercentage = windowCoveringPercentage(positionLiftPercent100ths, 'positionLiftPercent100ths');
|
|
1151
|
+
const currentPositionTiltPercentage = windowCoveringPercentage(positionTiltPercent100ths, 'positionTiltPercent100ths');
|
|
1152
|
+
return optionsFor(MatterbridgeLiftTiltWindowCoveringServer, {
|
|
1153
|
+
type,
|
|
1154
|
+
numberOfActuationsLift: 0,
|
|
1155
|
+
numberOfActuationsTilt: 0,
|
|
1156
|
+
configStatus: {
|
|
1157
|
+
operational: true,
|
|
1158
|
+
liftMovementReversed: false,
|
|
1159
|
+
liftPositionAware: true,
|
|
1160
|
+
tiltPositionAware: true,
|
|
1161
|
+
liftEncoderControlled: false,
|
|
1162
|
+
tiltEncoderControlled: false,
|
|
1163
|
+
},
|
|
1164
|
+
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1165
|
+
endProductType,
|
|
1166
|
+
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1167
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths,
|
|
1168
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths,
|
|
1169
|
+
currentPositionLiftPercentage,
|
|
1170
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
1171
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
1172
|
+
currentPositionTiltPercentage,
|
|
1173
|
+
movementDuration,
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
export function getDefaultTiltWindowCoveringClusterServer(positionTiltPercent100ths = 0, type = WindowCovering.WindowCoveringType.TiltBlindTiltOnly, endProductType = WindowCovering.EndProductType.TiltOnlyInteriorBlind, movementDuration = 0) {
|
|
1177
|
+
const currentPositionTiltPercentage = windowCoveringPercentage(positionTiltPercent100ths, 'positionTiltPercent100ths');
|
|
1178
|
+
return optionsFor(MatterbridgeTiltWindowCoveringServer, {
|
|
1179
|
+
type,
|
|
1180
|
+
numberOfActuationsTilt: 0,
|
|
1181
|
+
configStatus: {
|
|
1182
|
+
operational: true,
|
|
1183
|
+
liftMovementReversed: false,
|
|
1184
|
+
liftPositionAware: false,
|
|
1185
|
+
tiltPositionAware: true,
|
|
1186
|
+
liftEncoderControlled: false,
|
|
1187
|
+
tiltEncoderControlled: false,
|
|
1188
|
+
},
|
|
1189
|
+
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1190
|
+
endProductType,
|
|
1191
|
+
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1192
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
1193
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths,
|
|
1194
|
+
currentPositionTiltPercentage,
|
|
1195
|
+
movementDuration,
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1119
1198
|
export function getDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped, operationalStateList = [
|
|
1120
1199
|
{ operationalStateId: OperationalState.OperationalStateEnum.Stopped },
|
|
1121
1200
|
{ operationalStateId: OperationalState.OperationalStateEnum.Running },
|
|
@@ -178,6 +178,58 @@ export class MatterbridgePlatform {
|
|
|
178
178
|
return;
|
|
179
179
|
this.#server.respond({ ...msg, result: { entities: this.getSelectEntities().toSorted((keyA, keyB) => keyA.name.localeCompare(keyB.name)) } });
|
|
180
180
|
break;
|
|
181
|
+
case 'platform_select_device':
|
|
182
|
+
case 'platform_unselect_device': {
|
|
183
|
+
if (msg.params.pluginName !== this.name)
|
|
184
|
+
return;
|
|
185
|
+
const { serialNumber, deviceName } = msg.params;
|
|
186
|
+
fireAndForget((async () => {
|
|
187
|
+
try {
|
|
188
|
+
if (!isValidString(serialNumber, 1) || !isValidString(deviceName, 1)) {
|
|
189
|
+
throw new Error(`Wrong parameters in ${msg.type}`);
|
|
190
|
+
}
|
|
191
|
+
const schema = await this.getSchema();
|
|
192
|
+
const properties = schema?.properties;
|
|
193
|
+
const blackList = isValidObject(properties) && 'blackList' in properties ? properties.blackList : undefined;
|
|
194
|
+
const select = isValidObject(blackList) && 'selectFrom' in blackList ? blackList.selectFrom : undefined;
|
|
195
|
+
if (select !== 'serial' && select !== 'name') {
|
|
196
|
+
throw new Error(`SelectDevice: select ${String(select)} not supported`);
|
|
197
|
+
}
|
|
198
|
+
const selected = msg.type === 'platform_select_device';
|
|
199
|
+
this.log.info(`${selected ? 'Selected' : 'Unselected'} device ${select} ${select === 'serial' ? serialNumber : deviceName}`);
|
|
200
|
+
const config = this.config;
|
|
201
|
+
if (config.postfix && !isValidString(config.postfix))
|
|
202
|
+
throw new Error('SelectDevice: postfix must be a string');
|
|
203
|
+
const serial = config.postfix ? serialNumber.replace('-' + config.postfix, '') : serialNumber;
|
|
204
|
+
const value = select === 'serial' ? serial : deviceName;
|
|
205
|
+
if (selected) {
|
|
206
|
+
if (isValidArray(config.whiteList, 1) && !config.whiteList.includes(value))
|
|
207
|
+
config.whiteList.push(value);
|
|
208
|
+
if (isValidArray(config.blackList, 1) && config.blackList.includes(value)) {
|
|
209
|
+
config.blackList = config.blackList.filter((item) => item !== value);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
if (isValidArray(config.whiteList, 1) && config.whiteList.includes(value)) {
|
|
214
|
+
config.whiteList = config.whiteList.filter((item) => item !== value);
|
|
215
|
+
}
|
|
216
|
+
if (isValidArray(config.blackList) && !config.blackList.includes(value))
|
|
217
|
+
config.blackList.push(value);
|
|
218
|
+
}
|
|
219
|
+
this.#server.request({ type: 'plugins_saveconfigfromjson', src: 'platform', dst: 'plugins', params: { name: this.name, config, restartRequired: true } });
|
|
220
|
+
this.#server.request({ type: 'matterbridge_apisettings', src: 'platform', dst: 'matterbridge', params: { restartRequired: true } });
|
|
221
|
+
this.#server.request({ type: 'frontend_restartrequired', src: 'platform', dst: 'frontend', params: { snackbar: false, fixed: false } });
|
|
222
|
+
this.#server.request({ type: 'frontend_refreshrequired', src: 'platform', dst: 'frontend', params: { changed: 'plugins' } });
|
|
223
|
+
this.#server.respond({ ...msg, result: { success: true } });
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
227
|
+
this.log.error(`${msg.type}: ${message}`);
|
|
228
|
+
this.#server.respond({ ...msg, error: message });
|
|
229
|
+
}
|
|
230
|
+
})(), this.log, `${msg.type} ${serialNumber}`);
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
181
233
|
case 'platform_unregister_device':
|
|
182
234
|
if (msg.params.pluginName === this.name) {
|
|
183
235
|
this.#server.respond({ ...msg, result: { success: true } });
|
package/dist/pluginManager.js
CHANGED
|
@@ -217,6 +217,29 @@ export class PluginManager extends EventEmitter {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
break;
|
|
220
|
+
case 'plugins_getconfig':
|
|
221
|
+
{
|
|
222
|
+
const plugin = this.get(msg.params.name);
|
|
223
|
+
if (plugin) {
|
|
224
|
+
this.server.respond({ ...msg, result: { config: plugin.configJson } });
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this.server.respond({ ...msg, result: { config: undefined } });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
case 'plugins_setconfig':
|
|
232
|
+
{
|
|
233
|
+
const plugin = this.get(msg.params.name);
|
|
234
|
+
if (plugin) {
|
|
235
|
+
plugin.configJson = msg.params.config;
|
|
236
|
+
this.server.respond({ ...msg, result: { success: true } });
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
this.server.respond({ ...msg, error: `Plugin ${msg.params.name} not found` });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
220
243
|
case 'plugins_getschema':
|
|
221
244
|
{
|
|
222
245
|
const plugin = this.get(msg.params.name);
|
|
@@ -400,7 +423,7 @@ export class PluginManager extends EventEmitter {
|
|
|
400
423
|
frontendPath: plugin.frontendPath,
|
|
401
424
|
hasWhiteList: plugin.configJson?.whiteList !== undefined,
|
|
402
425
|
hasBlackList: plugin.configJson?.blackList !== undefined,
|
|
403
|
-
matter: plugin.serverNode ? getServerNodeData(plugin.serverNode) :
|
|
426
|
+
matter: plugin.serverNode ? getServerNodeData(plugin.serverNode) : plugin.matter,
|
|
404
427
|
};
|
|
405
428
|
}
|
|
406
429
|
array() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.3-dev-20261109-ca46ffb",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -136,13 +136,13 @@
|
|
|
136
136
|
},
|
|
137
137
|
"dependencies": {
|
|
138
138
|
"@matter/main": "0.18.0",
|
|
139
|
-
"@matterbridge/dgram": "3.11.
|
|
140
|
-
"@matterbridge/thread": "3.11.
|
|
141
|
-
"@matterbridge/types": "3.11.
|
|
142
|
-
"@matterbridge/utils": "3.11.
|
|
139
|
+
"@matterbridge/dgram": "3.11.3-dev-20261109-ca46ffb",
|
|
140
|
+
"@matterbridge/thread": "3.11.3-dev-20261109-ca46ffb",
|
|
141
|
+
"@matterbridge/types": "3.11.3-dev-20261109-ca46ffb",
|
|
142
|
+
"@matterbridge/utils": "3.11.3-dev-20261109-ca46ffb",
|
|
143
143
|
"escape-html": "1.0.3",
|
|
144
144
|
"express": "5.3.0",
|
|
145
|
-
"express-rate-limit": "8.7.
|
|
145
|
+
"express-rate-limit": "8.7.3",
|
|
146
146
|
"multer": "2.5.0",
|
|
147
147
|
"node-ansi-logger": "3.3.1",
|
|
148
148
|
"node-persist-manager": "2.1.1",
|