matterbridge-example-dynamic-platform 1.2.0-edge.8 → 1.2.0-edge.9
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 +2 -2
- package/dist/robot.js +42 -15
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -8,12 +8,12 @@ If you like this project and find it useful, please consider giving it a star on
|
|
8
8
|
<img src="bmc-button.svg" alt="Buy me a coffee" width="120">
|
9
9
|
</a>
|
10
10
|
|
11
|
-
## [1.2.0] - 2025-04
|
11
|
+
## [1.2.0] - 2025-04-??
|
12
12
|
|
13
13
|
### Added
|
14
14
|
|
15
15
|
- [platform]: Added Robot Vacuum Cleaner device (supported by SmartThings, Alexa, Home Assistant and Apple Home).
|
16
|
-
- [platform]: Added Laundry Washer
|
16
|
+
- [platform]: Added Laundry Washer device (supported by SmartThings, Alexa and Home Assistant).
|
17
17
|
- [platform]: Added Dishwasher device (supported by SmartThings, Alexa and Home Assistant).
|
18
18
|
- [platform]: Added Temperature Controlled Cabinet Cooler device (supported by SmartThings, Alexa and Home Assistant).
|
19
19
|
- [platform]: Added Temperature Controlled Cabinet Heater device (supported by SmartThings, Alexa and Home Assistant).
|
package/dist/robot.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { Matterbridge, MatterbridgeServer, MatterbridgeEndpoint, roboticVacuumCleaner } from 'matterbridge';
|
2
|
-
import { LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, EndpointServer, logEndpoint, DeviceTypeId, VendorId } from 'matterbridge/matter';
|
1
|
+
import { Matterbridge, MatterbridgeServer, MatterbridgeEndpoint, roboticVacuumCleaner, bridge, EndpointNumber, onOffOutlet } from 'matterbridge';
|
2
|
+
import { LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, EndpointServer, logEndpoint, DeviceTypeId, VendorId, } from 'matterbridge/matter';
|
3
3
|
import { Status } from 'matterbridge/matter/types';
|
4
|
-
import { OperationalState, PowerSource, RvcRunMode, RvcCleanMode, RvcOperationalState, ServiceArea } from 'matterbridge/matter/clusters';
|
5
|
-
import { RvcCleanModeBehavior, RvcOperationalStateBehavior, RvcRunModeBehavior, ServiceAreaBehavior } from 'matterbridge/matter/behaviors';
|
4
|
+
import { OperationalState, PowerSource, RvcRunMode, RvcCleanMode, RvcOperationalState, ServiceArea, Actions } from 'matterbridge/matter/clusters';
|
5
|
+
import { ActionsServer, RvcCleanModeBehavior, RvcOperationalStateBehavior, RvcRunModeBehavior, ServiceAreaBehavior } from 'matterbridge/matter/behaviors';
|
6
6
|
import { AnsiLogger } from 'matterbridge/logger';
|
7
7
|
export class Robot extends MatterbridgeEndpoint {
|
8
8
|
constructor(name, serial) {
|
@@ -68,11 +68,11 @@ export class Robot extends MatterbridgeEndpoint {
|
|
68
68
|
});
|
69
69
|
return this;
|
70
70
|
}
|
71
|
-
createDefaultRvcOperationalStateClusterServer() {
|
71
|
+
createDefaultRvcOperationalStateClusterServer(phaseList = null, currentPhase = null, operationalStateList, operationalState, operationalError) {
|
72
72
|
this.behaviors.require(MatterbridgeRvcOperationalStateServer, {
|
73
|
-
phaseList
|
74
|
-
currentPhase
|
75
|
-
operationalStateList: [
|
73
|
+
phaseList,
|
74
|
+
currentPhase,
|
75
|
+
operationalStateList: operationalStateList ?? [
|
76
76
|
{ operationalStateId: RvcOperationalState.OperationalState.Stopped, operationalStateLabel: 'Stopped' },
|
77
77
|
{ operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
|
78
78
|
{ operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
|
@@ -81,8 +81,8 @@ export class Robot extends MatterbridgeEndpoint {
|
|
81
81
|
{ operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
|
82
82
|
{ operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
|
83
83
|
],
|
84
|
-
operationalState: RvcOperationalState.OperationalState.Docked,
|
85
|
-
operationalError: { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
|
84
|
+
operationalState: operationalState ?? RvcOperationalState.OperationalState.Docked,
|
85
|
+
operationalError: operationalError ?? { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
|
86
86
|
});
|
87
87
|
return this;
|
88
88
|
}
|
@@ -100,6 +100,8 @@ export class MatterbridgeServiceAreaServer extends ServiceAreaBehavior {
|
|
100
100
|
}
|
101
101
|
}
|
102
102
|
this.state.selectedAreas = newAreas;
|
103
|
+
this.state.currentArea = newAreas[0];
|
104
|
+
device.log.info(`***MatterbridgeServiceAreaServer selectAreas called with: ${newAreas.map((area) => area.toString()).join(', ')}`);
|
103
105
|
return { status: ServiceArea.SelectAreasStatus.Success, statusText: 'Succesfully selected new areas' };
|
104
106
|
}
|
105
107
|
}
|
@@ -186,6 +188,13 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateBe
|
|
186
188
|
};
|
187
189
|
}
|
188
190
|
}
|
191
|
+
function createEndpointActionsClusterServer(endpoint, endpointLists) {
|
192
|
+
endpoint.behaviors.require(ActionsServer, {
|
193
|
+
actionList: [],
|
194
|
+
endpointLists,
|
195
|
+
});
|
196
|
+
return endpoint;
|
197
|
+
}
|
189
198
|
if (process.argv.includes('-testRobot')) {
|
190
199
|
const matterbridge = await Matterbridge.loadInstance(false);
|
191
200
|
matterbridge.log = new AnsiLogger({ logName: 'Matterbridge', logTimestampFormat: 4, logLevel: "debug" });
|
@@ -196,12 +205,30 @@ if (process.argv.includes('-testRobot')) {
|
|
196
205
|
matterbridge.environment.vars.set('runtime.exitcode', true);
|
197
206
|
matterbridge.environment.vars.set('mdns.networkInterface', 'Wi-Fi');
|
198
207
|
await matterbridge.startMatterStorage();
|
199
|
-
const deviceType =
|
200
|
-
const context = await matterbridge.createServerNodeContext('
|
201
|
-
const server = await matterbridge.createServerNode(context);
|
208
|
+
const deviceType = bridge;
|
209
|
+
const context = await matterbridge.createServerNodeContext('Matterbridge', deviceType.name, DeviceTypeId(deviceType.code), VendorId(0xfff1), 'Matterbridge', 0x8000, 'Matterbridge device');
|
210
|
+
const server = (await matterbridge.createServerNode(context));
|
211
|
+
const aggregator = (await matterbridge.createAggregatorNode(context));
|
212
|
+
createEndpointActionsClusterServer(aggregator, [
|
213
|
+
{
|
214
|
+
endpointListId: 1,
|
215
|
+
name: 'Living room',
|
216
|
+
type: Actions.EndpointListType.Room,
|
217
|
+
endpoints: [EndpointNumber(2)],
|
218
|
+
},
|
219
|
+
]);
|
220
|
+
await server.add(aggregator);
|
221
|
+
const outlet = new MatterbridgeEndpoint(onOffOutlet, { uniqueStorageKey: 'Outlet' }, true)
|
222
|
+
.createDefaultIdentifyClusterServer()
|
223
|
+
.createDefaultBridgedDeviceBasicInformationClusterServer('Outlet', '99914248654', 0xfff1, 'Matterbridge', 'Matterbridge Outlet')
|
224
|
+
.createDefaultOnOffClusterServer()
|
225
|
+
.createDefaultGroupsClusterServer()
|
226
|
+
.createDefaultPowerSourceRechargeableBatteryClusterServer(80, PowerSource.BatChargeLevel.Ok, 5900)
|
227
|
+
.addRequiredClusterServers();
|
228
|
+
await aggregator.add(outlet);
|
202
229
|
const device = new Robot('Robot Vacuum', '99914248654');
|
203
|
-
await
|
204
|
-
logEndpoint(EndpointServer.forEndpoint(device));
|
230
|
+
await aggregator.add(device);
|
205
231
|
await matterbridge.startServerNode(server);
|
206
232
|
logEndpoint(EndpointServer.forEndpoint(server));
|
233
|
+
matterbridge.log.info(`Matterbridge server started. ServerNode id ${server.id}-${server.number}. Aggregator id ${aggregator.id}-${aggregator.number}. Device id ${device.id}-${device.number}.`);
|
207
234
|
}
|
package/npm-shrinkwrap.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "matterbridge-example-dynamic-platform",
|
3
|
-
"version": "1.2.0-edge.
|
3
|
+
"version": "1.2.0-edge.9",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "matterbridge-example-dynamic-platform",
|
9
|
-
"version": "1.2.0-edge.
|
9
|
+
"version": "1.2.0-edge.9",
|
10
10
|
"license": "MIT",
|
11
11
|
"dependencies": {
|
12
12
|
"node-ansi-logger": "3.0.1",
|