matterbridge 3.3.4 → 3.3.5-dev-20251028-d89f93f
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/broadcastServer.js +1 -92
- package/dist/broadcastServerTypes.js +0 -24
- package/dist/cli.js +1 -97
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.js +0 -38
- package/dist/clusters/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -24
- package/dist/deviceManager.js +8 -124
- package/dist/devices/airConditioner.js +0 -57
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/cooktop.js +0 -55
- package/dist/devices/dishwasher.js +0 -57
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.js +0 -5
- package/dist/devices/extractorHood.js +0 -42
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.js +3 -62
- package/dist/devices/laundryWasher.js +4 -70
- package/dist/devices/microwaveOven.js +5 -88
- package/dist/devices/oven.js +0 -85
- package/dist/devices/refrigerator.js +0 -102
- package/dist/devices/roboticVacuumCleaner.js +9 -100
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/speaker.js +0 -84
- package/dist/devices/temperatureControl.js +3 -24
- package/dist/devices/waterHeater.js +2 -82
- package/dist/dgram/coap.js +13 -126
- package/dist/dgram/dgram.js +2 -114
- package/dist/dgram/mb_coap.js +3 -41
- package/dist/dgram/mb_mdns.js +15 -80
- package/dist/dgram/mdns.js +137 -299
- package/dist/dgram/multicast.js +1 -62
- package/dist/dgram/unicast.js +0 -54
- package/dist/frontend.js +165 -493
- package/dist/frontendTypes.js +0 -45
- package/dist/helpers.js +0 -53
- package/dist/index.js +0 -25
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -3
- package/dist/matter/types.js +0 -3
- package/dist/matterbridge.js +53 -828
- package/dist/matterbridgeAccessoryPlatform.js +0 -37
- package/dist/matterbridgeBehaviors.js +5 -68
- package/dist/matterbridgeDeviceTypes.js +17 -638
- package/dist/matterbridgeDynamicPlatform.js +0 -37
- package/dist/matterbridgeEndpoint.js +52 -1402
- package/dist/matterbridgeEndpointHelpers.js +19 -464
- package/dist/matterbridgePlatform.js +1 -341
- package/dist/matterbridgeTypes.js +0 -26
- package/dist/pluginManager.js +11 -319
- package/dist/shelly.js +7 -168
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -69
- package/dist/utils/colorUtils.js +2 -97
- package/dist/utils/commandLine.js +0 -60
- package/dist/utils/copyDirectory.js +1 -38
- package/dist/utils/createDirectory.js +0 -33
- package/dist/utils/createZip.js +2 -47
- package/dist/utils/deepCopy.js +0 -39
- package/dist/utils/deepEqual.js +1 -72
- package/dist/utils/error.js +0 -41
- package/dist/utils/export.js +0 -1
- package/dist/utils/format.js +0 -49
- package/dist/utils/hex.js +0 -124
- package/dist/utils/inspector.js +1 -69
- package/dist/utils/isvalid.js +0 -101
- package/dist/utils/jestHelpers.js +3 -153
- package/dist/utils/network.js +5 -96
- package/dist/utils/spawn.js +0 -71
- package/dist/utils/tracker.js +1 -64
- package/dist/utils/wait.js +8 -60
- package/frontend/build/assets/index.js +4 -4
- package/frontend/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -2
- package/dist/broadcastServer.d.ts +0 -112
- package/dist/broadcastServer.d.ts.map +0 -1
- package/dist/broadcastServer.js.map +0 -1
- package/dist/broadcastServerTypes.d.ts +0 -793
- package/dist/broadcastServerTypes.d.ts.map +0 -1
- package/dist/broadcastServerTypes.js.map +0 -1
- package/dist/cli.d.ts +0 -30
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts +0 -50
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.js.map +0 -1
- package/dist/cliHistory.d.ts +0 -48
- package/dist/cliHistory.d.ts.map +0 -1
- package/dist/cliHistory.js.map +0 -1
- package/dist/clusters/export.d.ts +0 -2
- package/dist/clusters/export.d.ts.map +0 -1
- package/dist/clusters/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -28
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -117
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/airConditioner.d.ts +0 -98
- package/dist/devices/airConditioner.d.ts.map +0 -1
- package/dist/devices/airConditioner.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts +0 -48
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/cooktop.d.ts +0 -60
- package/dist/devices/cooktop.d.ts.map +0 -1
- package/dist/devices/cooktop.js.map +0 -1
- package/dist/devices/dishwasher.d.ts +0 -71
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts +0 -76
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts +0 -17
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/extractorHood.d.ts +0 -46
- package/dist/devices/extractorHood.d.ts.map +0 -1
- package/dist/devices/extractorHood.js.map +0 -1
- package/dist/devices/heatPump.d.ts +0 -47
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts +0 -67
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts +0 -81
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/microwaveOven.d.ts +0 -168
- package/dist/devices/microwaveOven.d.ts.map +0 -1
- package/dist/devices/microwaveOven.js.map +0 -1
- package/dist/devices/oven.d.ts +0 -105
- package/dist/devices/oven.d.ts.map +0 -1
- package/dist/devices/oven.js.map +0 -1
- package/dist/devices/refrigerator.d.ts +0 -118
- package/dist/devices/refrigerator.d.ts.map +0 -1
- package/dist/devices/refrigerator.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts +0 -40
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/speaker.d.ts +0 -87
- package/dist/devices/speaker.d.ts.map +0 -1
- package/dist/devices/speaker.js.map +0 -1
- package/dist/devices/temperatureControl.d.ts +0 -166
- package/dist/devices/temperatureControl.d.ts.map +0 -1
- package/dist/devices/temperatureControl.js.map +0 -1
- package/dist/devices/waterHeater.d.ts +0 -111
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/dgram/coap.d.ts +0 -205
- package/dist/dgram/coap.d.ts.map +0 -1
- package/dist/dgram/coap.js.map +0 -1
- package/dist/dgram/dgram.d.ts +0 -141
- package/dist/dgram/dgram.d.ts.map +0 -1
- package/dist/dgram/dgram.js.map +0 -1
- package/dist/dgram/mb_coap.d.ts +0 -24
- package/dist/dgram/mb_coap.d.ts.map +0 -1
- package/dist/dgram/mb_coap.js.map +0 -1
- package/dist/dgram/mb_mdns.d.ts +0 -24
- package/dist/dgram/mb_mdns.d.ts.map +0 -1
- package/dist/dgram/mb_mdns.js.map +0 -1
- package/dist/dgram/mdns.d.ts +0 -290
- package/dist/dgram/mdns.d.ts.map +0 -1
- package/dist/dgram/mdns.js.map +0 -1
- package/dist/dgram/multicast.d.ts +0 -67
- package/dist/dgram/multicast.d.ts.map +0 -1
- package/dist/dgram/multicast.js.map +0 -1
- package/dist/dgram/unicast.d.ts +0 -56
- package/dist/dgram/unicast.d.ts.map +0 -1
- package/dist/dgram/unicast.js.map +0 -1
- package/dist/frontend.d.ts +0 -235
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/frontendTypes.d.ts +0 -529
- package/dist/frontendTypes.d.ts.map +0 -1
- package/dist/frontendTypes.js.map +0 -1
- package/dist/helpers.d.ts +0 -48
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -33
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -475
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -2404
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -770
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -1550
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -758
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -402
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -226
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -347
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -174
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -75
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -99
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -66
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -33
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -34
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -39
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -32
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -54
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/error.d.ts +0 -44
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/export.d.ts +0 -13
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/format.d.ts +0 -53
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -89
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/inspector.d.ts +0 -87
- package/dist/utils/inspector.d.ts.map +0 -1
- package/dist/utils/inspector.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -103
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/jestHelpers.d.ts +0 -139
- package/dist/utils/jestHelpers.d.ts.map +0 -1
- package/dist/utils/jestHelpers.js.map +0 -1
- package/dist/utils/network.d.ts +0 -101
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -35
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/tracker.d.ts +0 -108
- package/dist/utils/tracker.d.ts.map +0 -1
- package/dist/utils/tracker.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -54
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
|
@@ -1,48 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the ExtractorHood class.
|
|
3
|
-
* @file src/devices/extractorHood.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-05-25
|
|
6
|
-
* @version 1.1.0
|
|
7
|
-
* @license Apache-2.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
1
|
import { ResourceMonitoring } from '@matter/types/clusters/resource-monitoring';
|
|
24
|
-
// Matterbridge
|
|
25
2
|
import { extractorHood, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
26
3
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
27
4
|
export class ExtractorHood extends MatterbridgeEndpoint {
|
|
28
|
-
/**
|
|
29
|
-
* Creates an instance of the ExtractorHood class.
|
|
30
|
-
*
|
|
31
|
-
* @param {string} name - The name of the extractor hood.
|
|
32
|
-
* @param {string} serial - The serial number of the extractor hood.
|
|
33
|
-
*
|
|
34
|
-
* @param {number} [hepaCondition] - The initial HEPA filter condition (range 0-100). Default is 100.
|
|
35
|
-
* @param {ResourceMonitoring.ChangeIndication} hepaChangeIndication - The initial HEPA filter change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
36
|
-
* @param {boolean | undefined} hepaInPlaceIndicator - The HEPA filter in-place indicator. Default is true.
|
|
37
|
-
* @param {number | null | undefined} hepaLastChangedTime - The last time the HEPA filter was changed. Default is null.
|
|
38
|
-
* @param {ResourceMonitoring.ReplacementProduct[]} hepaReplacementProductList - The list of HEPA filter replacement products. Default is an empty array.
|
|
39
|
-
|
|
40
|
-
* @param {number} [activatedCarbonCondition] - The initial activated carbon filter condition (range 0-100). Default is 100.
|
|
41
|
-
* @param {ResourceMonitoring.ChangeIndication} activatedCarbonChangeIndication - The initial activated carbon filter change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
42
|
-
* @param {boolean | undefined} activatedCarbonInPlaceIndicator - The activated carbon filter in-place indicator. Default is true.
|
|
43
|
-
* @param {number | null | undefined} activatedCarbonLastChangedTime - The last time the activated carbon filter was changed. Default is null.
|
|
44
|
-
* @param {ResourceMonitoring.ReplacementProduct[]} activatedCarbonReplacementProductList - The list of activated carbon filter replacement products. Default is an empty array.
|
|
45
|
-
*/
|
|
46
5
|
constructor(name, serial, hepaCondition = 100, hepaChangeIndication = ResourceMonitoring.ChangeIndication.Ok, hepaInPlaceIndicator = true, hepaLastChangedTime = null, hepaReplacementProductList = [], activatedCarbonCondition = 100, activatedCarbonChangeIndication = ResourceMonitoring.ChangeIndication.Ok, activatedCarbonInPlaceIndicator = true, activatedCarbonLastChangedTime = null, activatedCarbonReplacementProductList = []) {
|
|
47
6
|
super([extractorHood, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
48
7
|
this.createDefaultIdentifyClusterServer();
|
|
@@ -74,4 +33,3 @@ export class ExtractorHood extends MatterbridgeEndpoint {
|
|
|
74
33
|
});
|
|
75
34
|
}
|
|
76
35
|
}
|
|
77
|
-
//# sourceMappingURL=extractorHood.js.map
|
package/dist/devices/heatPump.js
CHANGED
|
@@ -1,52 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the HeatPump class.
|
|
3
|
-
* @file src/devices/heatPump.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-06-29
|
|
6
|
-
* @version 1.0.0
|
|
7
|
-
* @license Apache-2.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
// @matter
|
|
24
1
|
import { NumberTag, PowerSourceTag } from '@matter/node';
|
|
25
2
|
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
26
|
-
// Matterbridge
|
|
27
3
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
28
4
|
import { deviceEnergyManagement, electricalSensor, powerSource, heatPump, temperatureSensor, thermostatDevice } from '../matterbridgeDeviceTypes.js';
|
|
29
5
|
export class HeatPump extends MatterbridgeEndpoint {
|
|
30
|
-
/**
|
|
31
|
-
* Creates an instance of the HeatPump class.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} name - The name of the HeatPump.
|
|
34
|
-
* @param {string} serial - The serial number of the HeatPump.
|
|
35
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
36
|
-
* @param {number} current - The current value in milliamperes.
|
|
37
|
-
* @param {number} power - The power value in milliwatts.
|
|
38
|
-
* @param {number} energyImported - The total production value in mW/h.
|
|
39
|
-
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
40
|
-
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* - The HeatPump includes clusters for power source, electrical power measurement, electrical energy measurement, and device energy management.
|
|
44
|
-
* - It also includes child devices for flow temperature, return temperature, and a thermostat.
|
|
45
|
-
* - The flow and return temperature sensors are set to default values of 45.00°C and 35.00°C respectively.
|
|
46
|
-
* - The heating only thermostat is set up with a default temperature setpoint of 21.00°C.
|
|
47
|
-
* - The device energy management cluster is set to `esaType` as `SpaceHeating`, `esaCanGenerate` as `false`, and `esaState` as `Online`.
|
|
48
|
-
* - The absolute minimum and maximum power values can be set to indicate the range of power consumption for the heat pump.
|
|
49
|
-
*/
|
|
50
6
|
constructor(name, serial, voltage = null, current = null, power = null, energyImported = null, absMinPower = 0, absMaxPower = 0) {
|
|
51
7
|
super([heatPump, powerSource, electricalSensor, deviceEnergyManagement], {
|
|
52
8
|
tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Grid.namespaceId, tag: PowerSourceTag.Grid.tag, label: null }],
|
|
@@ -61,19 +17,16 @@ export class HeatPump extends MatterbridgeEndpoint {
|
|
|
61
17
|
.createDefaultDeviceEnergyManagementClusterServer(DeviceEnergyManagement.EsaType.SpaceHeating, false, DeviceEnergyManagement.EsaState.Online, absMinPower, absMaxPower)
|
|
62
18
|
.createDefaultDeviceEnergyManagementModeClusterServer()
|
|
63
19
|
.addRequiredClusterServers();
|
|
64
|
-
// Add the flow temperature sensor for the heat pump.
|
|
65
20
|
this.addChildDeviceType('FlowTemperature', temperatureSensor, {
|
|
66
21
|
tagList: [{ mfgCode: null, namespaceId: NumberTag.One.namespaceId, tag: NumberTag.One.tag, label: 'Flow' }],
|
|
67
22
|
})
|
|
68
|
-
.createDefaultTemperatureMeasurementClusterServer(4500)
|
|
23
|
+
.createDefaultTemperatureMeasurementClusterServer(4500)
|
|
69
24
|
.addRequiredClusterServers();
|
|
70
|
-
// Add the return temperature sensor for the heat pump.
|
|
71
25
|
this.addChildDeviceType('ReturnTemperature', temperatureSensor, {
|
|
72
26
|
tagList: [{ mfgCode: null, namespaceId: NumberTag.Two.namespaceId, tag: NumberTag.Two.tag, label: 'Return' }],
|
|
73
27
|
})
|
|
74
|
-
.createDefaultTemperatureMeasurementClusterServer(3500)
|
|
28
|
+
.createDefaultTemperatureMeasurementClusterServer(3500)
|
|
75
29
|
.addRequiredClusterServers();
|
|
76
|
-
// Add the global thermostat for the heat pump.
|
|
77
30
|
this.addChildDeviceType('Thermostat', thermostatDevice, {
|
|
78
31
|
tagList: [{ mfgCode: null, namespaceId: NumberTag.One.namespaceId, tag: NumberTag.One.tag, label: 'Main Thermostat' }],
|
|
79
32
|
})
|
|
@@ -81,4 +34,3 @@ export class HeatPump extends MatterbridgeEndpoint {
|
|
|
81
34
|
.addRequiredClusterServers();
|
|
82
35
|
}
|
|
83
36
|
}
|
|
84
|
-
//# sourceMappingURL=heatPump.js.map
|
|
@@ -1,53 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the LaundryDryer class.
|
|
3
|
-
* @file src/devices/laundryDryer.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-06-29
|
|
6
|
-
* @version 1.1.0
|
|
7
|
-
* @license Apache-2.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
1
|
import { LaundryWasherMode } from '@matter/types/clusters/laundry-washer-mode';
|
|
24
2
|
import { LaundryDryerControls } from '@matter/types/clusters/laundry-dryer-controls';
|
|
25
3
|
import { LaundryDryerControlsServer } from '@matter/node/behaviors/laundry-dryer-controls';
|
|
26
|
-
// Matterbridge
|
|
27
4
|
import { laundryDryer, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
28
5
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
29
6
|
import { MatterbridgeLaundryWasherModeServer } from './laundryWasher.js';
|
|
30
7
|
import { createLevelTemperatureControlClusterServer, createNumberTemperatureControlClusterServer } from './temperatureControl.js';
|
|
31
8
|
export class LaundryDryer extends MatterbridgeEndpoint {
|
|
32
|
-
/**
|
|
33
|
-
* Creates an instance of the LaundryDryer class.
|
|
34
|
-
*
|
|
35
|
-
* @param {string} name - The name of the laundry dryer.
|
|
36
|
-
* @param {string} serial - The serial number of the laundry dryer.
|
|
37
|
-
* @param {number} [currentMode] - The current mode of the laundry dryer. Defaults to 2 (Normal mode). Dead Front OnOff Cluster will set this to 2 when turned off. Persistent attribute.
|
|
38
|
-
* @param {LaundryWasherMode.ModeOption[]} [supportedModes] - The supported modes of the laundry dryer. Defaults to a set of common modes (which include Delicate, Normal, Heavy, and Whites). Fixed attribute.
|
|
39
|
-
* @param {number} [selectedTemperatureLevel] - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 1 (which corresponds to 'Warm').
|
|
40
|
-
* @param {string[]} [supportedTemperatureLevels] - The supported temperature levels. Defaults to ['Cold', 'Warm', 'Hot', '30°', '40°', '60°', '80°']. Fixed attribute.
|
|
41
|
-
* @param {number} [temperatureSetpoint] - The temperature setpoint * 100. Defaults to 40 * 100 (which corresponds to 40°C).
|
|
42
|
-
* @param {number} [minTemperature] - The minimum temperature * 100. Defaults to 30 * 100 (which corresponds to 30°C). Fixed attribute.
|
|
43
|
-
* @param {number} [maxTemperature] - The maximum temperature * 100. Defaults to 60 * 100 (which corresponds to 60°C). Fixed attribute.
|
|
44
|
-
* @param {number} [step] - The step size for temperature changes. Defaults to 10 * 100 (which corresponds to 10°C). Fixed attribute.
|
|
45
|
-
* @param {OperationalState.OperationalStateEnum} [operationalState] - The operational state of the laundry washer. Defaults to OperationalState.OperationalStateEnum.Off.
|
|
46
|
-
*
|
|
47
|
-
* Remarks:
|
|
48
|
-
* - If `temperatureSetpoint` is provided, the `createNumberTemperatureControlClusterServer` method will be used to create the TemperatureControl Cluster Server with features TemperatureNumber and TemperatureStep.
|
|
49
|
-
* - If `temperatureSetpoint` is not provided, the `createLevelTemperatureControlClusterServer` method will be used to create the TemperatureControl Cluster Server with feature TemperatureLevel.
|
|
50
|
-
*/
|
|
51
9
|
constructor(name, serial, currentMode, supportedModes, selectedTemperatureLevel, supportedTemperatureLevels, temperatureSetpoint, minTemperature, maxTemperature, step, operationalState) {
|
|
52
10
|
super([laundryDryer, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
53
11
|
this.createDefaultIdentifyClusterServer();
|
|
@@ -62,14 +20,6 @@ export class LaundryDryer extends MatterbridgeEndpoint {
|
|
|
62
20
|
createLevelTemperatureControlClusterServer(this, selectedTemperatureLevel, supportedTemperatureLevels);
|
|
63
21
|
this.createDefaultOperationalStateClusterServer(operationalState);
|
|
64
22
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Creates a default Laundry Washer Mode Cluster Server.
|
|
67
|
-
*
|
|
68
|
-
* @param {number} currentMode - The current mode of the laundry washer. Defaults to 2 (Normal mode). Dead Front OnOff Cluster will set this to 2 when turned off. Persistent attribute.
|
|
69
|
-
* @param {LaundryWasherMode.ModeOption[]} supportedModes - The supported modes of the laundry washer. Defaults to a set of common modes (which include Delicate, Normal, Heavy, and Whites). Fixed attribute.
|
|
70
|
-
*
|
|
71
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
72
|
-
*/
|
|
73
23
|
createDefaultLaundryWasherModeClusterServer(currentMode = 2, supportedModes = [
|
|
74
24
|
{ label: 'Delicate', mode: 1, modeTags: [{ value: LaundryWasherMode.ModeTag.Delicate }] },
|
|
75
25
|
{ label: 'Normal', mode: 2, modeTags: [{ value: LaundryWasherMode.ModeTag.Normal }] },
|
|
@@ -77,25 +27,16 @@ export class LaundryDryer extends MatterbridgeEndpoint {
|
|
|
77
27
|
{ label: 'Whites', mode: 4, modeTags: [{ value: LaundryWasherMode.ModeTag.Whites }] },
|
|
78
28
|
]) {
|
|
79
29
|
this.behaviors.require(MatterbridgeLaundryWasherModeServer, {
|
|
80
|
-
supportedModes,
|
|
81
|
-
currentMode,
|
|
30
|
+
supportedModes,
|
|
31
|
+
currentMode,
|
|
82
32
|
});
|
|
83
33
|
return this;
|
|
84
34
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Creates a default Laundry Dryer Controls Cluster Server.
|
|
87
|
-
*
|
|
88
|
-
* @param {LaundryDryerControls.DrynessLevel} selectedDrynessLevel - The selected dryness level. Default is undefined.
|
|
89
|
-
* @param {LaundryDryerControls.DrynessLevel[]} supportedDrynessLevels - The supported dryness levels. Default is [Low, Normal, Extra, Max].
|
|
90
|
-
*
|
|
91
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
92
|
-
*/
|
|
93
35
|
createDefaultLaundryDryerControlsClusterServer(selectedDrynessLevel, supportedDrynessLevels) {
|
|
94
36
|
this.behaviors.require(LaundryDryerControlsServer, {
|
|
95
37
|
supportedDrynessLevels: supportedDrynessLevels ?? [LaundryDryerControls.DrynessLevel.Low, LaundryDryerControls.DrynessLevel.Normal, LaundryDryerControls.DrynessLevel.Extra, LaundryDryerControls.DrynessLevel.Max],
|
|
96
|
-
selectedDrynessLevel,
|
|
38
|
+
selectedDrynessLevel,
|
|
97
39
|
});
|
|
98
40
|
return this;
|
|
99
41
|
}
|
|
100
42
|
}
|
|
101
|
-
//# sourceMappingURL=laundryDryer.js.map
|
|
@@ -1,59 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the LaundryWasher class.
|
|
3
|
-
* @file src/devices/laundryWasher.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-05-25
|
|
6
|
-
* @version 1.1.0
|
|
7
|
-
* @license Apache-2.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
1
|
import { LaundryWasherControls } from '@matter/types/clusters/laundry-washer-controls';
|
|
24
2
|
import { LaundryWasherMode } from '@matter/types/clusters/laundry-washer-mode';
|
|
25
3
|
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
26
4
|
import { LaundryWasherModeServer } from '@matter/node/behaviors/laundry-washer-mode';
|
|
27
5
|
import { LaundryWasherControlsServer } from '@matter/node/behaviors/laundry-washer-controls';
|
|
28
|
-
// Matterbridge
|
|
29
6
|
import { laundryWasher, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
30
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
31
8
|
import { MatterbridgeOnOffServer, MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
32
9
|
import { createLevelTemperatureControlClusterServer, createNumberTemperatureControlClusterServer } from './temperatureControl.js';
|
|
33
10
|
export class LaundryWasher extends MatterbridgeEndpoint {
|
|
34
|
-
/**
|
|
35
|
-
* Creates an instance of the LaundryWasher class.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} name - The name of the laundry washer.
|
|
38
|
-
* @param {string} serial - The serial number of the laundry washer.
|
|
39
|
-
* @param {number} [currentMode] - The current mode of the laundry washer. Defaults to 2 (Normal mode). Dead Front OnOff Cluster will set this to 2 when turned off. Persistent attribute.
|
|
40
|
-
* @param {LaundryWasherMode.ModeOption[]} [supportedModes] - The supported modes of the laundry washer. Defaults to a set of common modes (which include Delicate, Normal, Heavy, and Whites). Fixed attribute.
|
|
41
|
-
* @param {number} [spinSpeedCurrent] - The current spin speed as index of the spinSpeeds array. Defaults to 2 (which corresponds to '1200').
|
|
42
|
-
* @param {string[]} [spinSpeeds] - The supported spin speeds. Defaults to ['400', '800', '1200', '1600'].
|
|
43
|
-
* @param {LaundryWasherControls.NumberOfRinses} [numberOfRinses] - The number of rinses. Defaults to LaundryWasherControls.NumberOfRinses.Normal (which corresponds to 1 rinse).
|
|
44
|
-
* @param {LaundryWasherControls.NumberOfRinses[]} [supportedRinses] - The supported rinses. Defaults to [NumberOfRinses.None, NumberOfRinses.Normal, NumberOfRinses.Max, NumberOfRinses.Extra].
|
|
45
|
-
* @param {number} [selectedTemperatureLevel] - The selected temperature level as an index of the supportedTemperatureLevels array. Defaults to 1 (which corresponds to 'Warm').
|
|
46
|
-
* @param {string[]} [supportedTemperatureLevels] - The supported temperature levels. Defaults to ['Cold', 'Warm', 'Hot', '30°', '40°', '60°', '80°']. Fixed attribute.
|
|
47
|
-
* @param {number} [temperatureSetpoint] - The temperature setpoint * 100. Defaults to 40 * 100 (which corresponds to 40°C).
|
|
48
|
-
* @param {number} [minTemperature] - The minimum temperature * 100. Defaults to 30 * 100 (which corresponds to 30°C). Fixed attribute.
|
|
49
|
-
* @param {number} [maxTemperature] - The maximum temperature * 100. Defaults to 60 * 100 (which corresponds to 60°C). Fixed attribute.
|
|
50
|
-
* @param {number} [step] - The step size for temperature changes. Defaults to 10 * 100 (which corresponds to 10°C). Fixed attribute.
|
|
51
|
-
* @param {OperationalState.OperationalStateEnum} [operationalState] - The operational state of the laundry washer. Defaults to OperationalState.OperationalStateEnum.Off.
|
|
52
|
-
*
|
|
53
|
-
* Remarks:
|
|
54
|
-
* - If `temperatureSetpoint` is provided, the `createNumberTemperatureControlClusterServer` method will be used to create the TemperatureControl Cluster Server with features TemperatureNumber and TemperatureStep.
|
|
55
|
-
* - If `temperatureSetpoint` is not provided, the `createLevelTemperatureControlClusterServer` method will be used to create the TemperatureControl Cluster Server with feature TemperatureLevel.
|
|
56
|
-
*/
|
|
57
11
|
constructor(name, serial, currentMode, supportedModes, spinSpeedCurrent, spinSpeeds, numberOfRinses, supportedRinses, selectedTemperatureLevel, supportedTemperatureLevels, temperatureSetpoint, minTemperature, maxTemperature, step, operationalState) {
|
|
58
12
|
super([laundryWasher, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
59
13
|
this.createDefaultIdentifyClusterServer();
|
|
@@ -68,14 +22,6 @@ export class LaundryWasher extends MatterbridgeEndpoint {
|
|
|
68
22
|
createLevelTemperatureControlClusterServer(this, selectedTemperatureLevel, supportedTemperatureLevels);
|
|
69
23
|
this.createDefaultOperationalStateClusterServer(operationalState);
|
|
70
24
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Creates a default Laundry Washer Mode Cluster Server.
|
|
73
|
-
*
|
|
74
|
-
* @param {number} currentMode - The current mode of the laundry washer. Defaults to 2 (Normal mode). Dead Front OnOff Cluster will set this to 2 when turned off. Persistent attribute.
|
|
75
|
-
* @param {LaundryWasherMode.ModeOption[]} supportedModes - The supported modes of the laundry washer. Defaults to a set of common modes (which include Delicate, Normal, Heavy, and Whites). Fixed attribute.
|
|
76
|
-
*
|
|
77
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
78
|
-
*/
|
|
79
25
|
createDefaultLaundryWasherModeClusterServer(currentMode = 2, supportedModes = [
|
|
80
26
|
{ label: 'Delicate', mode: 1, modeTags: [{ value: LaundryWasherMode.ModeTag.Delicate }] },
|
|
81
27
|
{ label: 'Normal', mode: 2, modeTags: [{ value: LaundryWasherMode.ModeTag.Normal }] },
|
|
@@ -83,27 +29,17 @@ export class LaundryWasher extends MatterbridgeEndpoint {
|
|
|
83
29
|
{ label: 'Whites', mode: 4, modeTags: [{ value: LaundryWasherMode.ModeTag.Whites }] },
|
|
84
30
|
]) {
|
|
85
31
|
this.behaviors.require(MatterbridgeLaundryWasherModeServer, {
|
|
86
|
-
supportedModes,
|
|
87
|
-
currentMode,
|
|
32
|
+
supportedModes,
|
|
33
|
+
currentMode,
|
|
88
34
|
});
|
|
89
35
|
return this;
|
|
90
36
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Creates a Laundry Washer Controls Cluster Server with feature Spin for selecting the spin speed and feature Rinse for selecting the number of rinses.
|
|
93
|
-
*
|
|
94
|
-
* @param {number} spinSpeedCurrent - The current spin speed as index of the spinSpeeds array. Default to 2 (which corresponds to '1200').
|
|
95
|
-
* @param {string[]} spinSpeeds - The supported spin speeds. Default to ['400', '800', '1200', '1600'].
|
|
96
|
-
* @param {LaundryWasherControls.NumberOfRinses} numberOfRinses - The number of rinses. Default to LaundryWasherControls.NumberOfRinses.Normal (which corresponds to 1 rinse).
|
|
97
|
-
* @param {LaundryWasherControls.NumberOfRinses[]} supportedRinses - The supported rinses. Default to [NumberOfRinses.None, NumberOfRinses.Normal, NumberOfRinses.Max, NumberOfRinses.Extra].
|
|
98
|
-
*
|
|
99
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
100
|
-
*/
|
|
101
37
|
createDefaultLaundryWasherControlsClusterServer(spinSpeedCurrent = 2, spinSpeeds = ['400', '800', '1200', '1600'], numberOfRinses = LaundryWasherControls.NumberOfRinses.Normal, supportedRinses = [LaundryWasherControls.NumberOfRinses.None, LaundryWasherControls.NumberOfRinses.Normal, LaundryWasherControls.NumberOfRinses.Max, LaundryWasherControls.NumberOfRinses.Extra]) {
|
|
102
38
|
this.behaviors.require(LaundryWasherControlsServer.with(LaundryWasherControls.Feature.Spin, LaundryWasherControls.Feature.Rinse), {
|
|
103
39
|
spinSpeeds,
|
|
104
|
-
spinSpeedCurrent,
|
|
40
|
+
spinSpeedCurrent,
|
|
105
41
|
supportedRinses,
|
|
106
|
-
numberOfRinses,
|
|
42
|
+
numberOfRinses,
|
|
107
43
|
});
|
|
108
44
|
return this;
|
|
109
45
|
}
|
|
@@ -114,7 +50,6 @@ export class MatterbridgeLaundryWasherModeServer extends LaundryWasherModeServer
|
|
|
114
50
|
device.log.info(`MatterbridgeLaundryWasherModeServer initialized: currentMode is ${this.state.currentMode}`);
|
|
115
51
|
this.reactTo(this.agent.get(MatterbridgeOnOffServer).events.onOff$Changed, this.handleOnOffChange);
|
|
116
52
|
}
|
|
117
|
-
// Dead Front OnOff Cluster
|
|
118
53
|
handleOnOffChange(onOff) {
|
|
119
54
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
120
55
|
device.log.info(`HandleOnOffChange (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
@@ -139,4 +74,3 @@ export class MatterbridgeLaundryWasherModeServer extends LaundryWasherModeServer
|
|
|
139
74
|
}
|
|
140
75
|
}
|
|
141
76
|
}
|
|
142
|
-
//# sourceMappingURL=laundryWasher.js.map
|
|
@@ -1,52 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file contains the MicrowaveOven class.
|
|
3
|
-
* @file src/devices/microwaveOven.ts
|
|
4
|
-
* @author Luca Liguori
|
|
5
|
-
* @created 2025-05-25
|
|
6
|
-
* @version 1.1.0
|
|
7
|
-
* @license Apache-2.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
1
|
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
24
2
|
import { MicrowaveOvenMode } from '@matter/types/clusters/microwave-oven-mode';
|
|
25
3
|
import { MicrowaveOvenControl } from '@matter/types/clusters/microwave-oven-control';
|
|
26
4
|
import { MicrowaveOvenControlServer } from '@matter/node/behaviors/microwave-oven-control';
|
|
27
5
|
import { MicrowaveOvenModeServer } from '@matter/node/behaviors/microwave-oven-mode';
|
|
28
|
-
// Matterbridge
|
|
29
6
|
import { microwaveOven, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
30
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
31
8
|
import { MatterbridgeServer, MatterbridgeOperationalStateServer } from '../matterbridgeBehaviors.js';
|
|
32
9
|
export class MicrowaveOven extends MatterbridgeEndpoint {
|
|
33
|
-
/**
|
|
34
|
-
* Creates an instance of the MicrowaveOven class.
|
|
35
|
-
*
|
|
36
|
-
* @param {string} name - The name of the microwave oven.
|
|
37
|
-
* @param {string} serial - The serial number of the microwave oven.
|
|
38
|
-
* @param {number} currentMode - The current mode of the microwave oven. Default is 1 = Auto.
|
|
39
|
-
* @param {MicrowaveOvenMode.ModeOption[]} supportedModes - The supported modes of the microwave oven. Default is an array of all modes.
|
|
40
|
-
* @param {number} selectedWattIndex - The selected wattage index. Default is 5 (600W).
|
|
41
|
-
* @param {number[]} supportedWatts - The supported wattages. Default is an array of all standard microwave wattages.
|
|
42
|
-
* @param {number} cookTime - The initial cook time in seconds. Default is 60 seconds.
|
|
43
|
-
* @param {number} maxCookTime - The maximum cook time in seconds. Default is 3600 seconds (1 hour).
|
|
44
|
-
*
|
|
45
|
-
* @remarks
|
|
46
|
-
* - 8.12. Microwave Oven Mode Cluster
|
|
47
|
-
* - Exactly one entry in the SupportedModes attribute SHALL include the Normal mode tag in the ModeTags field.
|
|
48
|
-
* - The Normal and Defrost mode tags are mutually exclusive and SHALL NOT both be used together in a mode’s ModeTags.
|
|
49
|
-
*/
|
|
50
10
|
constructor(name, serial, currentMode = 1, supportedModes = [
|
|
51
11
|
{ label: 'Auto', mode: 1, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Auto }] },
|
|
52
12
|
{ label: 'Quick', mode: 2, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Quick }] },
|
|
@@ -55,8 +15,7 @@ export class MicrowaveOven extends MatterbridgeEndpoint {
|
|
|
55
15
|
{ label: 'Max', mode: 5, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Max }] },
|
|
56
16
|
{ label: 'Normal', mode: 6, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Normal }] },
|
|
57
17
|
{ label: 'Defrost', mode: 7, modeTags: [{ value: MicrowaveOvenMode.ModeTag.Defrost }] },
|
|
58
|
-
], selectedWattIndex = 5, supportedWatts = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], cookTime = 60,
|
|
59
|
-
maxCookTime = 3600) {
|
|
18
|
+
], selectedWattIndex = 5, supportedWatts = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], cookTime = 60, maxCookTime = 3600) {
|
|
60
19
|
super([microwaveOven, powerSource], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
61
20
|
this.createDefaultIdentifyClusterServer();
|
|
62
21
|
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Microwave Oven');
|
|
@@ -65,69 +24,32 @@ export class MicrowaveOven extends MatterbridgeEndpoint {
|
|
|
65
24
|
this.createDefaultMicrowaveOvenModeClusterServer(currentMode, supportedModes);
|
|
66
25
|
this.createDefaultMicrowaveOvenControlClusterServer(selectedWattIndex, supportedWatts, cookTime, maxCookTime);
|
|
67
26
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Creates a default MicrowaveOvenMode Cluster Server.
|
|
70
|
-
* There is no changeToMode command in the spec, so this is not implemented.
|
|
71
|
-
* The Microwave is controlled by the MicrowaveOvenControl cluster.
|
|
72
|
-
*
|
|
73
|
-
* @param {number} currentMode - The current mode of the oven.
|
|
74
|
-
* @param {MicrowaveOvenMode.ModeOption[]} supportedModes - The supported modes.
|
|
75
|
-
*
|
|
76
|
-
* @returns {MatterbridgeEndpoint} The current MatterbridgeEndpoint instance for chaining.
|
|
77
|
-
*
|
|
78
|
-
* @remarks
|
|
79
|
-
* - 8.12. Microwave Oven Mode Cluster
|
|
80
|
-
* - the supported modes are fixed and cannot be changed at runtime.
|
|
81
|
-
* - the current mode is persistent among reboots.
|
|
82
|
-
* - Exactly one entry in the SupportedModes attribute SHALL include the Normal mode tag in the ModeTags field.
|
|
83
|
-
* - The Normal and Defrost mode tags are mutually exclusive and SHALL NOT both be used together in a mode’s ModeTags.
|
|
84
|
-
*/
|
|
85
27
|
createDefaultMicrowaveOvenModeClusterServer(currentMode, supportedModes) {
|
|
86
28
|
this.behaviors.require(MicrowaveOvenModeServer, {
|
|
87
|
-
supportedModes,
|
|
88
|
-
currentMode,
|
|
29
|
+
supportedModes,
|
|
30
|
+
currentMode,
|
|
89
31
|
});
|
|
90
32
|
return this;
|
|
91
33
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Creates a default MicrowaveOvenControl Cluster Server.
|
|
94
|
-
*
|
|
95
|
-
* @param {number} selectedWattIndex - The selected watt index.
|
|
96
|
-
* @param {number[]} supportedWatts - The supported watt values.
|
|
97
|
-
* @param {number} cookTime - The initial cook time.
|
|
98
|
-
* @param {number} maxCookTime - The maximum cook time.
|
|
99
|
-
*
|
|
100
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
101
|
-
*
|
|
102
|
-
* @remarks
|
|
103
|
-
* - 8.13. Microwave Oven Control Cluster
|
|
104
|
-
* - the supported watt values are fixed and cannot be changed at runtime.
|
|
105
|
-
* - the maxCookTime is a fixed attribute and cannot be changed at runtime.
|
|
106
|
-
*/
|
|
107
34
|
createDefaultMicrowaveOvenControlClusterServer(selectedWattIndex, supportedWatts, cookTime, maxCookTime) {
|
|
108
35
|
this.behaviors.require(MatterbridgeMicrowaveOvenControlServer.with(MicrowaveOvenControl.Feature.PowerInWatts), {
|
|
109
|
-
supportedWatts,
|
|
36
|
+
supportedWatts,
|
|
110
37
|
selectedWattIndex,
|
|
111
38
|
cookTime,
|
|
112
|
-
maxCookTime,
|
|
39
|
+
maxCookTime,
|
|
113
40
|
});
|
|
114
41
|
return this;
|
|
115
42
|
}
|
|
116
43
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Matterbridge Microwave Oven Control Server
|
|
119
|
-
*/
|
|
120
44
|
export class MatterbridgeMicrowaveOvenControlServer extends MicrowaveOvenControlServer.with(MicrowaveOvenControl.Feature.PowerInWatts) {
|
|
121
45
|
initialize() {
|
|
122
46
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
123
47
|
device.log.info('MatterbridgeMicrowaveOvenControlServer initialized');
|
|
124
48
|
}
|
|
125
|
-
// 8.13.6.2. SetCookingParameters Command
|
|
126
49
|
setCookingParameters(request) {
|
|
127
50
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
128
51
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
129
52
|
device.commandHandler.executeHandler('setCookingParameters', { request, cluster: MicrowaveOvenControl.Cluster.id, attributes: this.state, endpoint: this.endpoint });
|
|
130
|
-
// 8.13.6.2.1. CookMode Field. Default to Normal mode if not present.
|
|
131
53
|
if (request.cookMode !== undefined) {
|
|
132
54
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting cookMode to ${request.cookMode}`);
|
|
133
55
|
this.endpoint.setStateOf(MicrowaveOvenModeServer, { currentMode: request.cookMode });
|
|
@@ -138,7 +60,6 @@ export class MatterbridgeMicrowaveOvenControlServer extends MicrowaveOvenControl
|
|
|
138
60
|
const normalMode = supportedModes.find((mode) => mode.modeTags.some((tag) => tag.value === MicrowaveOvenMode.ModeTag.Normal));
|
|
139
61
|
this.endpoint.setStateOf(MicrowaveOvenModeServer, { currentMode: normalMode?.mode });
|
|
140
62
|
}
|
|
141
|
-
// 8.13.6.2.2. CookTime Field. Default to 30 seconds.
|
|
142
63
|
if (request.cookTime !== undefined && request.cookTime >= 0 && request.cookTime <= this.state.maxCookTime) {
|
|
143
64
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting cookTime to ${request.cookTime}`);
|
|
144
65
|
this.state.cookTime = request.cookTime;
|
|
@@ -147,7 +68,6 @@ export class MatterbridgeMicrowaveOvenControlServer extends MicrowaveOvenControl
|
|
|
147
68
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called with no cookTime so set to 30sec.`);
|
|
148
69
|
this.state.cookTime = 30;
|
|
149
70
|
}
|
|
150
|
-
// 8.13.6.2.4. WattSettingIndex Field. Default the highest Watt setting for the selected CookMode.
|
|
151
71
|
if (request.wattSettingIndex !== undefined && request.wattSettingIndex >= 0 && request.wattSettingIndex < this.state.supportedWatts.length) {
|
|
152
72
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting selectedWattIndex to ${request.wattSettingIndex}`);
|
|
153
73
|
this.state.selectedWattIndex = request.wattSettingIndex;
|
|
@@ -156,13 +76,11 @@ export class MatterbridgeMicrowaveOvenControlServer extends MicrowaveOvenControl
|
|
|
156
76
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called with no wattSettingIndex so set to the highest Watt setting for the selected CookMode`);
|
|
157
77
|
this.state.selectedWattIndex = this.state.supportedWatts.length - 1;
|
|
158
78
|
}
|
|
159
|
-
// 8.13.6.2.5. StartAfterSetting Field. Default to false.
|
|
160
79
|
if (request.startAfterSetting === true) {
|
|
161
80
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: setCookingParameters called setting startAfterSetting = true`);
|
|
162
81
|
this.endpoint.setStateOf(MatterbridgeOperationalStateServer, { operationalState: OperationalState.OperationalStateEnum.Running });
|
|
163
82
|
}
|
|
164
83
|
}
|
|
165
|
-
// 8.13.6.3. AddMoreTime Command
|
|
166
84
|
addMoreTime(request) {
|
|
167
85
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
168
86
|
device.log.info(`MatterbridgeMicrowaveOvenControlServer: addMoreTime (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
@@ -176,4 +94,3 @@ export class MatterbridgeMicrowaveOvenControlServer extends MicrowaveOvenControl
|
|
|
176
94
|
}
|
|
177
95
|
}
|
|
178
96
|
}
|
|
179
|
-
//# sourceMappingURL=microwaveOven.js.map
|