Skip to content

Commit c7b6f10

Browse files
committed
add feature filter
1 parent 466bbb9 commit c7b6f10

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

admin/index_m.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@
117117
</label>
118118
</div>
119119
</div>
120+
<div class="row">
121+
<div class="col s6 input-field">
122+
<input type="text" class="value" id="featureFilter" />
123+
<label for="featureFilter" class="translate"
124+
>Feature filter (comma-separated). Use * as wildcard. Example: heating.boiler.*,heating.burner.*
125+
</label>
126+
</div>
127+
</div>
120128
<div class="row">
121129
<div class="col s6 input-field">
122130
<input type="checkbox" class="value" id="allowVirtual" />

io-package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"eventInterval": 300,
145145
"gatewayIndex": 1,
146146
"devicelist": "",
147+
"featureFilter": "",
147148
"allowVirtual": false
148149
},
149150
"objects": [],

main.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,26 @@ class Viessmannapi extends utils.Adapter {
349349
if (data.length === 1) {
350350
data = data[0];
351351
}
352+
// Filter features by path pattern if featureFilter is configured
353+
if (this.config.featureFilter && Array.isArray(data)) {
354+
const patterns = this.config.featureFilter.replace(/\s/g, '').split(',').filter(p => p);
355+
if (patterns.length > 0) {
356+
const originalCount = data.length;
357+
data = data.filter(item => {
358+
const featurePath = item.feature || '';
359+
return patterns.some(pattern => {
360+
if (pattern.endsWith('*')) {
361+
// Wildcard: heating.* matches heating.boiler, heating.burner, etc.
362+
const prefix = pattern.slice(0, -1);
363+
return featurePath.startsWith(prefix);
364+
}
365+
// Exact match
366+
return featurePath === pattern;
367+
});
368+
});
369+
this.log.debug(`Feature filter: ${originalCount} -> ${data.length} features`);
370+
}
371+
}
352372
const extractPath = installation.id + '.' + device.id + '.' + element.path;
353373
const forceIndex = null;
354374

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
},
1818
"dependencies": {
1919
"@iobroker/adapter-core": "^3.3.2",
20-
"axios": "^1.13.2",
20+
"axios": "^1.13.5",
2121
"json-bigint": "^1.0.0",
22-
"qs": "^6.14.0",
22+
"qs": "^6.14.1",
2323
"retry-axios": "^2.6.0"
2424
},
2525
"devDependencies": {
@@ -30,8 +30,8 @@
3030
"@eslint/eslintrc": "^3.3.3",
3131
"@eslint/js": "^9.39.2",
3232
"@iobroker/testing": "^5.2.2",
33-
"@types/node": "^22.19.3",
34-
"axios": "^1.13.2",
33+
"@types/node": "^22.19.10",
34+
"axios": "^1.13.5",
3535
"eslint": "^9.39.2",
3636
"globals": "^16.5.0",
3737
"typescript": "^5.9.3"

0 commit comments

Comments
 (0)