matterbridge 1.2.3 → 1.2.5
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 +189 -171
- package/README.md +379 -297
- package/TODO.md +7 -0
- package/dist/AirQualityCluster.d.ts +134 -104
- package/dist/AirQualityCluster.d.ts.map +1 -1
- package/dist/AirQualityCluster.js +43 -26
- package/dist/AirQualityCluster.js.map +1 -1
- package/dist/EveHistoryCluster.d.ts +446 -0
- package/dist/EveHistoryCluster.d.ts.map +1 -0
- package/dist/EveHistoryCluster.js +170 -0
- package/dist/EveHistoryCluster.js.map +1 -0
- package/dist/TvocCluster.d.ts +364 -148
- package/dist/TvocCluster.d.ts.map +1 -1
- package/dist/TvocCluster.js +115 -32
- package/dist/TvocCluster.js.map +1 -1
- package/dist/cli.js +6 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/matterbridge.d.ts +9 -1
- package/dist/matterbridge.d.ts.map +1 -1
- package/dist/matterbridge.js +338 -150
- package/dist/matterbridge.js.map +1 -1
- package/dist/matterbridgeController.d.ts.map +1 -1
- package/dist/matterbridgeController.js +9 -0
- package/dist/matterbridgeController.js.map +1 -1
- package/dist/matterbridgeDevice.d.ts +1254 -9
- package/dist/matterbridgeDevice.d.ts.map +1 -1
- package/dist/matterbridgeDevice.js +372 -91
- package/dist/matterbridgeDevice.js.map +1 -1
- package/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/matterbridge 32x32.png +0 -0
- package/frontend/build/matterbridge 64x64.png +0 -0
- package/frontend/build/static/css/main.61f6cf42.css.map +1 -1
- package/frontend/build/static/js/main.6b861489.js +3 -0
- package/frontend/build/static/js/main.6b861489.js.map +1 -0
- package/matterbridge.service +18 -0
- package/package.json +88 -87
- package/frontend/build/Matterbridge.jpg +0 -0
- package/frontend/build/static/js/main.e3553a4d.js +0 -3
- package/frontend/build/static/js/main.e3553a4d.js.map +0 -1
- /package/frontend/build/static/js/{main.e3553a4d.js.LICENSE.txt → main.6b861489.js.LICENSE.txt} +0 -0
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
* See the License for the specific language governing permissions and
|
|
21
21
|
* limitations under the License. *
|
|
22
22
|
*/
|
|
23
|
-
import { BasicInformationCluster, BooleanStateCluster, BridgedDeviceBasicInformationCluster, ClusterServer, ColorControl, ColorControlCluster, DoorLock, DoorLockCluster, ElectricalMeasurementCluster, Groups, Identify, IdentifyCluster, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, OccupancySensing, OccupancySensingCluster, OnOff, OnOffCluster, PowerSource, PowerSourceCluster, PowerSourceConfigurationCluster, PressureMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, Scenes, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, WindowCovering, WindowCoveringCluster, createDefaultGroupsClusterServer, createDefaultScenesClusterServer, } from '@project-chip/matter-node.js/cluster';
|
|
23
|
+
import { BasicInformationCluster, BooleanStateCluster, BridgedDeviceBasicInformationCluster, ClusterServer, ColorControl, ColorControlCluster, DoorLock, DoorLockCluster, ElectricalMeasurementCluster, Groups, Identify, IdentifyCluster, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, OccupancySensing, OccupancySensingCluster, OnOff, OnOffCluster, PowerSource, PowerSourceCluster, PowerSourceConfigurationCluster, PressureMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, Scenes, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSync, TimeSyncCluster, WindowCovering, WindowCoveringCluster, createDefaultGroupsClusterServer, createDefaultScenesClusterServer, } from '@project-chip/matter-node.js/cluster';
|
|
24
24
|
import { EndpointNumber, VendorId } from '@project-chip/matter-node.js/datatype';
|
|
25
25
|
import { Device, DeviceClasses, DeviceTypeDefinition } from '@project-chip/matter-node.js/device';
|
|
26
26
|
import { extendPublicHandlerMethods } from '@project-chip/matter-node.js/util';
|
|
27
|
-
import { EveHistoryCluster } from '
|
|
27
|
+
import { EveHistory, EveHistoryCluster } from './EveHistoryCluster.js';
|
|
28
28
|
import { AirQuality, AirQualityCluster } from './AirQualityCluster.js';
|
|
29
29
|
import { createHash } from 'crypto';
|
|
30
30
|
import { TvocMeasurement, TvocMeasurementCluster } from './TvocCluster.js';
|
|
@@ -109,6 +109,36 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
109
109
|
});
|
|
110
110
|
return serialized;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns a default static EveHistoryClusterServer object with the specified voltage, current, power, and consumption values.
|
|
114
|
+
* This shows up in HA as a static sensor!
|
|
115
|
+
* @param voltage - The voltage value (default: 0).
|
|
116
|
+
* @param current - The current value (default: 0).
|
|
117
|
+
* @param power - The power value (default: 0).
|
|
118
|
+
* @param consumption - The consumption value (default: 0).
|
|
119
|
+
* @returns The default static EveHistoryClusterServer object.
|
|
120
|
+
*/
|
|
121
|
+
getDefaultStaticEveHistoryClusterServer(voltage = 0, current = 0, power = 0, consumption = 0) {
|
|
122
|
+
return ClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy), {
|
|
123
|
+
// Dynamic attributes
|
|
124
|
+
ConfigDataGet: Uint8Array.fromHex(''),
|
|
125
|
+
ConfigDataSet: Uint8Array.fromHex(''),
|
|
126
|
+
HistoryStatus: Uint8Array.fromHex(''),
|
|
127
|
+
HistoryEntries: Uint8Array.fromHex(''),
|
|
128
|
+
HistoryRequest: Uint8Array.fromHex(''),
|
|
129
|
+
HistorySetTime: Uint8Array.fromHex(''),
|
|
130
|
+
LastEvent: 0,
|
|
131
|
+
ResetTotal: 0,
|
|
132
|
+
// Normal attributes
|
|
133
|
+
Voltage: voltage,
|
|
134
|
+
Current: current,
|
|
135
|
+
Consumption: power,
|
|
136
|
+
TotalConsumption: consumption,
|
|
137
|
+
EnergyUnknown: 1,
|
|
138
|
+
ChildLock: false,
|
|
139
|
+
RLoc: 46080,
|
|
140
|
+
}, {}, {});
|
|
141
|
+
}
|
|
112
142
|
/**
|
|
113
143
|
* Creates a room Eve History Cluster Server.
|
|
114
144
|
*
|
|
@@ -117,7 +147,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
117
147
|
*/
|
|
118
148
|
createRoomEveHistoryClusterServer(history, log) {
|
|
119
149
|
history.setMatterHystoryType('room', this.serialNumber);
|
|
120
|
-
this.addClusterServer(ClusterServer(EveHistoryCluster, {
|
|
150
|
+
this.addClusterServer(ClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveRoom), {
|
|
121
151
|
// Dynamic attributes
|
|
122
152
|
ConfigDataGet: Uint8Array.fromHex(''),
|
|
123
153
|
ConfigDataSet: Uint8Array.fromHex(''),
|
|
@@ -175,7 +205,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
175
205
|
*/
|
|
176
206
|
createWeatherEveHistoryClusterServer(history, log) {
|
|
177
207
|
history.setMatterHystoryType('weather', this.serialNumber);
|
|
178
|
-
this.addClusterServer(ClusterServer(EveHistoryCluster, {
|
|
208
|
+
this.addClusterServer(ClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveWeather), {
|
|
179
209
|
// Dynamic attributes
|
|
180
210
|
ConfigDataGet: Uint8Array.fromHex(''),
|
|
181
211
|
ConfigDataSet: Uint8Array.fromHex(''),
|
|
@@ -236,7 +266,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
236
266
|
*/
|
|
237
267
|
createEnergyEveHistoryClusterServer(history, log) {
|
|
238
268
|
history.setMatterHystoryType('energy');
|
|
239
|
-
this.addClusterServer(ClusterServer(EveHistoryCluster, {
|
|
269
|
+
this.addClusterServer(ClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveEnergy), {
|
|
240
270
|
// Dynamic attributes
|
|
241
271
|
ConfigDataGet: Uint8Array.fromHex(''),
|
|
242
272
|
ConfigDataSet: Uint8Array.fromHex(''),
|
|
@@ -313,7 +343,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
313
343
|
*/
|
|
314
344
|
createMotionEveHistoryClusterServer(history, log) {
|
|
315
345
|
history.setMatterHystoryType('motion');
|
|
316
|
-
this.addClusterServer(ClusterServer(EveHistoryCluster, {
|
|
346
|
+
this.addClusterServer(ClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveMotion), {
|
|
317
347
|
// Dynamic attributes
|
|
318
348
|
ConfigDataGet: Uint8Array.fromHex(''),
|
|
319
349
|
ConfigDataSet: Uint8Array.fromHex(''),
|
|
@@ -376,7 +406,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
376
406
|
*/
|
|
377
407
|
createDoorEveHistoryClusterServer(history, log) {
|
|
378
408
|
history.setMatterHystoryType('door');
|
|
379
|
-
this.addClusterServer(ClusterServer(EveHistoryCluster, {
|
|
409
|
+
this.addClusterServer(ClusterServer(EveHistoryCluster.with(EveHistory.Feature.EveDoor), {
|
|
380
410
|
// Dynamic attributes
|
|
381
411
|
ConfigDataGet: Uint8Array.fromHex(''),
|
|
382
412
|
ConfigDataSet: Uint8Array.fromHex(''),
|
|
@@ -445,10 +475,10 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
445
475
|
}, {}));
|
|
446
476
|
}
|
|
447
477
|
/**
|
|
448
|
-
*
|
|
478
|
+
* Get a default IdentifyCluster server.
|
|
449
479
|
*/
|
|
450
|
-
|
|
451
|
-
|
|
480
|
+
getDefaultIdentifyClusterServer() {
|
|
481
|
+
return ClusterServer(IdentifyCluster, {
|
|
452
482
|
identifyTime: 0,
|
|
453
483
|
identifyType: Identify.IdentifyType.None,
|
|
454
484
|
}, {
|
|
@@ -457,19 +487,37 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
457
487
|
console.log('Identify');
|
|
458
488
|
await this.commandHandler.executeHandler('identify', data);
|
|
459
489
|
},
|
|
460
|
-
})
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Creates a default IdentifyCluster server.
|
|
494
|
+
*/
|
|
495
|
+
createDefaultIdentifyClusterServer() {
|
|
496
|
+
this.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Get a default IdentifyCluster server.
|
|
500
|
+
*/
|
|
501
|
+
getDefaultGroupsClusterServer() {
|
|
502
|
+
return createDefaultGroupsClusterServer();
|
|
461
503
|
}
|
|
462
504
|
/**
|
|
463
505
|
* Creates a default groups cluster server and adds it to the device.
|
|
464
506
|
*/
|
|
465
507
|
createDefaultGroupsClusterServer() {
|
|
466
|
-
this.addClusterServer(
|
|
508
|
+
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Get a default scenes cluster server and adds it to the current instance.
|
|
512
|
+
*/
|
|
513
|
+
getDefaultScenesClusterServer() {
|
|
514
|
+
return createDefaultScenesClusterServer();
|
|
467
515
|
}
|
|
468
516
|
/**
|
|
469
517
|
* Creates a default scenes cluster server and adds it to the current instance.
|
|
470
518
|
*/
|
|
471
519
|
createDefaultScenesClusterServer() {
|
|
472
|
-
this.addClusterServer(
|
|
520
|
+
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
473
521
|
}
|
|
474
522
|
/**
|
|
475
523
|
* Creates a unique identifier based on the provided parameters.
|
|
@@ -485,7 +533,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
485
533
|
return hash.digest('hex');
|
|
486
534
|
}
|
|
487
535
|
/**
|
|
488
|
-
*
|
|
536
|
+
* Get a default Basic Information Cluster Server.
|
|
489
537
|
*
|
|
490
538
|
* @param deviceName - The name of the device.
|
|
491
539
|
* @param serialNumber - The serial number of the device.
|
|
@@ -498,15 +546,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
498
546
|
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
499
547
|
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
500
548
|
*/
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
this.serialNumber = serialNumber;
|
|
504
|
-
this.uniqueId = this.createUniqueId(deviceName, serialNumber, vendorName, productName);
|
|
505
|
-
if (MatterbridgeDevice.bridgeMode === 'bridge') {
|
|
506
|
-
this.createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString);
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
this.addClusterServer(ClusterServer(BasicInformationCluster, {
|
|
549
|
+
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
550
|
+
return ClusterServer(BasicInformationCluster, {
|
|
510
551
|
dataModelRevision: 1,
|
|
511
552
|
location: 'XX',
|
|
512
553
|
vendorId: VendorId(vendorId),
|
|
@@ -528,26 +569,47 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
528
569
|
shutDown: true,
|
|
529
570
|
leave: true,
|
|
530
571
|
reachableChanged: true,
|
|
531
|
-
})
|
|
572
|
+
});
|
|
532
573
|
}
|
|
533
574
|
/**
|
|
534
|
-
* Creates a default
|
|
575
|
+
* Creates a default Basic Information Cluster Server.
|
|
535
576
|
*
|
|
536
577
|
* @param deviceName - The name of the device.
|
|
537
578
|
* @param serialNumber - The serial number of the device.
|
|
538
579
|
* @param vendorId - The vendor ID of the device.
|
|
539
|
-
* @param vendorName - The name of the
|
|
540
|
-
* @param
|
|
580
|
+
* @param vendorName - The vendor name of the device.
|
|
581
|
+
* @param productId - The product ID of the device.
|
|
582
|
+
* @param productName - The product name of the device.
|
|
541
583
|
* @param softwareVersion - The software version of the device. Default is 1.
|
|
542
584
|
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
543
585
|
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
544
586
|
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
545
587
|
*/
|
|
546
|
-
|
|
588
|
+
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
547
589
|
this.deviceName = deviceName;
|
|
548
590
|
this.serialNumber = serialNumber;
|
|
549
591
|
this.uniqueId = this.createUniqueId(deviceName, serialNumber, vendorName, productName);
|
|
550
|
-
|
|
592
|
+
if (MatterbridgeDevice.bridgeMode === 'bridge') {
|
|
593
|
+
this.createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
600
|
+
*
|
|
601
|
+
* @param deviceName - The name of the device.
|
|
602
|
+
* @param serialNumber - The serial number of the device.
|
|
603
|
+
* @param vendorId - The vendor ID of the device.
|
|
604
|
+
* @param vendorName - The name of the vendor.
|
|
605
|
+
* @param productName - The name of the product.
|
|
606
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
607
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
608
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
609
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
610
|
+
*/
|
|
611
|
+
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
612
|
+
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
551
613
|
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
|
|
552
614
|
vendorName: vendorName,
|
|
553
615
|
productName: productName,
|
|
@@ -562,23 +624,53 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
562
624
|
reachable: true,
|
|
563
625
|
}, {}, {
|
|
564
626
|
reachableChanged: true,
|
|
565
|
-
})
|
|
627
|
+
});
|
|
566
628
|
}
|
|
567
629
|
/**
|
|
568
|
-
* Creates a default
|
|
630
|
+
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
631
|
+
*
|
|
632
|
+
* @param deviceName - The name of the device.
|
|
633
|
+
* @param serialNumber - The serial number of the device.
|
|
634
|
+
* @param vendorId - The vendor ID of the device.
|
|
635
|
+
* @param vendorName - The name of the vendor.
|
|
636
|
+
* @param productName - The name of the product.
|
|
637
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
638
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
639
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
640
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
641
|
+
*/
|
|
642
|
+
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
643
|
+
this.deviceName = deviceName;
|
|
644
|
+
this.serialNumber = serialNumber;
|
|
645
|
+
this.uniqueId = this.createUniqueId(deviceName, serialNumber, vendorName, productName);
|
|
646
|
+
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Get a default Electrical Measurement Cluster Server.
|
|
569
650
|
*
|
|
570
651
|
* @param voltage - The RMS voltage value.
|
|
571
652
|
* @param current - The RMS current value.
|
|
572
653
|
* @param power - The active power value.
|
|
573
654
|
* @param consumption - The total active power consumption value.
|
|
574
655
|
*/
|
|
575
|
-
|
|
576
|
-
|
|
656
|
+
getDefaultElectricalMeasurementClusterServer(voltage = 0, current = 0, power = 0, consumption = 0) {
|
|
657
|
+
return ClusterServer(ElectricalMeasurementCluster, {
|
|
577
658
|
rmsVoltage: voltage,
|
|
578
659
|
rmsCurrent: current,
|
|
579
660
|
activePower: power,
|
|
580
661
|
totalActivePower: consumption,
|
|
581
|
-
}, {}, {})
|
|
662
|
+
}, {}, {});
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Creates a default Electrical Measurement Cluster Server.
|
|
666
|
+
*
|
|
667
|
+
* @param voltage - The RMS voltage value.
|
|
668
|
+
* @param current - The RMS current value.
|
|
669
|
+
* @param power - The active power value.
|
|
670
|
+
* @param consumption - The total active power consumption value.
|
|
671
|
+
*/
|
|
672
|
+
createDefaultElectricalMeasurementClusterServer(voltage = 0, current = 0, power = 0, consumption = 0) {
|
|
673
|
+
this.addClusterServer(this.getDefaultElectricalMeasurementClusterServer(voltage, current, power, consumption));
|
|
582
674
|
}
|
|
583
675
|
/**
|
|
584
676
|
* Creates a default Thread Network Diagnostics Cluster server.
|
|
@@ -588,7 +680,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
588
680
|
*
|
|
589
681
|
* @returns void
|
|
590
682
|
*/
|
|
591
|
-
|
|
683
|
+
createDefaultDummyThreadNetworkDiagnosticsClusterServer() {
|
|
592
684
|
this.addClusterServer(ClusterServer(ThreadNetworkDiagnosticsCluster.with(ThreadNetworkDiagnostics.Feature.PacketCounts, ThreadNetworkDiagnostics.Feature.ErrorCounts), {
|
|
593
685
|
channel: 1,
|
|
594
686
|
routingRole: ThreadNetworkDiagnostics.RoutingRole.Router,
|
|
@@ -617,12 +709,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
617
709
|
}, {}));
|
|
618
710
|
}
|
|
619
711
|
/**
|
|
620
|
-
*
|
|
712
|
+
* Get a default OnOff cluster server.
|
|
621
713
|
*
|
|
622
714
|
* @param onOff - The initial state of the OnOff cluster (default: false).
|
|
623
715
|
*/
|
|
624
|
-
|
|
625
|
-
|
|
716
|
+
getDefaultOnOffClusterServer(onOff = false) {
|
|
717
|
+
return ClusterServer(OnOffCluster, {
|
|
626
718
|
onOff,
|
|
627
719
|
}, {
|
|
628
720
|
on: async (data) => {
|
|
@@ -640,15 +732,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
640
732
|
console.log('toggle onOff:', data.attributes.onOff.getLocal());
|
|
641
733
|
await this.commandHandler.executeHandler('toggle', data);
|
|
642
734
|
},
|
|
643
|
-
}, {})
|
|
735
|
+
}, {});
|
|
644
736
|
}
|
|
645
737
|
/**
|
|
646
|
-
* Creates a default
|
|
738
|
+
* Creates a default OnOff cluster server.
|
|
739
|
+
*
|
|
740
|
+
* @param onOff - The initial state of the OnOff cluster (default: false).
|
|
741
|
+
*/
|
|
742
|
+
createDefaultOnOffClusterServer(onOff = false) {
|
|
743
|
+
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff));
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Get a default level control cluster server.
|
|
647
747
|
*
|
|
648
748
|
* @param currentLevel - The current level (default: 0).
|
|
649
749
|
*/
|
|
650
|
-
|
|
651
|
-
|
|
750
|
+
getDefaultLevelControlClusterServer(currentLevel = 0) {
|
|
751
|
+
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff), {
|
|
652
752
|
currentLevel,
|
|
653
753
|
onLevel: 0,
|
|
654
754
|
options: {
|
|
@@ -692,10 +792,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
692
792
|
// eslint-disable-next-line no-console
|
|
693
793
|
console.error('Not implemented');
|
|
694
794
|
},
|
|
695
|
-
})
|
|
795
|
+
});
|
|
696
796
|
}
|
|
697
797
|
/**
|
|
698
|
-
* Creates a default
|
|
798
|
+
* Creates a default level control cluster server.
|
|
799
|
+
*
|
|
800
|
+
* @param currentLevel - The current level (default: 0).
|
|
801
|
+
*/
|
|
802
|
+
createDefaultLevelControlClusterServer(currentLevel = 0) {
|
|
803
|
+
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel));
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Get a default color control cluster server.
|
|
699
807
|
*
|
|
700
808
|
* @param currentHue - The current hue value.
|
|
701
809
|
* @param currentSaturation - The current saturation value.
|
|
@@ -703,8 +811,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
703
811
|
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
704
812
|
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
705
813
|
*/
|
|
706
|
-
|
|
707
|
-
|
|
814
|
+
getDefaultColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
815
|
+
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
708
816
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
709
817
|
options: {
|
|
710
818
|
executeIfOff: false,
|
|
@@ -771,15 +879,27 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
771
879
|
// eslint-disable-next-line no-console
|
|
772
880
|
console.error('Not implemented');
|
|
773
881
|
},
|
|
774
|
-
}, {})
|
|
882
|
+
}, {});
|
|
775
883
|
}
|
|
776
884
|
/**
|
|
777
|
-
* Creates a default
|
|
885
|
+
* Creates a default color control cluster server.
|
|
886
|
+
*
|
|
887
|
+
* @param currentHue - The current hue value.
|
|
888
|
+
* @param currentSaturation - The current saturation value.
|
|
889
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
890
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
891
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
892
|
+
*/
|
|
893
|
+
createDefaultColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
894
|
+
this.addClusterServer(this.getDefaultColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Get a default window covering cluster server.
|
|
778
898
|
*
|
|
779
899
|
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
780
900
|
*/
|
|
781
|
-
|
|
782
|
-
|
|
901
|
+
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
902
|
+
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.AbsolutePosition), {
|
|
783
903
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
784
904
|
configStatus: {
|
|
785
905
|
operational: true,
|
|
@@ -819,7 +939,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
819
939
|
`target: ${data.attributes.targetPositionLiftPercent100ths?.getLocal()} status: ${data.attributes.operationalStatus.getLocal().lift}`);
|
|
820
940
|
await this.commandHandler.executeHandler('goToLiftPercentage', data);
|
|
821
941
|
},
|
|
822
|
-
}, {})
|
|
942
|
+
}, {});
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Creates a default window covering cluster server.
|
|
946
|
+
*
|
|
947
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
948
|
+
*/
|
|
949
|
+
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
950
|
+
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
823
951
|
}
|
|
824
952
|
/**
|
|
825
953
|
* Sets the window covering target position as the current position and stops the movement.
|
|
@@ -900,18 +1028,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
900
1028
|
console.log(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
901
1029
|
}
|
|
902
1030
|
/**
|
|
903
|
-
*
|
|
1031
|
+
* Get a default door lock cluster server.
|
|
904
1032
|
*
|
|
905
1033
|
* @remarks
|
|
906
1034
|
* This method adds a cluster server for a door lock cluster with default settings.
|
|
907
1035
|
*
|
|
908
|
-
* @example
|
|
909
|
-
* ```typescript
|
|
910
|
-
* createDefaultDoorLockClusterServer();
|
|
911
|
-
* ```
|
|
912
1036
|
*/
|
|
913
|
-
|
|
914
|
-
|
|
1037
|
+
getDefaultDoorLockClusterServer() {
|
|
1038
|
+
return ClusterServer(DoorLockCluster, {
|
|
915
1039
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
916
1040
|
lockState: DoorLock.LockState.Locked,
|
|
917
1041
|
lockType: DoorLock.LockType.Deadbolt,
|
|
@@ -932,16 +1056,26 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
932
1056
|
doorLockAlarm: true,
|
|
933
1057
|
lockOperation: true,
|
|
934
1058
|
lockOperationError: true,
|
|
935
|
-
})
|
|
1059
|
+
});
|
|
936
1060
|
}
|
|
937
1061
|
/**
|
|
938
|
-
* Creates a default
|
|
1062
|
+
* Creates a default door lock cluster server.
|
|
1063
|
+
*
|
|
1064
|
+
* @remarks
|
|
1065
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1066
|
+
*
|
|
1067
|
+
*/
|
|
1068
|
+
createDefaultDoorLockClusterServer() {
|
|
1069
|
+
this.addClusterServer(this.getDefaultDoorLockClusterServer());
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Get a default switch cluster server.
|
|
939
1073
|
*
|
|
940
1074
|
* @remarks
|
|
941
1075
|
* This method adds a cluster server with default switch features and configurations.
|
|
942
1076
|
*/
|
|
943
|
-
|
|
944
|
-
|
|
1077
|
+
getDefaultSwitchClusterServer() {
|
|
1078
|
+
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
945
1079
|
numberOfPositions: 2,
|
|
946
1080
|
currentPosition: 0,
|
|
947
1081
|
multiPressMax: 2,
|
|
@@ -952,20 +1086,52 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
952
1086
|
longRelease: true,
|
|
953
1087
|
multiPressOngoing: true,
|
|
954
1088
|
multiPressComplete: true,
|
|
955
|
-
})
|
|
1089
|
+
});
|
|
956
1090
|
}
|
|
957
1091
|
/**
|
|
958
|
-
* Creates a default
|
|
1092
|
+
* Creates a default switch cluster server.
|
|
1093
|
+
*
|
|
1094
|
+
* @remarks
|
|
1095
|
+
* This method adds a cluster server with default switch features and configurations.
|
|
1096
|
+
*/
|
|
1097
|
+
createDefaultSwitchClusterServer() {
|
|
1098
|
+
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1099
|
+
this.addFixedLabel('orientation', 'Switch');
|
|
1100
|
+
this.addFixedLabel('label', 'Switch');
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Get a default occupancy sensing cluster server.
|
|
959
1104
|
*
|
|
960
1105
|
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
961
1106
|
*/
|
|
962
|
-
|
|
963
|
-
|
|
1107
|
+
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1108
|
+
return ClusterServer(OccupancySensingCluster, {
|
|
964
1109
|
occupancy: { occupied },
|
|
965
1110
|
occupancySensorType: OccupancySensing.OccupancySensorType.Pir,
|
|
966
1111
|
occupancySensorTypeBitmap: { pir: true, ultrasonic: false, physicalContact: false },
|
|
967
1112
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
968
|
-
}, {})
|
|
1113
|
+
}, {});
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Creates a default occupancy sensing cluster server.
|
|
1117
|
+
*
|
|
1118
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1119
|
+
*/
|
|
1120
|
+
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1121
|
+
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Get a default Illuminance Measurement Cluster Server.
|
|
1125
|
+
*
|
|
1126
|
+
* @param measuredValue - The measured value of illuminance.
|
|
1127
|
+
*/
|
|
1128
|
+
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1129
|
+
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
1130
|
+
measuredValue,
|
|
1131
|
+
minMeasuredValue: null,
|
|
1132
|
+
maxMeasuredValue: null,
|
|
1133
|
+
tolerance: 0,
|
|
1134
|
+
}, {}, {});
|
|
969
1135
|
}
|
|
970
1136
|
/**
|
|
971
1137
|
* Creates a default Illuminance Measurement Cluster Server.
|
|
@@ -973,12 +1139,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
973
1139
|
* @param measuredValue - The measured value of illuminance.
|
|
974
1140
|
*/
|
|
975
1141
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
976
|
-
this.addClusterServer(
|
|
1142
|
+
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Get a default temperature measurement cluster server.
|
|
1146
|
+
*
|
|
1147
|
+
* @param measuredValue - The measured value of the temperature.
|
|
1148
|
+
*/
|
|
1149
|
+
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1150
|
+
return ClusterServer(TemperatureMeasurementCluster, {
|
|
977
1151
|
measuredValue,
|
|
978
1152
|
minMeasuredValue: null,
|
|
979
1153
|
maxMeasuredValue: null,
|
|
980
1154
|
tolerance: 0,
|
|
981
|
-
}, {}, {})
|
|
1155
|
+
}, {}, {});
|
|
982
1156
|
}
|
|
983
1157
|
/**
|
|
984
1158
|
* Creates a default temperature measurement cluster server.
|
|
@@ -986,12 +1160,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
986
1160
|
* @param measuredValue - The measured value of the temperature.
|
|
987
1161
|
*/
|
|
988
1162
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
989
|
-
this.addClusterServer(
|
|
1163
|
+
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Get a default RelativeHumidityMeasurementCluster server.
|
|
1167
|
+
*
|
|
1168
|
+
* @param measuredValue - The measured value of the relative humidity.
|
|
1169
|
+
*/
|
|
1170
|
+
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1171
|
+
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
990
1172
|
measuredValue,
|
|
991
1173
|
minMeasuredValue: null,
|
|
992
1174
|
maxMeasuredValue: null,
|
|
993
1175
|
tolerance: 0,
|
|
994
|
-
}, {}, {})
|
|
1176
|
+
}, {}, {});
|
|
995
1177
|
}
|
|
996
1178
|
/**
|
|
997
1179
|
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
@@ -999,12 +1181,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
999
1181
|
* @param measuredValue - The measured value of the relative humidity.
|
|
1000
1182
|
*/
|
|
1001
1183
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1002
|
-
this.addClusterServer(
|
|
1184
|
+
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Get a default Pressure Measurement Cluster Server.
|
|
1188
|
+
*
|
|
1189
|
+
* @param measuredValue - The measured value for the pressure.
|
|
1190
|
+
*/
|
|
1191
|
+
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1192
|
+
return ClusterServer(PressureMeasurementCluster, {
|
|
1003
1193
|
measuredValue,
|
|
1004
1194
|
minMeasuredValue: null,
|
|
1005
1195
|
maxMeasuredValue: null,
|
|
1006
1196
|
tolerance: 0,
|
|
1007
|
-
}, {}, {})
|
|
1197
|
+
}, {}, {});
|
|
1008
1198
|
}
|
|
1009
1199
|
/**
|
|
1010
1200
|
* Creates a default Pressure Measurement Cluster Server.
|
|
@@ -1012,24 +1202,27 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1012
1202
|
* @param measuredValue - The measured value for the pressure.
|
|
1013
1203
|
*/
|
|
1014
1204
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1015
|
-
this.addClusterServer(
|
|
1016
|
-
measuredValue,
|
|
1017
|
-
minMeasuredValue: null,
|
|
1018
|
-
maxMeasuredValue: null,
|
|
1019
|
-
tolerance: 0,
|
|
1020
|
-
}, {}, {}));
|
|
1205
|
+
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1021
1206
|
}
|
|
1022
1207
|
/**
|
|
1023
|
-
*
|
|
1208
|
+
* Get a default boolean state cluster server.
|
|
1024
1209
|
*
|
|
1025
1210
|
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1026
1211
|
*/
|
|
1027
|
-
|
|
1028
|
-
|
|
1212
|
+
getDefaultBooleanStateClusterServer(contact) {
|
|
1213
|
+
return ClusterServer(BooleanStateCluster, {
|
|
1029
1214
|
stateValue: contact ?? true, // true=contact false=no_contact
|
|
1030
1215
|
}, {}, {
|
|
1031
1216
|
stateChange: true,
|
|
1032
|
-
})
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Creates a default boolean state cluster server.
|
|
1221
|
+
*
|
|
1222
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1223
|
+
*/
|
|
1224
|
+
createDefaultBooleanStateClusterServer(contact) {
|
|
1225
|
+
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
1033
1226
|
}
|
|
1034
1227
|
/**
|
|
1035
1228
|
* Creates a default power source replaceable battery cluster server.
|
|
@@ -1103,30 +1296,118 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1103
1296
|
*/
|
|
1104
1297
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
1105
1298
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
1106
|
-
sources: [EndpointNumber(endpointNumber)],
|
|
1299
|
+
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
1107
1300
|
}, {}, {}));
|
|
1108
1301
|
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Get a default air quality cluster server.
|
|
1304
|
+
*
|
|
1305
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1306
|
+
*/
|
|
1307
|
+
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityType.Unknown) {
|
|
1308
|
+
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.FairAirQuality, AirQuality.Feature.ModerateAirQuality, AirQuality.Feature.VeryPoorAirQuality), {
|
|
1309
|
+
airQuality,
|
|
1310
|
+
}, {}, {});
|
|
1311
|
+
}
|
|
1109
1312
|
/**
|
|
1110
1313
|
* Creates a default air quality cluster server.
|
|
1111
1314
|
*
|
|
1112
1315
|
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1113
1316
|
*/
|
|
1114
1317
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityType.Unknown) {
|
|
1115
|
-
this.addClusterServer(
|
|
1116
|
-
airQuality,
|
|
1117
|
-
}, {}, {}));
|
|
1318
|
+
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
1118
1319
|
}
|
|
1119
1320
|
/**
|
|
1120
|
-
*
|
|
1321
|
+
* Get a default TVOC measurement cluster server.
|
|
1121
1322
|
*
|
|
1122
1323
|
* @param measuredValue - The measured value for TVOC.
|
|
1123
1324
|
*/
|
|
1124
|
-
|
|
1125
|
-
|
|
1325
|
+
getDefaultTvocMeasurementClusterServer(measuredValue = 0) {
|
|
1326
|
+
return ClusterServer(TvocMeasurementCluster.with(TvocMeasurement.Feature.NumericMeasurement), {
|
|
1126
1327
|
measuredValue,
|
|
1127
1328
|
minMeasuredValue: null,
|
|
1128
1329
|
maxMeasuredValue: null,
|
|
1129
|
-
}, {}, {})
|
|
1330
|
+
}, {}, {});
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Creates a default TVOC measurement cluster server.
|
|
1334
|
+
*
|
|
1335
|
+
* @param measuredValue - The measured value for TVOC.
|
|
1336
|
+
*/
|
|
1337
|
+
createDefaultTvocMeasurementClusterServer(measuredValue = 0) {
|
|
1338
|
+
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue));
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Get a default thermostat cluster server with the specified parameters.
|
|
1342
|
+
*
|
|
1343
|
+
* @param localTemperature - The local temperature value in degrees Celsius. Defaults to 23.
|
|
1344
|
+
* @param occupiedHeatingSetpoint - The occupied heating setpoint value in degrees Celsius. Defaults to 21.
|
|
1345
|
+
* @param occupiedCoolingSetpoint - The occupied cooling setpoint value in degrees Celsius. Defaults to 25.
|
|
1346
|
+
*/
|
|
1347
|
+
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25) {
|
|
1348
|
+
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling /*, Thermostat.Feature.AutoMode*/), {
|
|
1349
|
+
localTemperature: localTemperature * 100,
|
|
1350
|
+
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1351
|
+
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1352
|
+
minHeatSetpointLimit: 0,
|
|
1353
|
+
maxHeatSetpointLimit: 5000,
|
|
1354
|
+
absMinHeatSetpointLimit: 0,
|
|
1355
|
+
absMaxHeatSetpointLimit: 5000,
|
|
1356
|
+
minCoolSetpointLimit: 0,
|
|
1357
|
+
maxCoolSetpointLimit: 5000,
|
|
1358
|
+
absMinCoolSetpointLimit: 0,
|
|
1359
|
+
absMaxCoolSetpointLimit: 5000,
|
|
1360
|
+
//minSetpointDeadBand: 1,
|
|
1361
|
+
systemMode: Thermostat.SystemMode.Off,
|
|
1362
|
+
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1363
|
+
//thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1364
|
+
}, {
|
|
1365
|
+
setpointRaiseLower: async ({ request, attributes }) => {
|
|
1366
|
+
// eslint-disable-next-line no-console
|
|
1367
|
+
console.log('setpointRaiseLower', request);
|
|
1368
|
+
await this.commandHandler.executeHandler('setpointRaiseLower', { request, attributes });
|
|
1369
|
+
},
|
|
1370
|
+
}, {});
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Creates a default thermostat cluster server with the specified parameters.
|
|
1374
|
+
*
|
|
1375
|
+
* @param localTemperature - The local temperature value in degrees Celsius. Defaults to 23.
|
|
1376
|
+
* @param occupiedHeatingSetpoint - The occupied heating setpoint value in degrees Celsius. Defaults to 21.
|
|
1377
|
+
* @param occupiedCoolingSetpoint - The occupied cooling setpoint value in degrees Celsius. Defaults to 25.
|
|
1378
|
+
*/
|
|
1379
|
+
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25) {
|
|
1380
|
+
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint));
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Get a default time sync cluster server. Only needed to create a thermostat.
|
|
1384
|
+
*/
|
|
1385
|
+
getDefaultTimeSyncClusterServer() {
|
|
1386
|
+
return ClusterServer(TimeSyncCluster.with(TimeSync.Feature.TimeZone), {
|
|
1387
|
+
utcTime: null,
|
|
1388
|
+
granularity: TimeSync.Granularity.NoTimeGranularity,
|
|
1389
|
+
timeZone: [{ offset: 0, validAt: 0 }],
|
|
1390
|
+
trustedTimeNodeId: null,
|
|
1391
|
+
dstOffset: [],
|
|
1392
|
+
localTime: null,
|
|
1393
|
+
timeZoneDatabase: true,
|
|
1394
|
+
}, {
|
|
1395
|
+
setUtcTime: async ({ request, attributes }) => {
|
|
1396
|
+
// eslint-disable-next-line no-console
|
|
1397
|
+
console.log('setUtcTime', request);
|
|
1398
|
+
await this.commandHandler.executeHandler('setUtcTime', { request, attributes });
|
|
1399
|
+
},
|
|
1400
|
+
}, {
|
|
1401
|
+
dstTableEmpty: true,
|
|
1402
|
+
dstStatus: true,
|
|
1403
|
+
timeZoneStatus: true,
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Creates a default time sync cluster server. Only needed to create a thermostat.
|
|
1408
|
+
*/
|
|
1409
|
+
createDefaultTimeSyncClusterServer() {
|
|
1410
|
+
this.addClusterServer(this.getDefaultTimeSyncClusterServer());
|
|
1130
1411
|
}
|
|
1131
1412
|
}
|
|
1132
1413
|
//# sourceMappingURL=matterbridgeDevice.js.map
|