matterbridge-example-dynamic-platform 2.0.9 → 2.0.10
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 +14 -0
- package/dist/module.js +43 -50
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,20 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
26
26
|
|
|
27
27
|
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
|
|
28
28
|
|
|
29
|
+
## [2.0.10] - 2026-02-11
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- [platform]: Change actuatorEnabled to false when operatingMode = DoorLock.OperatingMode.NoRemoteLockUnlock. Thanks Ludovic BOUÉ (https://github.com/Luligu/matterbridge-example-dynamic-platform/pull/48).
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- [package]: Updated dependencies.
|
|
38
|
+
- [package]: Bumped package to automator v.3.0.7.
|
|
39
|
+
- [animations]: Changed interval management to improve tests efficency.
|
|
40
|
+
|
|
41
|
+
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
|
|
42
|
+
|
|
29
43
|
## [2.0.9] - 2026-02-07
|
|
30
44
|
|
|
31
45
|
### Changed
|
package/dist/module.js
CHANGED
|
@@ -89,23 +89,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
89
89
|
basicVideoPlayer;
|
|
90
90
|
castingVideoPlayer;
|
|
91
91
|
speaker;
|
|
92
|
-
|
|
93
|
-
phase = -1;
|
|
94
|
-
sensorInterval;
|
|
95
|
-
switchInterval;
|
|
96
|
-
lightInterval;
|
|
97
|
-
outletInterval;
|
|
98
|
-
coverInterval;
|
|
99
|
-
lockInterval;
|
|
100
|
-
thermoInterval;
|
|
101
|
-
fanInterval;
|
|
102
|
-
waterLeakInterval;
|
|
103
|
-
waterFreezeInterval;
|
|
104
|
-
rainInterval;
|
|
105
|
-
smokeInterval;
|
|
106
|
-
airQualityInterval;
|
|
107
|
-
airConditionerInterval;
|
|
108
|
-
genericSwitchInterval;
|
|
92
|
+
phase = 0;
|
|
109
93
|
genericSwitchLastEvent = 'Release';
|
|
110
94
|
intervalOnOff = false;
|
|
111
95
|
intervalLevel = 1;
|
|
@@ -579,6 +563,9 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
579
563
|
await this.lock?.subscribeAttribute(DoorLock.Cluster.id, 'operatingMode', (value) => {
|
|
580
564
|
const lookupOperatingMode = ['Normal', 'Vacation', 'Privacy', 'NoRemoteLockUnlock', 'Passage'];
|
|
581
565
|
this.lock?.log.info('Subscribe operatingMode called with:', lookupOperatingMode[value]);
|
|
566
|
+
const actuatorEnabled = value !== DoorLock.OperatingMode.NoRemoteLockUnlock;
|
|
567
|
+
this.lock?.setAttribute(DoorLock.Cluster.id, 'actuatorEnabled', actuatorEnabled);
|
|
568
|
+
this.lock?.log.info(`actuatorEnabled set to ${actuatorEnabled}`);
|
|
582
569
|
}, this.lock.log);
|
|
583
570
|
this.thermoAuto = new MatterbridgeEndpoint([thermostatDevice, bridgedNode, powerSource], { id: 'Thermostat (AutoMode)' }, this.config.debug)
|
|
584
571
|
.createDefaultIdentifyClusterServer()
|
|
@@ -1447,12 +1434,31 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1447
1434
|
this.speaker = new Speaker('Speaker', 'SPE00057', false, 100);
|
|
1448
1435
|
this.speaker = (await this.addDevice(this.speaker));
|
|
1449
1436
|
}
|
|
1437
|
+
intervals = [];
|
|
1438
|
+
addInterval(callback, intervalTime) {
|
|
1439
|
+
const interval = setInterval(callback, intervalTime);
|
|
1440
|
+
this.intervals.push({ interval, callback });
|
|
1441
|
+
return interval;
|
|
1442
|
+
}
|
|
1443
|
+
async executeIntervals(times, pauseTime = 100) {
|
|
1444
|
+
for (let i = 0; i < times; i++) {
|
|
1445
|
+
for (const { callback } of this.intervals) {
|
|
1446
|
+
await callback();
|
|
1447
|
+
}
|
|
1448
|
+
if (pauseTime > 0) {
|
|
1449
|
+
await new Promise((resolve) => setTimeout(resolve, pauseTime));
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
clearIntervals() {
|
|
1454
|
+
this.intervals.forEach(({ interval }) => clearInterval(interval));
|
|
1455
|
+
this.intervals = [];
|
|
1456
|
+
}
|
|
1450
1457
|
async onConfigure() {
|
|
1451
1458
|
await super.onConfigure();
|
|
1452
1459
|
this.log.info('onConfigure called');
|
|
1453
1460
|
if (this.config.useInterval) {
|
|
1454
|
-
this.
|
|
1455
|
-
this.phase = this.phase + 1 > 10 ? 0 : this.phase + 1;
|
|
1461
|
+
this.addInterval(async () => {
|
|
1456
1462
|
this.log.info(`Appliances animation phase ${this.phase}`);
|
|
1457
1463
|
if (this.phase === 0) {
|
|
1458
1464
|
if (this.airConditioner || this.laundryWasher || this.laundryDryer || this.dishwasher)
|
|
@@ -1664,10 +1670,12 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1664
1670
|
if (this.phase === 9)
|
|
1665
1671
|
await this.refrigerator.triggerDoorOpenState('FreezerBottom', false);
|
|
1666
1672
|
}
|
|
1673
|
+
this.phase++;
|
|
1674
|
+
this.phase = this.phase >= 10 ? 0 : this.phase;
|
|
1667
1675
|
}, 10 * 1000);
|
|
1668
1676
|
}
|
|
1669
1677
|
if (this.config.useInterval) {
|
|
1670
|
-
this.
|
|
1678
|
+
this.addInterval(async () => {
|
|
1671
1679
|
let value = this.door?.getAttribute(BooleanState.Cluster.id, 'stateValue', this.door.log);
|
|
1672
1680
|
if (isValidBoolean(value)) {
|
|
1673
1681
|
value = !value;
|
|
@@ -1720,7 +1728,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1720
1728
|
await this.mountedOnOffSwitch?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.mountedOnOffSwitch.log);
|
|
1721
1729
|
this.switch?.log.info(`Set switch initial onOff to ${this.intervalOnOff}`);
|
|
1722
1730
|
if (this.config.useInterval) {
|
|
1723
|
-
this.
|
|
1731
|
+
this.addInterval(async () => {
|
|
1724
1732
|
await this.switch?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.switch.log);
|
|
1725
1733
|
await this.mountedOnOffSwitch?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.mountedOnOffSwitch.log);
|
|
1726
1734
|
this.log.info(`Set switches onOff to ${this.intervalOnOff}`);
|
|
@@ -1758,7 +1766,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1758
1766
|
await this.lightCT?.configureColorControlMode(ColorControl.ColorMode.ColorTemperatureMireds);
|
|
1759
1767
|
this.lightCT?.log.info('Set light CT initial onOff to true, currentLevel to 128, colorTemperatureMireds to 250.');
|
|
1760
1768
|
if (this.config.useInterval) {
|
|
1761
|
-
this.
|
|
1769
|
+
this.addInterval(async () => {
|
|
1762
1770
|
this.intervalLevel += 10;
|
|
1763
1771
|
if (this.intervalLevel >= 250) {
|
|
1764
1772
|
this.intervalLevel = 1;
|
|
@@ -1818,7 +1826,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1818
1826
|
await this.outletEnergyApparent?.setAttribute(ElectricalPowerMeasurement.Cluster.id, 'apparentCurrent', 0, this.outletEnergyApparent.log);
|
|
1819
1827
|
await this.outletEnergyApparent?.setAttribute(ElectricalPowerMeasurement.Cluster.id, 'apparentPower', 0, this.outletEnergyApparent.log);
|
|
1820
1828
|
if (this.config.useInterval) {
|
|
1821
|
-
this.
|
|
1829
|
+
this.addInterval(async () => {
|
|
1822
1830
|
let state = this.outlet?.getAttribute(OnOff.Cluster.id, 'onOff', this.outlet.log);
|
|
1823
1831
|
if (isValidBoolean(state)) {
|
|
1824
1832
|
this.outlet?.log.info(`Set outlet onOff to ${!state}`);
|
|
@@ -1880,7 +1888,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1880
1888
|
await this.coverLift?.setWindowCoveringTargetAsCurrentAndStopped();
|
|
1881
1889
|
this.coverLift?.log.info('Set cover initial targetPositionLiftPercent100ths = currentPositionLiftPercent100ths and operationalStatus to Stopped.');
|
|
1882
1890
|
if (this.config.useInterval) {
|
|
1883
|
-
this.
|
|
1891
|
+
this.addInterval(async () => {
|
|
1884
1892
|
let position = this.coverLift?.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.coverLift.log);
|
|
1885
1893
|
if (isValidNumber(position, 0, 10000)) {
|
|
1886
1894
|
position = position > 9000 ? 0 : position + 1000;
|
|
@@ -1894,7 +1902,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1894
1902
|
await this.lock?.setAttribute(DoorLock.Cluster.id, 'lockState', DoorLock.LockState.Locked, this.lock.log);
|
|
1895
1903
|
this.lock?.log.info('Set lock initial lockState to Locked');
|
|
1896
1904
|
if (this.config.useInterval) {
|
|
1897
|
-
this.
|
|
1905
|
+
this.addInterval(async () => {
|
|
1898
1906
|
const status = this.lock?.getAttribute(DoorLock.Cluster.id, 'lockState', this.lock.log);
|
|
1899
1907
|
if (isValidNumber(status, DoorLock.LockState.Locked, DoorLock.LockState.Unlocked)) {
|
|
1900
1908
|
await this.lock?.setAttribute(DoorLock.Cluster.id, 'lockState', status === DoorLock.LockState.Locked ? DoorLock.LockState.Unlocked : DoorLock.LockState.Locked, this.lock.log);
|
|
@@ -1920,7 +1928,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1920
1928
|
await this.thermoAutoOccupancy?.setAttribute(ThermostatCluster.id, 'systemMode', Thermostat.SystemMode.Auto, this.thermoAutoOccupancy.log);
|
|
1921
1929
|
this.thermoAutoOccupancy?.log.info('Set thermostat occupancy to true and mode Auto');
|
|
1922
1930
|
if (this.config.useInterval) {
|
|
1923
|
-
this.
|
|
1931
|
+
this.addInterval(async () => {
|
|
1924
1932
|
let temperature = this.thermoAuto?.getAttribute(ThermostatCluster.id, 'localTemperature', this.thermoAuto.log);
|
|
1925
1933
|
if (isValidNumber(temperature, 1600, 2400)) {
|
|
1926
1934
|
temperature = temperature + 100 > 2400 ? 1600 : temperature + 100;
|
|
@@ -1964,7 +1972,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1964
1972
|
await this.airConditioner?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.airConditioner.log);
|
|
1965
1973
|
await this.airConditioner?.setAttribute(ThermostatCluster.id, 'localTemperature', 2000, this.airConditioner.log);
|
|
1966
1974
|
if (this.config.useInterval) {
|
|
1967
|
-
this.
|
|
1975
|
+
this.addInterval(async () => {
|
|
1968
1976
|
let temperature = this.airConditioner?.getAttribute(ThermostatCluster.id, 'localTemperature', this.airConditioner.log);
|
|
1969
1977
|
if (isValidNumber(temperature, 1600, 2400)) {
|
|
1970
1978
|
temperature = temperature + 100 > 2400 ? 1600 : temperature + 100;
|
|
@@ -1986,7 +1994,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
1986
1994
|
await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 0, this.fanComplete.log);
|
|
1987
1995
|
await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentSetting', 0, this.fanComplete.log);
|
|
1988
1996
|
if (this.config.useInterval) {
|
|
1989
|
-
this.
|
|
1997
|
+
this.addInterval(async () => {
|
|
1990
1998
|
let mode = this.fanBase?.getAttribute(FanControl.Cluster.id, 'fanMode', this.fanBase.log);
|
|
1991
1999
|
let value = this.fanBase?.getAttribute(FanControl.Cluster.id, 'percentCurrent', this.fanBase.log);
|
|
1992
2000
|
mode = this.fanDefault?.getAttribute(FanControl.Cluster.id, 'fanMode', this.fanDefault.log);
|
|
@@ -2009,7 +2017,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
2009
2017
|
}
|
|
2010
2018
|
await this.waterLeak?.setAttribute(BooleanState.Cluster.id, 'stateValue', false, this.waterLeak.log);
|
|
2011
2019
|
if (this.config.useInterval) {
|
|
2012
|
-
this.
|
|
2020
|
+
this.addInterval(async () => {
|
|
2013
2021
|
let value = this.waterLeak?.getAttribute(BooleanState.Cluster.id, 'stateValue', this.waterLeak.log);
|
|
2014
2022
|
if (isValidBoolean(value)) {
|
|
2015
2023
|
value = !value;
|
|
@@ -2020,7 +2028,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
2020
2028
|
}
|
|
2021
2029
|
await this.waterFreeze?.setAttribute(BooleanState.Cluster.id, 'stateValue', false, this.waterFreeze.log);
|
|
2022
2030
|
if (this.config.useInterval) {
|
|
2023
|
-
this.
|
|
2031
|
+
this.addInterval(async () => {
|
|
2024
2032
|
let value = this.waterFreeze?.getAttribute(BooleanState.Cluster.id, 'stateValue', this.waterFreeze.log);
|
|
2025
2033
|
if (isValidBoolean(value)) {
|
|
2026
2034
|
value = !value;
|
|
@@ -2031,7 +2039,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
2031
2039
|
}
|
|
2032
2040
|
await this.rain?.setAttribute(BooleanState.Cluster.id, 'stateValue', false, this.rain.log);
|
|
2033
2041
|
if (this.config.useInterval) {
|
|
2034
|
-
this.
|
|
2042
|
+
this.addInterval(async () => {
|
|
2035
2043
|
let value = this.rain?.getAttribute(BooleanState.Cluster.id, 'stateValue', this.rain.log);
|
|
2036
2044
|
if (isValidBoolean(value)) {
|
|
2037
2045
|
value = !value;
|
|
@@ -2045,7 +2053,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
2045
2053
|
await this.smokeOnly?.setAttribute(SmokeCoAlarm.Cluster.id, 'smokeState', SmokeCoAlarm.AlarmState.Normal, this.smokeOnly.log);
|
|
2046
2054
|
await this.coOnly?.setAttribute(SmokeCoAlarm.Cluster.id, 'coState', SmokeCoAlarm.AlarmState.Normal, this.coOnly.log);
|
|
2047
2055
|
if (this.config.useInterval) {
|
|
2048
|
-
this.
|
|
2056
|
+
this.addInterval(async () => {
|
|
2049
2057
|
let value = this.smokeCo?.getAttribute(SmokeCoAlarm.Cluster.id, 'smokeState', this.smokeCo.log);
|
|
2050
2058
|
if (isValidNumber(value, SmokeCoAlarm.AlarmState.Normal, SmokeCoAlarm.AlarmState.Critical)) {
|
|
2051
2059
|
value = value === SmokeCoAlarm.AlarmState.Normal ? SmokeCoAlarm.AlarmState.Critical : SmokeCoAlarm.AlarmState.Normal;
|
|
@@ -2071,7 +2079,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
2071
2079
|
await this.airQuality?.setAttribute(RadonConcentrationMeasurement.Cluster.id, 'measuredValue', 100, this.airQuality.log);
|
|
2072
2080
|
await this.airQuality?.setAttribute(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id, 'measuredValue', 100, this.airQuality.log);
|
|
2073
2081
|
if (this.config.useInterval) {
|
|
2074
|
-
this.
|
|
2082
|
+
this.addInterval(async () => {
|
|
2075
2083
|
let value = this.airQuality?.getAttribute(AirQuality.Cluster.id, 'airQuality', this.airQuality?.log);
|
|
2076
2084
|
if (isValidNumber(value, AirQuality.AirQualityEnum.Good, AirQuality.AirQualityEnum.ExtremelyPoor)) {
|
|
2077
2085
|
value = value >= AirQuality.AirQualityEnum.ExtremelyPoor ? AirQuality.AirQualityEnum.Good : value + 1;
|
|
@@ -2082,7 +2090,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
2082
2090
|
}
|
|
2083
2091
|
if (this.config.useInterval) {
|
|
2084
2092
|
this.genericSwitchLastEvent = 'Release';
|
|
2085
|
-
this.
|
|
2093
|
+
this.addInterval(async () => {
|
|
2086
2094
|
if (this.genericSwitchLastEvent === 'Release') {
|
|
2087
2095
|
this.genericSwitchLastEvent = 'Single';
|
|
2088
2096
|
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch1')?.triggerSwitchEvent('Single', this.momentarySwitch?.log);
|
|
@@ -2116,22 +2124,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
|
2116
2124
|
}
|
|
2117
2125
|
}
|
|
2118
2126
|
async onShutdown(reason) {
|
|
2119
|
-
|
|
2120
|
-
clearInterval(this.sensorInterval);
|
|
2121
|
-
clearInterval(this.switchInterval);
|
|
2122
|
-
clearInterval(this.lightInterval);
|
|
2123
|
-
clearInterval(this.outletInterval);
|
|
2124
|
-
clearInterval(this.coverInterval);
|
|
2125
|
-
clearInterval(this.lockInterval);
|
|
2126
|
-
clearInterval(this.thermoInterval);
|
|
2127
|
-
clearInterval(this.fanInterval);
|
|
2128
|
-
clearInterval(this.waterLeakInterval);
|
|
2129
|
-
clearInterval(this.waterFreezeInterval);
|
|
2130
|
-
clearInterval(this.rainInterval);
|
|
2131
|
-
clearInterval(this.smokeInterval);
|
|
2132
|
-
clearInterval(this.airQualityInterval);
|
|
2133
|
-
clearInterval(this.airConditionerInterval);
|
|
2134
|
-
clearInterval(this.genericSwitchInterval);
|
|
2127
|
+
this.clearIntervals();
|
|
2135
2128
|
await super.onShutdown(reason);
|
|
2136
2129
|
this.log.info('onShutdown called with reason:', reason ?? 'none');
|
|
2137
2130
|
if (this.config.unregisterOnShutdown === true)
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge-example-dynamic-platform",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge-example-dynamic-platform",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.10",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"node-ansi-logger": "3.2.0",
|