Skip to content

Commit 770bf47

Browse files
committed
Fix for #46
1 parent a600eb6 commit 770bf47

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,4 @@ DEVICES.md.toc.*
127127
/test/hbConfig/accessories
128128
/test/hbConfig/backups
129129
/test/hbConfig/persist
130+
test/hbConfig/config.json

config.schema.json

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"title": "Disconnected Device Cleanup Timing",
4040
"type": "number",
4141
"required": false,
42-
"placeholder": 24,
43-
"description": "Cleanup of devices no longer connected too or responding on the network. Time is in hours, defaults to 1 Day. Maximum value is 596 hours ( 24 days )."
42+
"default": 24,
43+
"description": "Cleanup of devices no longer connected too or responding on the network. Time is in hours, defaults to 1 Day. Maximum value is 596 hours ( 24 days ). IF set to 0, cleanup is disabled."
4444
},
4545
"debug": {
4646
"title": "Debug Logging",
@@ -147,14 +147,15 @@
147147
"type": "fieldset",
148148
"title": "Required Settings",
149149
"items": [
150-
"mqttHost"
150+
"mqttHost"
151151
]
152152
},
153153
{
154154
"type": "fieldset",
155155
"expandable": true,
156156
"title": "Optional Settings",
157-
"items": [{
157+
"items": [
158+
{
158159
"type": "flex",
159160
"flex-flow": "row wrap",
160161
"items": [
@@ -174,7 +175,8 @@
174175
"expandable": true,
175176
"title": "Device Discovery Filtering",
176177
"description": "Control which devices are discovered and included with Homebridge.",
177-
"items": [{
178+
"items": [
179+
{
178180
"key": "filterAllow",
179181
"type": "array",
180182
"required": false,
@@ -202,28 +204,30 @@
202204
"expandable": true,
203205
"title": "MQTT Discovery Message Injection",
204206
"description": "Ability to inject/over write portions of a MQTT Discovery message.",
205-
"items": [{
207+
"items": [
208+
{
206209
"key": "injections",
207210
"type": "array",
208-
209211
"items": [
210212
"injections[].topic",
211213
{
212214
"key": "injections[].injection",
213215
"type": "array",
214-
"items": [{
215-
"type": "flex",
216-
"flex-flow": "row wrap",
217-
"items": [
218-
"injections[].injection[].key",
219-
"injections[].injection[].value"
220-
]
221-
}]
216+
"items": [
217+
{
218+
"type": "flex",
219+
"flex-flow": "row wrap",
220+
"items": [
221+
"injections[].injection[].key",
222+
"injections[].injection[].value"
223+
]
224+
}
225+
]
222226
}
223227
]
224228
},
225229
"filter"
226230
]
227231
}
228232
]
229-
}
233+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"displayName": "Tasmota",
33
"name": "homebridge-tasmota",
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"type": "module",
66
"description": "Homebridge plugin for Tasmota devices leveraging home assistant auto discovery.",
77
"license": "Apache-2.0",

src/tasmotaPlatform.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class tasmotaPlatform implements DynamicPlatformPlugin {
9191
this.CustomCharacteristics = new EveHomeKitTypes(this.api).Characteristics;
9292

9393
this.log.debug('Finished initializing platform:', this.config.name);
94-
this.cleanup = this.config.cleanup || 24; // Default removal of defunct devices after 24 hours
94+
this.cleanup = (this.config.cleanup !== undefined ? this.config.cleanup : 24); // #46
9595
this.debug = this.config.debug || false;
9696
this.teleperiod = this.config.teleperiod || 300;
9797

@@ -178,7 +178,9 @@ export class tasmotaPlatform implements DynamicPlatformPlugin {
178178

179179
if (accessory.services.length > 1) {
180180
// debug('context', accessory.context);
181-
accessory.context.timeout = this.autoCleanup(accessory);
181+
if (this.cleanup > 0) {
182+
accessory.context.timeout = this.autoCleanup(accessory);
183+
}
182184

183185
// add the restored accessory to the accessories cache so we can track if it has already been registered
184186
this.accessories.push(accessory);

0 commit comments

Comments
 (0)