@matter/create
Advanced tools
Comparing version 0.11.3-alpha.0-20241105-ecad0373d to 0.11.3-alpha.0-20241106-39bacbc00
@@ -20,3 +20,3 @@ #!/usr/bin/env node | ||
import { CommissioningController, NodeCommissioningOptions } from "@project-chip/matter.js"; | ||
import { NodeStateInformation } from "@project-chip/matter.js/device"; | ||
import { NodeStates } from "@project-chip/matter.js/device"; | ||
@@ -185,47 +185,48 @@ const logger = Logger.get("Controller"); | ||
const node = await commissioningController.connectNode(nodeId, { | ||
attributeChangedCallback: ( | ||
peerNodeId, | ||
{ path: { nodeId, clusterId, endpointId, attributeName }, value }, | ||
) => | ||
console.log( | ||
`attributeChangedCallback ${peerNodeId}: Attribute ${nodeId}/${endpointId}/${clusterId}/${attributeName} changed to ${Logger.toJSON( | ||
value, | ||
)}`, | ||
), | ||
eventTriggeredCallback: (peerNodeId, { path: { nodeId, clusterId, endpointId, eventName }, events }) => | ||
console.log( | ||
`eventTriggeredCallback ${peerNodeId}: Event ${nodeId}/${endpointId}/${clusterId}/${eventName} triggered with ${Logger.toJSON( | ||
events, | ||
)}`, | ||
), | ||
stateInformationCallback: (peerNodeId, info) => { | ||
switch (info) { | ||
case NodeStateInformation.Connected: | ||
console.log(`stateInformationCallback ${peerNodeId}: Node ${nodeId} connected`); | ||
break; | ||
case NodeStateInformation.Disconnected: | ||
console.log(`stateInformationCallback ${peerNodeId}: Node ${nodeId} disconnected`); | ||
break; | ||
case NodeStateInformation.Reconnecting: | ||
console.log(`stateInformationCallback ${peerNodeId}: Node ${nodeId} reconnecting`); | ||
break; | ||
case NodeStateInformation.WaitingForDeviceDiscovery: | ||
console.log( | ||
`stateInformationCallback ${peerNodeId}: Node ${nodeId} waiting for device discovery`, | ||
); | ||
break; | ||
case NodeStateInformation.StructureChanged: | ||
console.log(`stateInformationCallback ${peerNodeId}: Node ${nodeId} structure changed`); | ||
break; | ||
case NodeStateInformation.Decommissioned: | ||
console.log(`stateInformationCallback ${peerNodeId}: Node ${nodeId} decommissioned`); | ||
break; | ||
} | ||
}, | ||
// Trigger node connection. Returns once process started, events are there to wait for completion | ||
// By default will subscript to all attributes and events | ||
const node = await commissioningController.connectNode(nodeId); | ||
// React on generic events | ||
node.events.attributeChanged.on(({ path: { nodeId, clusterId, endpointId, attributeName }, value }) => | ||
console.log( | ||
`attributeChangedCallback ${nodeId}: Attribute ${endpointId}/${clusterId}/${attributeName} changed to ${Logger.toJSON( | ||
value, | ||
)}`, | ||
), | ||
); | ||
node.events.eventTriggered.on(({ path: { nodeId, clusterId, endpointId, eventName }, events }) => | ||
console.log( | ||
`eventTriggeredCallback ${nodeId}: Event ${endpointId}/${clusterId}/${eventName} triggered with ${Logger.toJSON( | ||
events, | ||
)}`, | ||
), | ||
); | ||
node.events.stateChanged.on(info => { | ||
switch (info) { | ||
case NodeStates.Connected: | ||
console.log(`state changed: Node ${nodeId} connected`); | ||
break; | ||
case NodeStates.Disconnected: | ||
console.log(`state changed: Node ${nodeId} disconnected`); | ||
break; | ||
case NodeStates.Reconnecting: | ||
console.log(`state changed: Node ${nodeId} reconnecting`); | ||
break; | ||
case NodeStates.WaitingForDeviceDiscovery: | ||
console.log(`state changed: Node ${nodeId} waiting for device discovery`); | ||
break; | ||
} | ||
}); | ||
node.events.structureChanged.on(() => { | ||
console.log(`Node ${nodeId} structure changed`); | ||
}); | ||
// Important: This is a temporary API to proof the methods working and this will change soon and is NOT stable! | ||
// It is provided to proof the concept | ||
// Now wait till the structure of the node gor initialized (potentially with persisted data) | ||
await node.events.initialized; | ||
// Or use this to wait for full remote initialization and reconnection. | ||
// Will only return when node is connected! | ||
// await node.events.initializedFromRemote; | ||
node.logStructure(); | ||
@@ -232,0 +233,0 @@ |
@@ -8,5 +8,5 @@ { | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d", | ||
"@matter/nodejs-ble": "~0.11.3-alpha.0-20241105-ecad0373d", | ||
"@project-chip/matter.js": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00", | ||
"@matter/nodejs-ble": "~0.11.3-alpha.0-20241106-39bacbc00", | ||
"@project-chip/matter.js": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -19,3 +19,3 @@ "description": "Controller example to commission and connect devices", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -28,3 +28,3 @@ "description": "Bridge for multiple OnOff light/sockets with a CLI command execution interface", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -37,3 +37,3 @@ "description": "Composed device for multiple OnOff light/sockets with a CLI command execution interface", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -46,3 +46,3 @@ "description": "Composed device with Window covering and a light endpoint that logs changes", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -55,3 +55,3 @@ "description": "Socket device that reports random Energy and Power measurements", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -64,3 +64,3 @@ "description": "Multiple OnOff light/socket nodes in one process with a CLI command execution interface", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -73,5 +73,5 @@ "description": "OnOff light/socket device with a CLI command execution interface", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d", | ||
"@matter/nodejs": "~0.11.3-alpha.0-20241105-ecad0373d", | ||
"@matter/nodejs-ble": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00", | ||
"@matter/nodejs": "~0.11.3-alpha.0-20241106-39bacbc00", | ||
"@matter/nodejs-ble": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -84,3 +84,3 @@ "description": "OnOff light/socket device with BLE support and advanced API usage", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -93,3 +93,3 @@ "description": "OnOff light example which logs the state changes to the console", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -102,3 +102,3 @@ "description": "Temperature/Humidity sensor with a CLI command interface to get the value", | ||
"dependencies": { | ||
"@matter/main": "~0.11.3-alpha.0-20241105-ecad0373d" | ||
"@matter/main": "~0.11.3-alpha.0-20241106-39bacbc00" | ||
}, | ||
@@ -105,0 +105,0 @@ "description": "A simple on/off device", |
{ | ||
"name": "@matter/create", | ||
"version": "0.11.3-alpha.0-20241105-ecad0373d", | ||
"version": "0.11.3-alpha.0-20241106-39bacbc00", | ||
"description": "Matter.js skeleton project generator", | ||
@@ -35,3 +35,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@matter/tools": "0.11.3-alpha.0-20241105-ecad0373d", | ||
"@matter/tools": "0.11.3-alpha.0-20241106-39bacbc00", | ||
"@types/node": "^22.8.7", | ||
@@ -38,0 +38,0 @@ "@types/tar-stream": "^3.1.3" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174200
3518