Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions server/lib/device/device.newStateEvent.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { NotFoundError } = require('../../utils/coreErrors');
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../utils/constants');
const logger = require('../../utils/logger');

Expand All @@ -15,11 +14,15 @@ const logger = require('../../utils/logger');
async function newStateEvent(event) {
const deviceFeature = this.stateManager.get('deviceFeatureByExternalId', event.device_feature_external_id);
if (deviceFeature === null) {
throw new NotFoundError(`DeviceFeature ${event.device_feature_external_id} not found`);
logger.info(
`DeviceFeature "${event.device_feature_external_id}" not found (or not added to Gladys), skipping state update.`,
);
return;
}
const device = this.stateManager.get('deviceById', deviceFeature.device_id);
if (device === null) {
throw new NotFoundError(`Device ${deviceFeature.device_id} not found`);
logger.info(`Device "${deviceFeature.device_id}" not found, skipping state update.`);
return;
}
try {
// If there is a "text" property in the even, we save as string
Expand Down
204 changes: 102 additions & 102 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
]
},
"devDependencies": {
"@matter/main": "^0.13.0",
"@matter/main": "^0.16.10",
"apidoc": "^1.0.3",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
Expand Down
10 changes: 6 additions & 4 deletions server/services/matter/lib/matter.getNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const convertDevice = (device) => {
const clusterClients = [];

// Each cluster client is a feature of the device
device.clusterClients.forEach((clusterClient, clusterIndex) => {
const allClusterClients = device.getAllClusterClients();
allClusterClients.forEach((clusterClient) => {
clusterClients.push({
id: clusterClient.id.toString(),
name: clusterClient.name,
Expand All @@ -16,7 +17,8 @@ const convertDevice = (device) => {
});

// Convert child endpoints (child devices)
const childEndpoints = device.childEndpoints.map((childDeviceEndpoint) => {
const childEndpointsList = device.getChildEndpoints();
const childEndpoints = childEndpointsList.map((childDeviceEndpoint) => {
return convertDevice(childDeviceEndpoint);
});

Expand All @@ -37,8 +39,8 @@ const convertDevice = (device) => {
async function getNodes() {
const nodeDetails = this.commissioningController.getCommissionedNodesDetails();
const filteredNodeDetails = nodeDetails.filter((nodeDetail) => {
if (!nodeDetail.deviceData) {
logger.warn(`Matter: Node ${nodeDetail.nodeId} has no device data`);
if (!nodeDetail.deviceData || !nodeDetail.deviceData.basicInformation) {
logger.warn(`Matter: Node ${nodeDetail.nodeId} has no device data or basic information`);
return false;
}
return true;
Expand Down
Loading
Loading