@matterbridge/core 3.6.0-dev-20260302-e3a7eb0 → 3.6.0-dev-20260303-2f99eca
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/clusters/closure-control.d.ts +634 -0
- package/dist/clusters/closure-control.js +170 -0
- package/dist/clusters/closure-dimension.d.ts +830 -0
- package/dist/clusters/closure-dimension.js +202 -0
- package/dist/clusters/export.d.ts +3 -1
- package/dist/clusters/export.js +3 -1
- package/dist/clusters/soil-measurement.d.ts +34 -0
- package/dist/clusters/soil-measurement.js +19 -0
- package/dist/devices/batteryStorage.js +15 -10
- package/dist/devices/closure.d.ts +165 -0
- package/dist/devices/closure.js +47 -0
- package/dist/devices/closurePanel.d.ts +204 -0
- package/dist/devices/closurePanel.js +55 -0
- package/dist/devices/customClusterSchema.d.ts +22 -0
- package/dist/devices/customClusterSchema.js +53 -0
- package/dist/devices/export.d.ts +4 -0
- package/dist/devices/export.js +4 -0
- package/dist/devices/heatPump.js +16 -8
- package/dist/devices/irrigationSystem.d.ts +9 -0
- package/dist/devices/irrigationSystem.js +12 -0
- package/dist/devices/soilSensor.d.ts +14 -0
- package/dist/devices/soilSensor.js +30 -0
- package/dist/devices/solarPower.d.ts +3 -1
- package/dist/devices/solarPower.js +14 -2
- package/dist/matterbridge.js +182 -13
- package/dist/matterbridgeDeviceTypes.d.ts +4 -0
- package/dist/matterbridgeDeviceTypes.js +37 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +2 -1
- package/dist/matterbridgeEndpointHelpers.js +5 -0
- package/dist/matterbridgeEndpointTypes.d.ts +2 -0
- package/package.json +5 -5
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Attribute, ClusterRegistry, Command, FixedAttribute, MutableCluster, TlvNoResponse } from '@matter/types/cluster';
|
|
2
|
+
import { BitFlag } from '@matter/types/schema';
|
|
3
|
+
import { TlvBitmap, TlvBoolean, TlvEnum, TlvField, TlvInt16, TlvNullable, TlvObject, TlvOptionalField, TlvPercent100ths, TlvUInt8, TlvUInt16, } from '@matter/types/tlv';
|
|
4
|
+
export var ClosureDimension;
|
|
5
|
+
(function (ClosureDimension) {
|
|
6
|
+
let Feature;
|
|
7
|
+
(function (Feature) {
|
|
8
|
+
Feature["Positioning"] = "Positioning";
|
|
9
|
+
Feature["MotionLatching"] = "MotionLatching";
|
|
10
|
+
Feature["Unit"] = "Unit";
|
|
11
|
+
Feature["Limitation"] = "Limitation";
|
|
12
|
+
Feature["Speed"] = "Speed";
|
|
13
|
+
Feature["Translation"] = "Translation";
|
|
14
|
+
Feature["Rotation"] = "Rotation";
|
|
15
|
+
Feature["Modulation"] = "Modulation";
|
|
16
|
+
})(Feature = ClosureDimension.Feature || (ClosureDimension.Feature = {}));
|
|
17
|
+
let ClosureUnit;
|
|
18
|
+
(function (ClosureUnit) {
|
|
19
|
+
ClosureUnit[ClosureUnit["Millimeter"] = 0] = "Millimeter";
|
|
20
|
+
ClosureUnit[ClosureUnit["Degree"] = 1] = "Degree";
|
|
21
|
+
})(ClosureUnit = ClosureDimension.ClosureUnit || (ClosureDimension.ClosureUnit = {}));
|
|
22
|
+
let ModulationType;
|
|
23
|
+
(function (ModulationType) {
|
|
24
|
+
ModulationType[ModulationType["SlatsOrientation"] = 0] = "SlatsOrientation";
|
|
25
|
+
ModulationType[ModulationType["SlatsOpenwork"] = 1] = "SlatsOpenwork";
|
|
26
|
+
ModulationType[ModulationType["StripesAlignment"] = 2] = "StripesAlignment";
|
|
27
|
+
ModulationType[ModulationType["Opacity"] = 3] = "Opacity";
|
|
28
|
+
ModulationType[ModulationType["Ventilation"] = 4] = "Ventilation";
|
|
29
|
+
})(ModulationType = ClosureDimension.ModulationType || (ClosureDimension.ModulationType = {}));
|
|
30
|
+
let Overflow;
|
|
31
|
+
(function (Overflow) {
|
|
32
|
+
Overflow[Overflow["NoOverflow"] = 0] = "NoOverflow";
|
|
33
|
+
Overflow[Overflow["Inside"] = 1] = "Inside";
|
|
34
|
+
Overflow[Overflow["Outside"] = 2] = "Outside";
|
|
35
|
+
Overflow[Overflow["TopInside"] = 3] = "TopInside";
|
|
36
|
+
Overflow[Overflow["TopOutside"] = 4] = "TopOutside";
|
|
37
|
+
Overflow[Overflow["BottomInside"] = 5] = "BottomInside";
|
|
38
|
+
Overflow[Overflow["BottomOutside"] = 6] = "BottomOutside";
|
|
39
|
+
Overflow[Overflow["LeftInside"] = 7] = "LeftInside";
|
|
40
|
+
Overflow[Overflow["LeftOutside"] = 8] = "LeftOutside";
|
|
41
|
+
Overflow[Overflow["RightInside"] = 9] = "RightInside";
|
|
42
|
+
Overflow[Overflow["RightOutside"] = 10] = "RightOutside";
|
|
43
|
+
})(Overflow = ClosureDimension.Overflow || (ClosureDimension.Overflow = {}));
|
|
44
|
+
let RotationAxis;
|
|
45
|
+
(function (RotationAxis) {
|
|
46
|
+
RotationAxis[RotationAxis["Left"] = 0] = "Left";
|
|
47
|
+
RotationAxis[RotationAxis["CenteredVertical"] = 1] = "CenteredVertical";
|
|
48
|
+
RotationAxis[RotationAxis["LeftAndRight"] = 2] = "LeftAndRight";
|
|
49
|
+
RotationAxis[RotationAxis["Right"] = 3] = "Right";
|
|
50
|
+
RotationAxis[RotationAxis["Top"] = 4] = "Top";
|
|
51
|
+
RotationAxis[RotationAxis["CenteredHorizontal"] = 5] = "CenteredHorizontal";
|
|
52
|
+
RotationAxis[RotationAxis["TopAndBottom"] = 6] = "TopAndBottom";
|
|
53
|
+
RotationAxis[RotationAxis["Bottom"] = 7] = "Bottom";
|
|
54
|
+
RotationAxis[RotationAxis["LeftBarrier"] = 8] = "LeftBarrier";
|
|
55
|
+
RotationAxis[RotationAxis["LeftAndRightBarriers"] = 9] = "LeftAndRightBarriers";
|
|
56
|
+
RotationAxis[RotationAxis["RightBarrier"] = 10] = "RightBarrier";
|
|
57
|
+
})(RotationAxis = ClosureDimension.RotationAxis || (ClosureDimension.RotationAxis = {}));
|
|
58
|
+
let StepDirection;
|
|
59
|
+
(function (StepDirection) {
|
|
60
|
+
StepDirection[StepDirection["Decrease"] = 0] = "Decrease";
|
|
61
|
+
StepDirection[StepDirection["Increase"] = 1] = "Increase";
|
|
62
|
+
})(StepDirection = ClosureDimension.StepDirection || (ClosureDimension.StepDirection = {}));
|
|
63
|
+
let TranslationDirection;
|
|
64
|
+
(function (TranslationDirection) {
|
|
65
|
+
TranslationDirection[TranslationDirection["Downward"] = 0] = "Downward";
|
|
66
|
+
TranslationDirection[TranslationDirection["Upward"] = 1] = "Upward";
|
|
67
|
+
TranslationDirection[TranslationDirection["VerticalMask"] = 2] = "VerticalMask";
|
|
68
|
+
TranslationDirection[TranslationDirection["VerticalSymmetry"] = 3] = "VerticalSymmetry";
|
|
69
|
+
TranslationDirection[TranslationDirection["Leftward"] = 4] = "Leftward";
|
|
70
|
+
TranslationDirection[TranslationDirection["Rightward"] = 5] = "Rightward";
|
|
71
|
+
TranslationDirection[TranslationDirection["HorizontalMask"] = 6] = "HorizontalMask";
|
|
72
|
+
TranslationDirection[TranslationDirection["HorizontalSymmetry"] = 7] = "HorizontalSymmetry";
|
|
73
|
+
TranslationDirection[TranslationDirection["Forward"] = 8] = "Forward";
|
|
74
|
+
TranslationDirection[TranslationDirection["Backward"] = 9] = "Backward";
|
|
75
|
+
TranslationDirection[TranslationDirection["DepthMask"] = 10] = "DepthMask";
|
|
76
|
+
TranslationDirection[TranslationDirection["DepthSymmetry"] = 11] = "DepthSymmetry";
|
|
77
|
+
})(TranslationDirection = ClosureDimension.TranslationDirection || (ClosureDimension.TranslationDirection = {}));
|
|
78
|
+
ClosureDimension.LatchControlModes = {
|
|
79
|
+
remoteLatching: BitFlag(0),
|
|
80
|
+
remoteUnlatching: BitFlag(1),
|
|
81
|
+
};
|
|
82
|
+
ClosureDimension.TlvDimensionState = TlvObject({
|
|
83
|
+
position: TlvOptionalField(0, TlvNullable(TlvPercent100ths)),
|
|
84
|
+
latch: TlvOptionalField(1, TlvNullable(TlvBoolean)),
|
|
85
|
+
speed: TlvOptionalField(2, TlvEnum()),
|
|
86
|
+
});
|
|
87
|
+
ClosureDimension.TlvRangePercent100ths = TlvObject({
|
|
88
|
+
min: TlvField(0, TlvPercent100ths),
|
|
89
|
+
max: TlvField(1, TlvPercent100ths),
|
|
90
|
+
});
|
|
91
|
+
ClosureDimension.TlvUnitRange = TlvObject({
|
|
92
|
+
min: TlvField(0, TlvInt16),
|
|
93
|
+
max: TlvField(1, TlvInt16),
|
|
94
|
+
});
|
|
95
|
+
ClosureDimension.TlvSetTargetRequest = TlvObject({
|
|
96
|
+
position: TlvOptionalField(0, TlvPercent100ths),
|
|
97
|
+
latch: TlvOptionalField(1, TlvBoolean),
|
|
98
|
+
speed: TlvOptionalField(2, TlvEnum()),
|
|
99
|
+
});
|
|
100
|
+
ClosureDimension.TlvStepRequest = TlvObject({
|
|
101
|
+
direction: TlvField(0, TlvEnum()),
|
|
102
|
+
numberOfSteps: TlvField(1, TlvUInt16.bound({ min: 1 })),
|
|
103
|
+
speed: TlvOptionalField(2, TlvEnum()),
|
|
104
|
+
});
|
|
105
|
+
ClosureDimension.PositioningComponent = MutableCluster.Component({
|
|
106
|
+
attributes: {
|
|
107
|
+
resolution: FixedAttribute(0x2, TlvPercent100ths, { default: 1 }),
|
|
108
|
+
stepValue: FixedAttribute(0x3, TlvPercent100ths, { default: 1 }),
|
|
109
|
+
},
|
|
110
|
+
commands: {
|
|
111
|
+
step: Command(0x1, ClosureDimension.TlvStepRequest, 0x1, TlvNoResponse, { timed: true }),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
ClosureDimension.MotionLatchingComponent = MutableCluster.Component({
|
|
115
|
+
attributes: {
|
|
116
|
+
latchControlModes: FixedAttribute(0xb, TlvBitmap(TlvUInt8, ClosureDimension.LatchControlModes)),
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
ClosureDimension.UnitComponent = MutableCluster.Component({
|
|
120
|
+
attributes: {
|
|
121
|
+
unit: FixedAttribute(0x4, TlvEnum()),
|
|
122
|
+
unitRange: Attribute(0x5, TlvNullable(ClosureDimension.TlvUnitRange), { default: null }),
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
ClosureDimension.LimitationComponent = MutableCluster.Component({
|
|
126
|
+
attributes: {
|
|
127
|
+
limitRange: Attribute(0x6, ClosureDimension.TlvRangePercent100ths),
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
ClosureDimension.TranslationComponent = MutableCluster.Component({
|
|
131
|
+
attributes: {
|
|
132
|
+
translationDirection: FixedAttribute(0x7, TlvEnum()),
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
ClosureDimension.RotationComponent = MutableCluster.Component({
|
|
136
|
+
attributes: {
|
|
137
|
+
rotationAxis: FixedAttribute(0x8, TlvEnum()),
|
|
138
|
+
overflow: FixedAttribute(0x9, TlvEnum()),
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
ClosureDimension.ModulationComponent = MutableCluster.Component({
|
|
142
|
+
attributes: {
|
|
143
|
+
modulationType: FixedAttribute(0xa, TlvEnum()),
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
ClosureDimension.Base = MutableCluster.Component({
|
|
147
|
+
id: 0x0105,
|
|
148
|
+
name: 'ClosureDimension',
|
|
149
|
+
revision: 1,
|
|
150
|
+
features: {
|
|
151
|
+
positioning: BitFlag(0),
|
|
152
|
+
motionLatching: BitFlag(1),
|
|
153
|
+
unit: BitFlag(2),
|
|
154
|
+
limitation: BitFlag(3),
|
|
155
|
+
speed: BitFlag(4),
|
|
156
|
+
translation: BitFlag(5),
|
|
157
|
+
rotation: BitFlag(6),
|
|
158
|
+
modulation: BitFlag(7),
|
|
159
|
+
},
|
|
160
|
+
attributes: {
|
|
161
|
+
currentState: Attribute(0x0, TlvNullable(ClosureDimension.TlvDimensionState), { default: null }),
|
|
162
|
+
targetState: Attribute(0x1, TlvNullable(ClosureDimension.TlvDimensionState), { default: null }),
|
|
163
|
+
},
|
|
164
|
+
commands: {
|
|
165
|
+
setTarget: Command(0x0, ClosureDimension.TlvSetTargetRequest, 0x0, TlvNoResponse, { timed: true }),
|
|
166
|
+
},
|
|
167
|
+
extensions: MutableCluster.Extensions({ flags: { positioning: true }, component: ClosureDimension.PositioningComponent }, { flags: { motionLatching: true }, component: ClosureDimension.MotionLatchingComponent }, { flags: { unit: true }, component: ClosureDimension.UnitComponent }, { flags: { limitation: true }, component: ClosureDimension.LimitationComponent }, { flags: { translation: true }, component: ClosureDimension.TranslationComponent }, { flags: { rotation: true }, component: ClosureDimension.RotationComponent }, { flags: { modulation: true }, component: ClosureDimension.ModulationComponent }, { flags: { positioning: false, motionLatching: false }, component: false }, { flags: { unit: true, positioning: false }, component: false }, { flags: { limitation: true, positioning: false }, component: false }, { flags: { speed: true, positioning: false }, component: false }, { flags: { translation: true, positioning: false }, component: false }, { flags: { rotation: true, positioning: false }, component: false }, { flags: { modulation: true, positioning: false }, component: false }, { flags: { translation: true, rotation: true }, component: false }, { flags: { translation: true, modulation: true }, component: false }, { flags: { rotation: true, modulation: true }, component: false }),
|
|
168
|
+
});
|
|
169
|
+
ClosureDimension.Cluster = MutableCluster.ExtensibleOnly(ClosureDimension.Base);
|
|
170
|
+
const PS = { positioning: true };
|
|
171
|
+
const LT = { motionLatching: true };
|
|
172
|
+
const UT = { unit: true };
|
|
173
|
+
const LM = { limitation: true };
|
|
174
|
+
const TR = { translation: true };
|
|
175
|
+
const RO = { rotation: true };
|
|
176
|
+
const MD = { modulation: true };
|
|
177
|
+
ClosureDimension.Complete = MutableCluster({
|
|
178
|
+
id: ClosureDimension.Base.id,
|
|
179
|
+
name: ClosureDimension.Base.name,
|
|
180
|
+
revision: ClosureDimension.Base.revision,
|
|
181
|
+
features: ClosureDimension.Base.features,
|
|
182
|
+
attributes: {
|
|
183
|
+
...ClosureDimension.Base.attributes,
|
|
184
|
+
resolution: MutableCluster.AsConditional(ClosureDimension.PositioningComponent.attributes.resolution, { mandatoryIf: [PS] }),
|
|
185
|
+
stepValue: MutableCluster.AsConditional(ClosureDimension.PositioningComponent.attributes.stepValue, { mandatoryIf: [PS] }),
|
|
186
|
+
unit: MutableCluster.AsConditional(ClosureDimension.UnitComponent.attributes.unit, { mandatoryIf: [UT] }),
|
|
187
|
+
unitRange: MutableCluster.AsConditional(ClosureDimension.UnitComponent.attributes.unitRange, { mandatoryIf: [UT] }),
|
|
188
|
+
limitRange: MutableCluster.AsConditional(ClosureDimension.LimitationComponent.attributes.limitRange, { mandatoryIf: [LM] }),
|
|
189
|
+
translationDirection: MutableCluster.AsConditional(ClosureDimension.TranslationComponent.attributes.translationDirection, { mandatoryIf: [TR] }),
|
|
190
|
+
rotationAxis: MutableCluster.AsConditional(ClosureDimension.RotationComponent.attributes.rotationAxis, { mandatoryIf: [RO] }),
|
|
191
|
+
overflow: MutableCluster.AsConditional(ClosureDimension.RotationComponent.attributes.overflow, { mandatoryIf: [RO] }),
|
|
192
|
+
modulationType: MutableCluster.AsConditional(ClosureDimension.ModulationComponent.attributes.modulationType, { mandatoryIf: [MD] }),
|
|
193
|
+
latchControlModes: MutableCluster.AsConditional(ClosureDimension.MotionLatchingComponent.attributes.latchControlModes, { mandatoryIf: [LT] }),
|
|
194
|
+
},
|
|
195
|
+
commands: {
|
|
196
|
+
...ClosureDimension.Base.commands,
|
|
197
|
+
step: MutableCluster.AsConditional(ClosureDimension.PositioningComponent.commands.step, { mandatoryIf: [PS] }),
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
})(ClosureDimension || (ClosureDimension = {}));
|
|
201
|
+
export const ClosureDimensionCluster = ClosureDimension.Cluster;
|
|
202
|
+
ClusterRegistry.register(ClosureDimension.Complete);
|
package/dist/clusters/export.js
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Identity } from '@matter/general';
|
|
2
|
+
import { Attribute, FixedAttribute, MutableCluster } from '@matter/types/cluster';
|
|
3
|
+
export declare namespace SoilMeasurement {
|
|
4
|
+
const ClusterInstance: MutableCluster<{
|
|
5
|
+
readonly id: 1072;
|
|
6
|
+
readonly name: "SoilMeasurement";
|
|
7
|
+
readonly revision: 1;
|
|
8
|
+
readonly attributes: {
|
|
9
|
+
readonly soilMoistureMeasurementLimits: FixedAttribute<import("@matter/types/tlv").TypeFromFields<{
|
|
10
|
+
measurementType: import("@matter/types/tlv").FieldType<import("@matter/types/globals").MeasurementType>;
|
|
11
|
+
measured: import("@matter/types/tlv").FieldType<boolean>;
|
|
12
|
+
minMeasuredValue: import("@matter/types/tlv").FieldType<number | bigint>;
|
|
13
|
+
maxMeasuredValue: import("@matter/types/tlv").FieldType<number | bigint>;
|
|
14
|
+
accuracyRanges: import("@matter/types/tlv").FieldType<import("@matter/types/tlv").TypeFromFields<{
|
|
15
|
+
rangeMin: import("@matter/types/tlv").FieldType<number | bigint>;
|
|
16
|
+
rangeMax: import("@matter/types/tlv").FieldType<number | bigint>;
|
|
17
|
+
percentMax: import("@matter/types/tlv").OptionalFieldType<number>;
|
|
18
|
+
percentMin: import("@matter/types/tlv").OptionalFieldType<number>;
|
|
19
|
+
percentTypical: import("@matter/types/tlv").OptionalFieldType<number>;
|
|
20
|
+
fixedMax: import("@matter/types/tlv").OptionalFieldType<number | bigint>;
|
|
21
|
+
fixedMin: import("@matter/types/tlv").OptionalFieldType<number | bigint>;
|
|
22
|
+
fixedTypical: import("@matter/types/tlv").OptionalFieldType<number | bigint>;
|
|
23
|
+
}>[]>;
|
|
24
|
+
}>, any>;
|
|
25
|
+
readonly soilMoistureMeasuredValue: Attribute<number | null, any>;
|
|
26
|
+
};
|
|
27
|
+
}, []>;
|
|
28
|
+
interface Cluster extends Identity<typeof ClusterInstance> {
|
|
29
|
+
}
|
|
30
|
+
const Cluster: Cluster;
|
|
31
|
+
const Complete: Cluster;
|
|
32
|
+
}
|
|
33
|
+
export type SoilMeasurementCluster = SoilMeasurement.Cluster;
|
|
34
|
+
export declare const SoilMeasurementCluster: SoilMeasurement.Cluster;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Attribute, ClusterRegistry, FixedAttribute, MutableCluster } from '@matter/types/cluster';
|
|
2
|
+
import { TlvMeasurementAccuracy } from '@matter/types/globals';
|
|
3
|
+
import { TlvNullable, TlvPercent } from '@matter/types/tlv';
|
|
4
|
+
export var SoilMeasurement;
|
|
5
|
+
(function (SoilMeasurement) {
|
|
6
|
+
SoilMeasurement.ClusterInstance = MutableCluster({
|
|
7
|
+
id: 0x0430,
|
|
8
|
+
name: 'SoilMeasurement',
|
|
9
|
+
revision: 1,
|
|
10
|
+
attributes: {
|
|
11
|
+
soilMoistureMeasurementLimits: FixedAttribute(0x0, TlvMeasurementAccuracy),
|
|
12
|
+
soilMoistureMeasuredValue: Attribute(0x1, TlvNullable(TlvPercent)),
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
SoilMeasurement.Cluster = SoilMeasurement.ClusterInstance;
|
|
16
|
+
SoilMeasurement.Complete = SoilMeasurement.Cluster;
|
|
17
|
+
})(SoilMeasurement || (SoilMeasurement = {}));
|
|
18
|
+
export const SoilMeasurementCluster = SoilMeasurement.Cluster;
|
|
19
|
+
ClusterRegistry.register(SoilMeasurement.Complete);
|
|
@@ -1,28 +1,33 @@
|
|
|
1
|
+
import { ElectricalPowerMeasurementServer } from '@matter/main/behaviors/electrical-power-measurement';
|
|
2
|
+
import { ElectricalPowerMeasurement } from '@matter/main/clusters/electrical-power-measurement';
|
|
1
3
|
import { PowerSourceTag } from '@matter/node';
|
|
2
4
|
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
3
5
|
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
4
6
|
import { batteryStorage, deviceEnergyManagement, electricalSensor, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
5
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
8
|
+
import { getDefaultElectricalPowerMeasurementClusterServer, getSemtag } from '../matterbridgeEndpointHelpers.js';
|
|
6
9
|
export class BatteryStorage extends MatterbridgeEndpoint {
|
|
7
10
|
constructor(name, serial, batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, voltage = null, current = null, power = null, energyImported = null, energyExported = null, absMinPower = 0, absMaxPower = 0) {
|
|
8
|
-
super([batteryStorage, electricalSensor, deviceEnergyManagement], {
|
|
11
|
+
super([batteryStorage, powerSource, electricalSensor, deviceEnergyManagement], {
|
|
12
|
+
id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
|
|
13
|
+
tagList: [getSemtag(PowerSourceTag.Grid)],
|
|
14
|
+
});
|
|
9
15
|
this.createDefaultIdentifyClusterServer()
|
|
10
|
-
.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge
|
|
16
|
+
.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Battery Storage')
|
|
17
|
+
.createDefaultPowerSourceWiredClusterServer()
|
|
11
18
|
.createDefaultPowerTopologyClusterServer()
|
|
12
19
|
.createDefaultElectricalPowerMeasurementClusterServer(voltage, current, power)
|
|
13
20
|
.createDefaultElectricalEnergyMeasurementClusterServer(energyImported, energyExported)
|
|
14
21
|
.createDefaultDeviceEnergyManagementClusterServer(DeviceEnergyManagement.EsaType.BatteryStorage, true, DeviceEnergyManagement.EsaState.Online, absMinPower, absMaxPower)
|
|
15
22
|
.createDefaultDeviceEnergyManagementModeClusterServer()
|
|
16
23
|
.addRequiredClusterServers();
|
|
17
|
-
this.
|
|
18
|
-
|
|
24
|
+
this.addFixedLabel('composed', 'Battery Storage');
|
|
25
|
+
const battery = this.addChildDeviceType('Battery', [powerSource, electricalSensor], {
|
|
26
|
+
tagList: [getSemtag(PowerSourceTag.Battery)],
|
|
19
27
|
})
|
|
20
28
|
.createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, 24_000)
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
.createDefaultPowerSourceWiredClusterServer()
|
|
26
|
-
.addRequiredClusterServers();
|
|
29
|
+
.createDefaultPowerTopologyClusterServer()
|
|
30
|
+
.createDefaultElectricalEnergyMeasurementClusterServer(energyImported, energyExported);
|
|
31
|
+
battery.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.DirectCurrent), getDefaultElectricalPowerMeasurementClusterServer(voltage, current, power));
|
|
27
32
|
}
|
|
28
33
|
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { MaybePromise } from '@matter/general';
|
|
2
|
+
import { ClusterBehavior } from '@matter/node';
|
|
3
|
+
import { ClosureControl } from '../clusters/closure-control.js';
|
|
4
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
|
+
export interface ClosureOptions {
|
|
6
|
+
mainState?: ClosureControl.MainState;
|
|
7
|
+
}
|
|
8
|
+
declare const ClosureControlServerBase: ClusterBehavior.Type<import("@matter/types").ClusterComposer.Of<import("@matter/types").ClusterType.Of<{
|
|
9
|
+
readonly id: 260;
|
|
10
|
+
readonly name: "ClosureControl";
|
|
11
|
+
readonly revision: 1;
|
|
12
|
+
readonly features: {
|
|
13
|
+
readonly positioning: import("@matter/types").BitFlag;
|
|
14
|
+
readonly motionLatching: import("@matter/types").BitFlag;
|
|
15
|
+
readonly instantaneous: import("@matter/types").BitFlag;
|
|
16
|
+
readonly speed: import("@matter/types").BitFlag;
|
|
17
|
+
readonly ventilation: import("@matter/types").BitFlag;
|
|
18
|
+
readonly pedestrian: import("@matter/types").BitFlag;
|
|
19
|
+
readonly calibration: import("@matter/types").BitFlag;
|
|
20
|
+
readonly protection: import("@matter/types").BitFlag;
|
|
21
|
+
readonly manuallyOperable: import("@matter/types").BitFlag;
|
|
22
|
+
};
|
|
23
|
+
readonly attributes: {
|
|
24
|
+
readonly mainState: import("@matter/types").Attribute<ClosureControl.MainState, any>;
|
|
25
|
+
readonly currentErrorList: import("@matter/types").Attribute<ClosureControl.ClosureError[], any>;
|
|
26
|
+
readonly overallCurrentState: import("@matter/types").Attribute<import("@matter/types").TypeFromFields<{
|
|
27
|
+
position: import("@matter/types").OptionalFieldType<ClosureControl.CurrentPosition | null>;
|
|
28
|
+
latch: import("@matter/types").OptionalFieldType<boolean | null>;
|
|
29
|
+
speed: import("@matter/types").OptionalFieldType<import("@matter/types").ThreeLevelAuto>;
|
|
30
|
+
secureState: import("@matter/types").OptionalFieldType<boolean | null>;
|
|
31
|
+
}> | null, any>;
|
|
32
|
+
readonly overallTargetState: import("@matter/types").Attribute<import("@matter/types").TypeFromFields<{
|
|
33
|
+
position: import("@matter/types").OptionalFieldType<ClosureControl.TargetPosition | null>;
|
|
34
|
+
latch: import("@matter/types").OptionalFieldType<boolean | null>;
|
|
35
|
+
speed: import("@matter/types").OptionalFieldType<import("@matter/types").ThreeLevelAuto>;
|
|
36
|
+
}> | null, any>;
|
|
37
|
+
};
|
|
38
|
+
readonly commands: {
|
|
39
|
+
readonly moveTo: import("@matter/types").Command<import("@matter/types").TypeFromFields<{
|
|
40
|
+
position: import("@matter/types").OptionalFieldType<ClosureControl.TargetPosition>;
|
|
41
|
+
latch: import("@matter/types").OptionalFieldType<boolean>;
|
|
42
|
+
speed: import("@matter/types").OptionalFieldType<import("@matter/types").ThreeLevelAuto>;
|
|
43
|
+
}>, void, any>;
|
|
44
|
+
};
|
|
45
|
+
readonly events: {
|
|
46
|
+
readonly operationalError: import("@matter/types").Event<import("@matter/types").TypeFromFields<{
|
|
47
|
+
errorState: import("@matter/types").FieldType<ClosureControl.ClosureError[]>;
|
|
48
|
+
}>, any>;
|
|
49
|
+
readonly secureStateChanged: import("@matter/types").Event<import("@matter/types").TypeFromFields<{
|
|
50
|
+
secureValue: import("@matter/types").FieldType<boolean>;
|
|
51
|
+
}>, any>;
|
|
52
|
+
};
|
|
53
|
+
readonly extensions: readonly [{
|
|
54
|
+
readonly flags: {
|
|
55
|
+
readonly instantaneous: false;
|
|
56
|
+
};
|
|
57
|
+
readonly component: {
|
|
58
|
+
readonly commands: {
|
|
59
|
+
readonly stop: import("@matter/types").Command<void, void, any>;
|
|
60
|
+
};
|
|
61
|
+
readonly events: {
|
|
62
|
+
readonly movementCompleted: import("@matter/types").Event<void, any>;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}, {
|
|
66
|
+
readonly flags: {
|
|
67
|
+
readonly motionLatching: true;
|
|
68
|
+
};
|
|
69
|
+
readonly component: {
|
|
70
|
+
readonly attributes: {
|
|
71
|
+
readonly latchControlModes: import("@matter/types").FixedAttribute<import("@matter/types").TypeFromPartialBitSchema<{
|
|
72
|
+
remoteLatching: import("@matter/types").BitFlag;
|
|
73
|
+
remoteUnlatching: import("@matter/types").BitFlag;
|
|
74
|
+
}>, any>;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}, {
|
|
78
|
+
readonly flags: {
|
|
79
|
+
readonly calibration: true;
|
|
80
|
+
};
|
|
81
|
+
readonly component: {
|
|
82
|
+
readonly commands: {
|
|
83
|
+
readonly calibrate: import("@matter/types").Command<void, void, any>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}, {
|
|
87
|
+
readonly flags: {
|
|
88
|
+
readonly manuallyOperable: true;
|
|
89
|
+
};
|
|
90
|
+
readonly component: {
|
|
91
|
+
readonly events: {
|
|
92
|
+
readonly engageStateChanged: import("@matter/types").Event<import("@matter/types").TypeFromFields<{
|
|
93
|
+
engageValue: import("@matter/types").FieldType<boolean>;
|
|
94
|
+
}>, any>;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}, {
|
|
98
|
+
readonly flags: {
|
|
99
|
+
readonly positioning: true;
|
|
100
|
+
readonly instantaneous: false;
|
|
101
|
+
};
|
|
102
|
+
readonly component: {
|
|
103
|
+
readonly attributes: {
|
|
104
|
+
readonly countdownTime: import("@matter/types").Attribute<number | null, any>;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
readonly flags: {
|
|
109
|
+
readonly positioning: false;
|
|
110
|
+
readonly motionLatching: false;
|
|
111
|
+
};
|
|
112
|
+
readonly component: false;
|
|
113
|
+
}, {
|
|
114
|
+
readonly flags: {
|
|
115
|
+
readonly speed: true;
|
|
116
|
+
readonly positioning: false;
|
|
117
|
+
};
|
|
118
|
+
readonly component: false;
|
|
119
|
+
}, {
|
|
120
|
+
readonly flags: {
|
|
121
|
+
readonly speed: true;
|
|
122
|
+
readonly instantaneous: true;
|
|
123
|
+
};
|
|
124
|
+
readonly component: false;
|
|
125
|
+
}, {
|
|
126
|
+
readonly flags: {
|
|
127
|
+
readonly ventilation: true;
|
|
128
|
+
readonly positioning: false;
|
|
129
|
+
};
|
|
130
|
+
readonly component: false;
|
|
131
|
+
}, {
|
|
132
|
+
readonly flags: {
|
|
133
|
+
readonly pedestrian: true;
|
|
134
|
+
readonly positioning: false;
|
|
135
|
+
};
|
|
136
|
+
readonly component: false;
|
|
137
|
+
}, {
|
|
138
|
+
readonly flags: {
|
|
139
|
+
readonly calibration: true;
|
|
140
|
+
readonly positioning: false;
|
|
141
|
+
};
|
|
142
|
+
readonly component: false;
|
|
143
|
+
}];
|
|
144
|
+
}>, readonly [ClosureControl.Feature.Positioning]>, typeof ClusterBehavior, {
|
|
145
|
+
components: never[];
|
|
146
|
+
}>;
|
|
147
|
+
export declare namespace ClosureControlServer {
|
|
148
|
+
interface State {
|
|
149
|
+
mainState: ClosureControl.MainState;
|
|
150
|
+
currentErrorList: ClosureControl.ClosureError[];
|
|
151
|
+
overallCurrentState: ClosureControl.OverallCurrentState | null;
|
|
152
|
+
overallTargetState: ClosureControl.OverallTargetState | null;
|
|
153
|
+
countdownTime: number | null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export declare class ClosureControlServer extends ClosureControlServerBase {
|
|
157
|
+
state: ClosureControlServer.State;
|
|
158
|
+
moveTo: (request: ClosureControl.MoveToRequest) => MaybePromise;
|
|
159
|
+
stop: () => MaybePromise;
|
|
160
|
+
}
|
|
161
|
+
export declare class Closure extends MatterbridgeEndpoint {
|
|
162
|
+
constructor(name: string, serial: string, options?: ClosureOptions);
|
|
163
|
+
getMainState(): ClosureControl.MainState;
|
|
164
|
+
}
|
|
165
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ClusterBehavior } from '@matter/node';
|
|
2
|
+
import { ClosureControl } from '../clusters/closure-control.js';
|
|
3
|
+
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
4
|
+
import { closure } from '../matterbridgeDeviceTypes.js';
|
|
5
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
6
|
+
import { createClusterSchema } from './customClusterSchema.js';
|
|
7
|
+
const ClosureControlCluster = ClosureControl.Cluster.with(ClosureControl.Feature.Positioning);
|
|
8
|
+
const ClosureControlServerBase = ClusterBehavior.for(ClosureControlCluster, createClusterSchema(ClosureControlCluster));
|
|
9
|
+
export class ClosureControlServer extends ClosureControlServerBase {
|
|
10
|
+
moveTo = (request) => {
|
|
11
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
12
|
+
device.log.info(`MoveTo (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
13
|
+
device.commandHandler.executeHandler('moveTo', { request, cluster: ClosureControl.Cluster.id, attributes: this.state, endpoint: this.endpoint });
|
|
14
|
+
const previousTarget = this.state.overallTargetState ?? {};
|
|
15
|
+
const nextTarget = {
|
|
16
|
+
...previousTarget,
|
|
17
|
+
...(request?.position !== undefined ? { position: request.position } : null),
|
|
18
|
+
...(request?.latch !== undefined ? { latch: request.latch } : null),
|
|
19
|
+
...(request?.speed !== undefined ? { speed: request.speed } : null),
|
|
20
|
+
};
|
|
21
|
+
this.state.overallTargetState = nextTarget;
|
|
22
|
+
this.state.mainState = ClosureControl.MainState.Moving;
|
|
23
|
+
};
|
|
24
|
+
stop = () => {
|
|
25
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
26
|
+
device.log.info(`Stop (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
27
|
+
device.commandHandler.executeHandler('stop', { request: {}, cluster: ClosureControl.Cluster.id, attributes: this.state, endpoint: this.endpoint });
|
|
28
|
+
this.state.mainState = ClosureControl.MainState.Stopped;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export class Closure extends MatterbridgeEndpoint {
|
|
32
|
+
constructor(name, serial, options = {}) {
|
|
33
|
+
super([closure], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
|
|
34
|
+
this.createDefaultIdentifyClusterServer();
|
|
35
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Closure');
|
|
36
|
+
this.behaviors.require(ClosureControlServer, {
|
|
37
|
+
mainState: options.mainState ?? ClosureControl.MainState.Stopped,
|
|
38
|
+
currentErrorList: [],
|
|
39
|
+
overallCurrentState: null,
|
|
40
|
+
overallTargetState: null,
|
|
41
|
+
countdownTime: null,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getMainState() {
|
|
45
|
+
return this.getAttribute(ClosureControl.Cluster.id, 'mainState');
|
|
46
|
+
}
|
|
47
|
+
}
|