matterbridge 3.1.4-dev-20250717-d36e252 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +26 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +91 -2
- package/dist/cli.js.map +1 -0
- package/dist/cliEmitter.d.ts +34 -0
- package/dist/cliEmitter.d.ts.map +1 -0
- package/dist/cliEmitter.js +30 -0
- package/dist/cliEmitter.js.map +1 -0
- package/dist/clusters/export.d.ts +2 -0
- package/dist/clusters/export.d.ts.map +1 -0
- package/dist/clusters/export.js +2 -0
- package/dist/clusters/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +28 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +24 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +112 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +94 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/devices/batteryStorage.d.ts +48 -0
- package/dist/devices/batteryStorage.d.ts.map +1 -0
- package/dist/devices/batteryStorage.js +48 -1
- package/dist/devices/batteryStorage.js.map +1 -0
- package/dist/devices/evse.d.ts +75 -0
- package/dist/devices/evse.d.ts.map +1 -0
- package/dist/devices/evse.js +74 -10
- package/dist/devices/evse.js.map +1 -0
- package/dist/devices/export.d.ts +9 -0
- package/dist/devices/export.d.ts.map +1 -0
- package/dist/devices/export.js +2 -0
- package/dist/devices/export.js.map +1 -0
- package/dist/devices/heatPump.d.ts +47 -0
- package/dist/devices/heatPump.d.ts.map +1 -0
- package/dist/devices/heatPump.js +50 -2
- package/dist/devices/heatPump.js.map +1 -0
- package/dist/devices/laundryDryer.d.ts +87 -0
- package/dist/devices/laundryDryer.d.ts.map +1 -0
- package/dist/devices/laundryDryer.js +83 -6
- package/dist/devices/laundryDryer.js.map +1 -0
- package/dist/devices/laundryWasher.d.ts +242 -0
- package/dist/devices/laundryWasher.d.ts.map +1 -0
- package/dist/devices/laundryWasher.js +91 -7
- package/dist/devices/laundryWasher.js.map +1 -0
- package/dist/devices/roboticVacuumCleaner.d.ts +110 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +89 -6
- package/dist/devices/roboticVacuumCleaner.js.map +1 -0
- package/dist/devices/solarPower.d.ts +40 -0
- package/dist/devices/solarPower.d.ts.map +1 -0
- package/dist/devices/solarPower.js +38 -0
- package/dist/devices/solarPower.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +111 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +82 -2
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/frontend.d.ts +304 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +429 -21
- package/dist/frontend.js.map +1 -0
- package/dist/globalMatterbridge.d.ts +59 -0
- package/dist/globalMatterbridge.d.ts.map +1 -0
- package/dist/globalMatterbridge.js +47 -0
- package/dist/globalMatterbridge.js.map +1 -0
- package/dist/helpers.d.ts +48 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +53 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +3 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +3 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +444 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +785 -51
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +36 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +1340 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +61 -1
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +709 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +579 -15
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +36 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1250 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1106 -42
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +3198 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +322 -12
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +310 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +233 -0
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +195 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +25 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +291 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +269 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/shelly.d.ts +174 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +168 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +59 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +54 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +117 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +263 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +59 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +54 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +33 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +38 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createDirectory.d.ts +34 -0
- package/dist/utils/createDirectory.d.ts.map +1 -0
- package/dist/utils/createDirectory.js +33 -0
- package/dist/utils/createDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +39 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +47 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +32 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +39 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +54 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +72 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/export.d.ts +12 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +49 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +58 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +103 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +101 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/network.d.ts +74 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +81 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +11 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +18 -0
- package/dist/utils/spawn.js.map +1 -0
- package/dist/utils/wait.d.ts +56 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +62 -9
- package/dist/utils/wait.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
package/dist/deviceManager.js
CHANGED
|
@@ -1,26 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the DeviceManager class.
|
|
3
|
+
*
|
|
4
|
+
* @file devices.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2024-07-26
|
|
7
|
+
* @version 1.0.11
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
// AnsiLogger module
|
|
1
25
|
import { AnsiLogger, BLUE, er } from 'node-ansi-logger';
|
|
2
26
|
import { dev } from './matterbridgeTypes.js';
|
|
27
|
+
/**
|
|
28
|
+
* Manages Matterbridge devices.
|
|
29
|
+
*/
|
|
3
30
|
export class DeviceManager {
|
|
4
31
|
_devices = new Map();
|
|
5
32
|
matterbridge;
|
|
6
33
|
log;
|
|
34
|
+
/**
|
|
35
|
+
* Creates an instance of DeviceManager.
|
|
36
|
+
*
|
|
37
|
+
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
38
|
+
*/
|
|
7
39
|
constructor(matterbridge) {
|
|
8
40
|
this.matterbridge = matterbridge;
|
|
9
|
-
this.log = new AnsiLogger({ logName: 'DeviceManager', logTimestampFormat: 4
|
|
41
|
+
this.log = new AnsiLogger({ logName: 'DeviceManager', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: matterbridge.log.logLevel });
|
|
10
42
|
this.log.debug('Matterbridge device manager starting...');
|
|
11
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the number of devices.
|
|
46
|
+
*
|
|
47
|
+
* @returns {number} The number of devices.
|
|
48
|
+
*/
|
|
12
49
|
get length() {
|
|
13
50
|
return this._devices.size;
|
|
14
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the number of devices.
|
|
54
|
+
*
|
|
55
|
+
* @returns {number} The number of devices.
|
|
56
|
+
*/
|
|
15
57
|
get size() {
|
|
16
58
|
return this._devices.size;
|
|
17
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks if a device with the specified unique ID exists.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} uniqueId - The unique ID of the device.
|
|
64
|
+
* @returns {boolean} True if the device exists, false otherwise.
|
|
65
|
+
*/
|
|
18
66
|
has(uniqueId) {
|
|
19
67
|
return this._devices.has(uniqueId);
|
|
20
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets a device by its unique ID.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} uniqueId - The unique ID of the device.
|
|
73
|
+
* @returns {MatterbridgeEndpoint | undefined} The device, or undefined if not found.
|
|
74
|
+
*/
|
|
21
75
|
get(uniqueId) {
|
|
22
76
|
return this._devices.get(uniqueId);
|
|
23
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Adds a device to the manager.
|
|
80
|
+
*
|
|
81
|
+
* @param {MatterbridgeEndpoint} device - The device to add.
|
|
82
|
+
* @returns {MatterbridgeEndpoint} The added device.
|
|
83
|
+
* @throws {Error} If the device does not have a unique ID.
|
|
84
|
+
*/
|
|
24
85
|
set(device) {
|
|
25
86
|
if (!device.uniqueId)
|
|
26
87
|
throw new Error(`The device ${dev}${device.deviceName}${er} has not been initialized: uniqueId is required`);
|
|
@@ -29,6 +90,13 @@ export class DeviceManager {
|
|
|
29
90
|
this._devices.set(device.uniqueId, device);
|
|
30
91
|
return device;
|
|
31
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Removes a device from the manager.
|
|
95
|
+
*
|
|
96
|
+
* @param {MatterbridgeEndpoint} device - The device to remove.
|
|
97
|
+
* @returns {boolean} True if the device was removed, false otherwise.
|
|
98
|
+
* @throws {Error} If the device does not have a unique ID.
|
|
99
|
+
*/
|
|
32
100
|
remove(device) {
|
|
33
101
|
if (!device.uniqueId)
|
|
34
102
|
throw new Error(`The device ${dev}${device.deviceName}${er} has not been initialized: uniqueId is required`);
|
|
@@ -36,15 +104,34 @@ export class DeviceManager {
|
|
|
36
104
|
this.log.error(`The device ${dev}${device.deviceName}${er} with uniqueId ${BLUE}${device.uniqueId}${er} serialNumber ${BLUE}${device.serialNumber}${er} is not registered in the device manager`);
|
|
37
105
|
return this._devices.delete(device.uniqueId);
|
|
38
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Clears all devices from the manager.
|
|
109
|
+
*/
|
|
39
110
|
clear() {
|
|
40
111
|
this._devices.clear();
|
|
41
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets an array of all devices.
|
|
115
|
+
*
|
|
116
|
+
* @returns {MatterbridgeEndpoint[]} An array of all devices.
|
|
117
|
+
*/
|
|
42
118
|
array() {
|
|
43
119
|
return Array.from(this._devices.values());
|
|
44
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Iterates over all devices.
|
|
123
|
+
*
|
|
124
|
+
* @returns {IterableIterator<MatterbridgeEndpoint>} An iterator for the devices.
|
|
125
|
+
*/
|
|
45
126
|
[Symbol.iterator]() {
|
|
46
127
|
return this._devices.values();
|
|
47
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Asynchronously iterates over each device and calls the provided callback function.
|
|
131
|
+
*
|
|
132
|
+
* @param {(device: MatterbridgeEndpoint) => Promise<void>} callback - The callback function to call with each device.
|
|
133
|
+
* @returns {Promise<void>} A promise that resolves when all callbacks have been called.
|
|
134
|
+
*/
|
|
48
135
|
async forEach(callback) {
|
|
49
136
|
if (this.size === 0)
|
|
50
137
|
return;
|
|
@@ -58,7 +145,13 @@ export class DeviceManager {
|
|
|
58
145
|
});
|
|
59
146
|
await Promise.all(tasks);
|
|
60
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Sets the log level.
|
|
150
|
+
*
|
|
151
|
+
* @param {LogLevel} logLevel - The log level to set.
|
|
152
|
+
*/
|
|
61
153
|
set logLevel(logLevel) {
|
|
62
154
|
this.log.logLevel = logLevel;
|
|
63
155
|
}
|
|
64
156
|
}
|
|
157
|
+
//# sourceMappingURL=deviceManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceManager.js","sourceRoot":"","sources":["../src/deviceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAA6B,MAAM,kBAAkB,CAAC;AAKnF,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE7C;;GAEG;AACH,MAAM,OAAO,aAAa;IACP,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IACnD,YAAY,CAAe;IAC3B,GAAG,CAAa;IAEjC;;;;OAIG;IACH,YAAY,YAA0B;QACpC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,kBAAkB,qCAA6B,EAAE,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9I,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,QAAgB;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,QAAgB;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,C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Ludovic BOUÉ
|
|
6
|
+
* @created 2025-06-20
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
25
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
26
|
+
export declare class BatteryStorage extends MatterbridgeEndpoint {
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of the BatteryStorage class.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} name - The name of the BatteryStorage.
|
|
31
|
+
* @param {string} serial - The serial number of the BatteryStorage.
|
|
32
|
+
* @param {number} [batPercentRemaining] - The percentage of battery remaining, defaults to `100` if not provided.
|
|
33
|
+
* @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
34
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
35
|
+
* @param {number} current - The current value in milliamperes.
|
|
36
|
+
* @param {number} power - The power value in milliwatts.
|
|
37
|
+
* @param {number} energyImported - The total production value in mW/h.
|
|
38
|
+
* @param {number} energyExported - 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
|
+
* - A battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
44
|
+
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
45
|
+
*/
|
|
46
|
+
constructor(name: string, serial: string, batPercentRemaining?: number, batChargeLevel?: PowerSource.BatChargeLevel, voltage?: number | bigint | null, current?: number | bigint | null, power?: number | bigint | null, energyImported?: number | bigint | null, energyExported?: number | bigint | null, absMinPower?: number, absMaxPower?: number);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=batteryStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batteryStorage.d.ts","sourceRoot":"","sources":["../../src/devices/batteryStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,qBAAa,cAAe,SAAQ,oBAAoB;IACtD;;;;;;;;;;;;;;;;;;OAkBG;gBAED,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,mBAAmB,GAAE,MAAY,EACjC,cAAc,GAAE,WAAW,CAAC,cAA8C,EAC1E,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACpC,cAAc,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EAC7C,cAAc,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EAC7C,WAAW,GAAE,MAAU,EACvB,WAAW,GAAE,MAAU;CA0B1B"}
|
|
@@ -1,9 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the BatteryStorage class.
|
|
3
|
+
* @file src/devices/batteryStorage.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @contributor Ludovic BOUÉ
|
|
6
|
+
* @created 2025-06-20
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
// @matter
|
|
1
25
|
import { PowerSourceTag } from '@matter/main';
|
|
2
26
|
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
3
27
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
28
|
+
// Matterbridge
|
|
4
29
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
30
|
import { deviceEnergyManagement, electricalSensor, batteryStorage, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
6
31
|
export class BatteryStorage extends MatterbridgeEndpoint {
|
|
32
|
+
/**
|
|
33
|
+
* Creates an instance of the BatteryStorage class.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} name - The name of the BatteryStorage.
|
|
36
|
+
* @param {string} serial - The serial number of the BatteryStorage.
|
|
37
|
+
* @param {number} [batPercentRemaining] - The percentage of battery remaining, defaults to `100` if not provided.
|
|
38
|
+
* @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
39
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
40
|
+
* @param {number} current - The current value in milliamperes.
|
|
41
|
+
* @param {number} power - The power value in milliwatts.
|
|
42
|
+
* @param {number} energyImported - The total production value in mW/h.
|
|
43
|
+
* @param {number} energyExported - The total production value in mW/h.
|
|
44
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
45
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* - A battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
49
|
+
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
50
|
+
*/
|
|
7
51
|
constructor(name, serial, batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, voltage = null, current = null, power = null, energyImported = null, energyExported = null, absMinPower = 0, absMaxPower = 0) {
|
|
8
52
|
super([batteryStorage, electricalSensor, deviceEnergyManagement], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
9
53
|
this.createDefaultIdentifyClusterServer()
|
|
@@ -14,10 +58,12 @@ export class BatteryStorage extends MatterbridgeEndpoint {
|
|
|
14
58
|
.createDefaultDeviceEnergyManagementClusterServer(DeviceEnergyManagement.EsaType.BatteryStorage, true, DeviceEnergyManagement.EsaState.Online, absMinPower, absMaxPower)
|
|
15
59
|
.createDefaultDeviceEnergyManagementModeClusterServer()
|
|
16
60
|
.addRequiredClusterServers();
|
|
61
|
+
// Add separate PowerSource child devices cause in matter.js the PowerSource cluster is not supported with both features Wired and Battery.
|
|
62
|
+
// Probably this is also an error in the specification...
|
|
17
63
|
this.addChildDeviceType('BatteryPowerSource', powerSource, {
|
|
18
64
|
tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Battery.namespaceId, tag: PowerSourceTag.Battery.tag, label: null }],
|
|
19
65
|
})
|
|
20
|
-
.createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, 24_000)
|
|
66
|
+
.createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, 24_000) // Battery voltage in mV (24V).
|
|
21
67
|
.addRequiredClusterServers();
|
|
22
68
|
this.addChildDeviceType('GridPowerSource', powerSource, {
|
|
23
69
|
tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Grid.namespaceId, tag: PowerSourceTag.Grid.tag, label: null }],
|
|
@@ -26,3 +72,4 @@ export class BatteryStorage extends MatterbridgeEndpoint {
|
|
|
26
72
|
.addRequiredClusterServers();
|
|
27
73
|
}
|
|
28
74
|
}
|
|
75
|
+
//# sourceMappingURL=batteryStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batteryStorage.js","sourceRoot":"","sources":["../../src/devices/batteryStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,eAAe;AACf,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEtH,MAAM,OAAO,cAAe,SAAQ,oBAAoB;IACtD;;;;;;;;;;;;;;;;;;OAkBG;IACH,YACE,IAAY,EACZ,MAAc,EACd,sBAA8B,GAAG,EACjC,iBAA6C,WAAW,CAAC,cAAc,CAAC,EAAE,EAC1E,UAAkC,IAAI,EACtC,U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AO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACtH,CAAC;aACC,0CAA0C,EAAE;aAC5C,yBAAyB,EAAE,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the Evse class.
|
|
3
|
+
* @file src/devices/energy-evse.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @contributor Ludovic BOUÉ
|
|
6
|
+
* @created 2025-05-27
|
|
7
|
+
* @version 1.1.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
import { MaybePromise } from '@matter/main';
|
|
25
|
+
import { EnergyEvseServer } from '@matter/main/behaviors/energy-evse';
|
|
26
|
+
import { EnergyEvseModeServer } from '@matter/main/behaviors/energy-evse-mode';
|
|
27
|
+
import { EnergyEvse, EnergyEvseMode } from '@matter/main/clusters';
|
|
28
|
+
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
29
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
30
|
+
export declare class Evse extends MatterbridgeEndpoint {
|
|
31
|
+
/**
|
|
32
|
+
* Creates an instance of the EVSE class.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} name - The name of the EVSE.
|
|
35
|
+
* @param {string} serial - The serial number of the EVSE.
|
|
36
|
+
* @param {number} [currentMode] - The current mode of the EnergyEvseMode cluster. Defaults to mode 1 (EnergyEvseMode.ModeTag.Manual).
|
|
37
|
+
* @param {EnergyEvseMode.ModeOption[]} [supportedModes] - The supported modes for the EnergyEvseMode cluster. This is a fixed attribute that defaults to a predefined set of EnergyEvseMode cluster modes.
|
|
38
|
+
* @param {EnergyEvse.State} [state] - The current state of the EVSE. Defaults to NotPluggedIn.
|
|
39
|
+
* @param {EnergyEvse.SupplyState} [supplyState] - The supply state of the EVSE. Defaults to Disabled.
|
|
40
|
+
* @param {EnergyEvse.FaultState} [faultState] - The fault state of the EVSE. Defaults to NoError.
|
|
41
|
+
* @param {number} [voltage] - The voltage value in millivolts. Defaults to null if not provided.
|
|
42
|
+
* @param {number} [current] - The current value in milliamperes. Defaults to null if not provided.
|
|
43
|
+
* @param {number} [power] - The power value in milliwatts. Defaults to null if not provided.
|
|
44
|
+
* @param {number} [energy] - The total consumption value in mW/h. Defaults to null if not provided.
|
|
45
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
46
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
47
|
+
*/
|
|
48
|
+
constructor(name: string, serial: string, currentMode?: number, supportedModes?: EnergyEvseMode.ModeOption[], state?: EnergyEvse.State, supplyState?: EnergyEvse.SupplyState, faultState?: EnergyEvse.FaultState, voltage?: number | bigint | null, current?: number | bigint | null, power?: number | bigint | null, energy?: number | bigint | null, absMinPower?: number, absMaxPower?: number);
|
|
49
|
+
/**
|
|
50
|
+
* Creates a default EnergyEvseServer Cluster Server.
|
|
51
|
+
*
|
|
52
|
+
* @param {EnergyEvse.State} [state] - The initial state of the EnergyEvse cluster. Defaults to EnergyEvse.State.NotPluggedIn.
|
|
53
|
+
* @param {EnergyEvse.SupplyState} [supplyState] - The initial supply state of the EnergyEvse cluster. Defaults to EnergyEvse.SupplyState.ChargingEnabled.
|
|
54
|
+
* @param {EnergyEvse.FaultState} [faultState] - The initial fault state of the EnergyEvse cluster. Defaults to EnergyEvse.FaultState.NoError.
|
|
55
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
56
|
+
*/
|
|
57
|
+
createDefaultEnergyEvseClusterServer(state?: EnergyEvse.State, supplyState?: EnergyEvse.SupplyState, faultState?: EnergyEvse.FaultState): this;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a default EnergyEvseMode Cluster Server.
|
|
60
|
+
*
|
|
61
|
+
* @param {number} [currentMode] - The current mode of the EnergyEvseMode cluster. Defaults to mode 1 (EnergyEvseMode.ModeTag.Manual).
|
|
62
|
+
* @param {EnergyEvseMode.ModeOption[]} [supportedModes] - The supported modes for the EnergyEvseMode cluster. Defaults all EnergyEvseMode cluster modes.
|
|
63
|
+
*
|
|
64
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
65
|
+
*/
|
|
66
|
+
createDefaultEnergyEvseModeClusterServer(currentMode?: number, supportedModes?: EnergyEvseMode.ModeOption[]): this;
|
|
67
|
+
}
|
|
68
|
+
export declare class MatterbridgeEnergyEvseServer extends EnergyEvseServer {
|
|
69
|
+
disable(): MaybePromise;
|
|
70
|
+
enableCharging(request: EnergyEvse.EnableChargingRequest): MaybePromise;
|
|
71
|
+
}
|
|
72
|
+
export declare class MatterbridgeEnergyEvseModeServer extends EnergyEvseModeServer {
|
|
73
|
+
changeToMode(request: ModeBase.ChangeToModeRequest): MaybePromise<ModeBase.ChangeToModeResponse>;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=evse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,EAAE,GAAG,IAAI;CAYnH;AAED,qBAAa,4BAA6B,SAAQ,gBAAgB;IACvD,OAAO,IAAI,YAAY;IAavB,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,qBAAqB,GAAG,YAAY;CAgBjF;AAED,qBAAa,gCAAiC,SAAQ,oBAAoB;IAC/D,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,GAAG,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC;CAa1G"}
|
package/dist/devices/evse.js
CHANGED
|
@@ -1,12 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the Evse class.
|
|
3
|
+
* @file src/devices/energy-evse.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @contributor Ludovic BOUÉ
|
|
6
|
+
* @created 2025-05-27
|
|
7
|
+
* @version 1.1.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
1
24
|
import { EnergyEvseServer } from '@matter/main/behaviors/energy-evse';
|
|
2
25
|
import { EnergyEvseModeServer } from '@matter/main/behaviors/energy-evse-mode';
|
|
3
26
|
import { EnergyEvse, EnergyEvseMode } from '@matter/main/clusters';
|
|
4
27
|
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
5
28
|
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
29
|
+
// Matterbridge
|
|
6
30
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
7
31
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
8
32
|
import { deviceEnergyManagement, electricalSensor, evse, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
9
33
|
export class Evse extends MatterbridgeEndpoint {
|
|
34
|
+
/**
|
|
35
|
+
* Creates an instance of the EVSE class.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} name - The name of the EVSE.
|
|
38
|
+
* @param {string} serial - The serial number of the EVSE.
|
|
39
|
+
* @param {number} [currentMode] - The current mode of the EnergyEvseMode cluster. Defaults to mode 1 (EnergyEvseMode.ModeTag.Manual).
|
|
40
|
+
* @param {EnergyEvseMode.ModeOption[]} [supportedModes] - The supported modes for the EnergyEvseMode cluster. This is a fixed attribute that defaults to a predefined set of EnergyEvseMode cluster modes.
|
|
41
|
+
* @param {EnergyEvse.State} [state] - The current state of the EVSE. Defaults to NotPluggedIn.
|
|
42
|
+
* @param {EnergyEvse.SupplyState} [supplyState] - The supply state of the EVSE. Defaults to Disabled.
|
|
43
|
+
* @param {EnergyEvse.FaultState} [faultState] - The fault state of the EVSE. Defaults to NoError.
|
|
44
|
+
* @param {number} [voltage] - The voltage value in millivolts. Defaults to null if not provided.
|
|
45
|
+
* @param {number} [current] - The current value in milliamperes. Defaults to null if not provided.
|
|
46
|
+
* @param {number} [power] - The power value in milliwatts. Defaults to null if not provided.
|
|
47
|
+
* @param {number} [energy] - The total consumption value in mW/h. Defaults to null if not provided.
|
|
48
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
49
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
50
|
+
*/
|
|
10
51
|
constructor(name, serial, currentMode, supportedModes, state, supplyState, faultState, voltage = null, current = null, power = null, energy = null, absMinPower, absMaxPower) {
|
|
11
52
|
super([evse, powerSource, electricalSensor, deviceEnergyManagement], { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
|
|
12
53
|
this.createDefaultIdentifyClusterServer()
|
|
@@ -21,30 +62,47 @@ export class Evse extends MatterbridgeEndpoint {
|
|
|
21
62
|
.createDefaultEnergyEvseModeClusterServer(currentMode, supportedModes)
|
|
22
63
|
.addRequiredClusterServers();
|
|
23
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates a default EnergyEvseServer Cluster Server.
|
|
67
|
+
*
|
|
68
|
+
* @param {EnergyEvse.State} [state] - The initial state of the EnergyEvse cluster. Defaults to EnergyEvse.State.NotPluggedIn.
|
|
69
|
+
* @param {EnergyEvse.SupplyState} [supplyState] - The initial supply state of the EnergyEvse cluster. Defaults to EnergyEvse.SupplyState.ChargingEnabled.
|
|
70
|
+
* @param {EnergyEvse.FaultState} [faultState] - The initial fault state of the EnergyEvse cluster. Defaults to EnergyEvse.FaultState.NoError.
|
|
71
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
72
|
+
*/
|
|
24
73
|
createDefaultEnergyEvseClusterServer(state, supplyState, faultState) {
|
|
25
74
|
this.behaviors.require(MatterbridgeEnergyEvseServer, {
|
|
26
75
|
state: state !== undefined ? state : EnergyEvse.State.NotPluggedIn,
|
|
27
76
|
supplyState: supplyState !== undefined ? supplyState : EnergyEvse.SupplyState.ChargingEnabled,
|
|
28
77
|
faultState: faultState !== undefined ? faultState : EnergyEvse.FaultState.NoError,
|
|
29
|
-
chargingEnabledUntil: null,
|
|
30
|
-
circuitCapacity: 32_000,
|
|
31
|
-
minimumChargeCurrent: 6_000,
|
|
32
|
-
maximumChargeCurrent: 32_000,
|
|
33
|
-
userMaximumChargeCurrent: 32_000,
|
|
34
|
-
sessionId: null,
|
|
35
|
-
sessionDuration: null,
|
|
36
|
-
sessionEnergyCharged: null,
|
|
78
|
+
chargingEnabledUntil: null, // Persistent attribute. A null value indicates the EVSE is always enabled for charging.
|
|
79
|
+
circuitCapacity: 32_000, // Persistent attribute in mA. 32A in mA.
|
|
80
|
+
minimumChargeCurrent: 6_000, // Persistent attribute in mA. 6A in mA.
|
|
81
|
+
maximumChargeCurrent: 32_000, // Persistent attribute in mA. 32A in mA.
|
|
82
|
+
userMaximumChargeCurrent: 32_000, // Persistent attribute in mA. 32A in mA.
|
|
83
|
+
sessionId: null, // Persistent attribute
|
|
84
|
+
sessionDuration: null, // Persistent attribute
|
|
85
|
+
sessionEnergyCharged: null, // Persistent attribute
|
|
37
86
|
});
|
|
38
87
|
return this;
|
|
39
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Creates a default EnergyEvseMode Cluster Server.
|
|
91
|
+
*
|
|
92
|
+
* @param {number} [currentMode] - The current mode of the EnergyEvseMode cluster. Defaults to mode 1 (EnergyEvseMode.ModeTag.Manual).
|
|
93
|
+
* @param {EnergyEvseMode.ModeOption[]} [supportedModes] - The supported modes for the EnergyEvseMode cluster. Defaults all EnergyEvseMode cluster modes.
|
|
94
|
+
*
|
|
95
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
96
|
+
*/
|
|
40
97
|
createDefaultEnergyEvseModeClusterServer(currentMode, supportedModes) {
|
|
41
98
|
this.behaviors.require(MatterbridgeEnergyEvseModeServer, {
|
|
42
99
|
supportedModes: supportedModes ?? [
|
|
43
100
|
{ label: 'On demand', mode: 1, modeTags: [{ value: EnergyEvseMode.ModeTag.Manual }] },
|
|
44
101
|
{ label: 'Scheduled', mode: 2, modeTags: [{ value: EnergyEvseMode.ModeTag.TimeOfUse }] },
|
|
45
102
|
{ label: 'Solar charging', mode: 3, modeTags: [{ value: EnergyEvseMode.ModeTag.SolarCharging }] },
|
|
46
|
-
|
|
47
|
-
|
|
103
|
+
// { label: 'Home to vehicle and Vehicle to home', mode: 4, modeTags: [{ value: EnergyEvseMode.ModeTag.V2X }] }, // This mode is not valid in charging only EVSEs
|
|
104
|
+
], // FixedAttribute
|
|
105
|
+
currentMode: currentMode ?? 1, // Persistent attribute
|
|
48
106
|
});
|
|
49
107
|
return this;
|
|
50
108
|
}
|
|
@@ -60,6 +118,8 @@ export class MatterbridgeEnergyEvseServer extends EnergyEvseServer {
|
|
|
60
118
|
this.state.state = EnergyEvse.State.PluggedInDemand;
|
|
61
119
|
}
|
|
62
120
|
this.state.chargingEnabledUntil = 0;
|
|
121
|
+
// super.disable();
|
|
122
|
+
// disable is not implemented in matter.js
|
|
63
123
|
}
|
|
64
124
|
enableCharging(request) {
|
|
65
125
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -73,6 +133,9 @@ export class MatterbridgeEnergyEvseServer extends EnergyEvseServer {
|
|
|
73
133
|
this.state.chargingEnabledUntil = request.chargingEnabledUntil;
|
|
74
134
|
this.state.minimumChargeCurrent = request.minimumChargeCurrent;
|
|
75
135
|
this.state.maximumChargeCurrent = request.maximumChargeCurrent;
|
|
136
|
+
// The implementation should also stop the charging session at the required time and update the sessionId, sessionDuration, and sessionEnergyCharged attributes if needed.
|
|
137
|
+
// super.enableCharging();
|
|
138
|
+
// enableCharging is not implemented in matter.js
|
|
76
139
|
}
|
|
77
140
|
}
|
|
78
141
|
export class MatterbridgeEnergyEvseModeServer extends EnergyEvseModeServer {
|
|
@@ -90,3 +153,4 @@ export class MatterbridgeEnergyEvseModeServer extends EnergyEvseModeServer {
|
|
|
90
153
|
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Success' };
|
|
91
154
|
}
|
|
92
155
|
}
|
|
156
|
+
//# sourceMappingURL=evse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evse.js","sourceRoot":"","sources":["../../src/devices/evse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAE,gB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AE,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IAC9E,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './roboticVacuumCleaner.js';
|
|
2
|
+
export * from './laundryWasher.js';
|
|
3
|
+
export * from './laundryDryer.js';
|
|
4
|
+
export * from './waterHeater.js';
|
|
5
|
+
export * from './evse.js';
|
|
6
|
+
export * from './solarPower.js';
|
|
7
|
+
export * from './batteryStorage.js';
|
|
8
|
+
export * from './heatPump.js';
|
|
9
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/devices/export.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
|
package/dist/devices/export.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Single class device types
|
|
1
2
|
export * from './roboticVacuumCleaner.js';
|
|
2
3
|
export * from './laundryWasher.js';
|
|
3
4
|
export * from './laundryDryer.js';
|
|
@@ -6,3 +7,4 @@ export * from './evse.js';
|
|
|
6
7
|
export * from './solarPower.js';
|
|
7
8
|
export * from './batteryStorage.js';
|
|
8
9
|
export * from './heatPump.js';
|
|
10
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/devices/export.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
24
|
+
export declare class HeatPump extends MatterbridgeEndpoint {
|
|
25
|
+
/**
|
|
26
|
+
* Creates an instance of the HeatPump class.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} name - The name of the HeatPump.
|
|
29
|
+
* @param {string} serial - The serial number of the HeatPump.
|
|
30
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
31
|
+
* @param {number} current - The current value in milliamperes.
|
|
32
|
+
* @param {number} power - The power value in milliwatts.
|
|
33
|
+
* @param {number} energyImported - The total production value in mW/h.
|
|
34
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
35
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* - The HeatPump includes clusters for power source, electrical power measurement, electrical energy measurement, and device energy management.
|
|
39
|
+
* - It also includes child devices for flow temperature, return temperature, and a thermostat.
|
|
40
|
+
* - The flow and return temperature sensors are set to default values of 45.00°C and 35.00°C respectively.
|
|
41
|
+
* - The heating only thermostat is set up with a default temperature setpoint of 21.00°C.
|
|
42
|
+
* - The device energy management cluster is set to `esaType` as `SpaceHeating`, `esaCanGenerate` as `false`, and `esaState` as `Online`.
|
|
43
|
+
* - The absolute minimum and maximum power values can be set to indicate the range of power consumption for the heat pump.
|
|
44
|
+
*/
|
|
45
|
+
constructor(name: string, serial: string, voltage?: number | bigint | null, current?: number | bigint | null, power?: number | bigint | null, energyImported?: number | bigint | null, absMinPower?: number, absMaxPower?: number);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=heatPump.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatPump.d.ts","sourceRoot":"","sources":["../../src/devices/heatPump.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,qBAAa,QAAS,SAAQ,oBAAoB;IAChD;;;;;;;;;;;;;;;;;;;OAmBG;gBAED,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACpC,cAAc,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EAC7C,WAAW,GAAE,MAAU,EACvB,WAAW,GAAE,MAAU;CAyC1B"}
|