Skip to content

Commit

Permalink
Update 08.02.2015 (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 authored Feb 8, 2025
1 parent 3b65e79 commit e4985d0
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 84 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ With the ioBroker Matter Adapter, it is possible to map the following use cases:
-->

## Changelog

### __WORK IN PROGRESS__
* (@Apollon77) Improved stability and connection reliability (matter.js updated)
* (@Apollon77) Sort enum entries to improve detection quality when adding new devices

### 0.4.13 (2025-02-01)
* (@Apollon77) Added support for Door state feature for Devices and Controllers
* (@Apollon77) Fixed Thermostat creation with Boost state
Expand Down
118 changes: 59 additions & 59 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
"url": "https://github.com/ioBroker/ioBroker.matter"
},
"optionalDependencies": {
"@matter/nodejs-ble": "0.12.2-alpha.0-20250201-eb5d40a2f"
"@matter/nodejs-ble": "0.12.3"
},
"dependencies": {
"@iobroker/adapter-core": "^3.2.3",
"@iobroker/dm-utils": "^1.0.9",
"@iobroker/i18n": "^0.3.1",
"@iobroker/type-detector": "^4.2.0",
"@matter/main": "0.12.2-alpha.0-20250201-eb5d40a2f",
"@matter/nodejs": "0.12.2-alpha.0-20250201-eb5d40a2f",
"@project-chip/matter.js": "0.12.2-alpha.0-20250201-eb5d40a2f",
"@matter/main": "0.12.3",
"@matter/nodejs": "0.12.3",
"@project-chip/matter.js": "0.12.3",
"axios": "^1.7.9",
"jsonwebtoken": "^9.0.2"
},
Expand Down
4 changes: 2 additions & 2 deletions src-admin/package-lock.json

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

41 changes: 22 additions & 19 deletions src-admin/src/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,46 +118,49 @@ export async function detectDevices(
list?: string[],
): Promise<DetectedRoom[]> {
const devicesObject = await allObjects(socket);
const keys: string[] = Object.keys(devicesObject).sort();
const keys = Object.keys(devicesObject).sort();
const detector = new ChannelDetector();

const usedIds: string[] = [];
const ignoreIndicators = ['UNREACH_STICKY']; // Ignore indicators by name
const excludedTypes: Types[] = [Types.info];
const enums: string[] = [];
const rooms: string[] = [];
let _list: string[] = [];

if (!list) {
keys.forEach(id => {
list = [];
for (const id of keys) {
if (devicesObject[id]?.type === 'enum') {
enums.push(id);
} else if (devicesObject[id]?.common?.smartName) {
_list.push(id);
list.push(id);
}
});
}

enums.forEach(id => {
for (const id of enums) {
if (id.startsWith('enum.rooms.')) {
rooms.push(id);
}
const members: string[] = devicesObject[id].common.members;

if (members?.length) {
members.forEach(member => {
for (const member of members) {
// if an object really exists
if (devicesObject[member]) {
if (!_list.includes(member)) {
_list.push(member);
if (!list.includes(member)) {
list.push(member);
}
}
});
}
}
});
} else {
_list = list;
}
}

// We have a list ob IDs with "point" separated IDs that build up a tree
// We sort them in a way that IDs are sorted by levels - so IDs with less points are first
// This way we can start detecting from the bottom of the tree
list = list.sort((a, b) => a.split('.').length - b.split('.').length);

const detectOnSingleObject = list?.length === 1;
const options: DetectOptions = {
id: '',
Expand All @@ -174,21 +177,21 @@ export async function detectDevices(

const result: DetectedRoom[] = [];

_list.forEach(id => {
for (const id of list) {
options.id = id;

const controls = detector.detect(options);

if (controls) {
controls.forEach(control => {
for (const control of controls) {
const stateIdObj = control?.states?.find(state => state.id);
if (!stateIdObj) {
return;
continue;
}
const stateId = stateIdObj.id;
// if not yet added
if (!detectOnSingleObject && result.find(item => item.devices.find(st => st._id === stateId))) {
return;
continue;
}
const deviceObject: DetectedDevice = {
_id: stateId,
Expand Down Expand Up @@ -261,9 +264,9 @@ export async function detectDevices(
}
deviceObject.roomName = roomObj.common.name;
roomObj.devices.push(deviceObject);
});
}
}
});
}

// find names and icons for devices
result.forEach(room => {
Expand Down

0 comments on commit e4985d0

Please sign in to comment.