Skip to content

Commit a600eb6

Browse files
committed
Fix for #52
1 parent 70013db commit a600eb6

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.npmignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,12 @@ dist
136136
# Documentation files
137137

138138
DEVICES.md.orig.*
139-
DEVICES.md.toc.*
139+
DEVICES.md.toc.*
140+
141+
test/
142+
src/
143+
eslint.config.js
144+
jest.config.js
145+
tsconfig.json
146+
babel.config.js
147+
docs/

src/TasmotaService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class TasmotaService {
9999
if (this.accessory.context.device[this.uniq_id].avty_t) {
100100
this.availabilitySubscribe = { event: this.accessory.context.device[this.uniq_id].avty_t, callback: this.availabilityUpdate.bind(this) };
101101
this.platform.mqttHost.on(this.accessory.context.device[this.uniq_id].avty_t, this.availabilityUpdate.bind(this));
102-
this.availabilitySubscribe = this.platform.mqttHost.availabilitySubscribe(this.accessory.context.device[this.uniq_id].avty_t);
102+
this.platform.mqttHost.availabilitySubscribe(this.accessory.context.device[this.uniq_id].avty_t);
103103
} else {
104104
this.platform.log.warn('Warning: Availability not supported for: %s', this.accessory.context.device[this.uniq_id].name);
105105
}

src/tasmotaPlatform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,12 @@ export class tasmotaPlatform implements DynamicPlatformPlugin {
481481
// debug("Cleaned up listeners", mqttHost);
482482
// debug(this.services[uniq_id].statusSubscribe.event);
483483
if (this.services[uniq_id].statusSubscribe?.event) {
484-
existingAccessory.context.mqttHost.removeAllListeners(this.services[uniq_id].statusSubscribe?.event);
484+
this.mqttHost.removeAllListeners(this.services[uniq_id].statusSubscribe?.event);
485485
} else {
486486
this.log.error('statusSubscribe.event missing', this.services[uniq_id].service?.displayName);
487487
}
488488
if (this.services[uniq_id]?.availabilitySubscribe) {
489-
existingAccessory.context.mqttHost.removeAllListeners(this.services[uniq_id].availabilitySubscribe?.event);
489+
this.mqttHost.removeAllListeners(this.services[uniq_id].availabilitySubscribe?.event);
490490
} else {
491491
this.log.error('availabilitySubscribe missing', this.services[uniq_id].service?.displayName);
492492
}
@@ -495,7 +495,7 @@ export class tasmotaPlatform implements DynamicPlatformPlugin {
495495
// This error message is stupid......
496496
existingAccessory.removeService(this.services[uniq_id].service);
497497
delete this.services[uniq_id];
498-
debug('serviceCleanup - this.api.updatePlatformAccessories');
498+
debug('serviceCleanup - this.api.updatePlatformAccessories', uniq_id);
499499
this.api.updatePlatformAccessories([existingAccessory]);
500500
} else {
501501
debug('serviceCleanup - object');

0 commit comments

Comments
 (0)