Skip to content

Commit ca68bde

Browse files
authored
Merge pull request #59 from bewee/bewee/patch-2
Add option to exclude default things
2 parents eb67859 + 2fb1ebd commit ca68bde

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

manifest.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
"options": {
1818
"default": {
1919
"persistPropertyValues": false,
20-
"randomizePropertyValues": false
20+
"randomizePropertyValues": false,
21+
"excludeDefaultThings": false
2122
},
2223
"schema": {
2324
"type": "object",
2425
"required": [
2526
"persistPropertyValues",
26-
"randomizePropertyValues"
27+
"randomizePropertyValues",
28+
"excludeDefaultThings"
2729
],
2830
"properties": {
2931
"persistPropertyValues": {
@@ -34,6 +36,10 @@
3436
"description": "Whether or not to periodically generate new property values",
3537
"type": "boolean"
3638
},
39+
"excludeDefaultThings": {
40+
"description": "Whether or not to exclude the default virtual things",
41+
"type": "boolean"
42+
},
3743
"customThings": {
3844
"description": "Custom virtual things to create",
3945
"type": "array",

virtual-things-adapter.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,10 +1505,12 @@ class VirtualThingsAdapter extends Adapter {
15051505
}
15061506

15071507
addAllThings() {
1508-
for (let i = 0; i < VIRTUAL_THINGS.length; i++) {
1509-
const id = `virtual-things-${i}`;
1510-
if (!this.devices[id]) {
1511-
new VirtualThingsDevice(this, id, VIRTUAL_THINGS[i]);
1508+
if (!this.config.excludeDefaultThings) {
1509+
for (let i = 0; i < VIRTUAL_THINGS.length; i++) {
1510+
const id = `virtual-things-${i}`;
1511+
if (!this.devices[id]) {
1512+
new VirtualThingsDevice(this, id, VIRTUAL_THINGS[i]);
1513+
}
15121514
}
15131515
}
15141516

0 commit comments

Comments
 (0)