mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-20 02:21:20 +00:00
fix: Ignore cache when re-interviewing device (#23328)
* fix: Ignore cache when re-interviewing device * updates
This commit is contained in:
@@ -534,14 +534,16 @@ export default class Bridge extends Extension {
|
||||
logger.info(`Interviewing '${device.name}'`);
|
||||
|
||||
try {
|
||||
await device.zh.interview();
|
||||
await device.zh.interview(true);
|
||||
logger.info(`Successfully interviewed '${device.name}'`);
|
||||
} catch (error) {
|
||||
throw new Error(`interview of '${device.name}' (${device.ieeeAddr}) failed: ${error}`, {cause: error});
|
||||
}
|
||||
|
||||
// publish devices so that the front-end has up-to-date info.
|
||||
await this.publishDevices();
|
||||
// A re-interview can for example result in a different modelId, therefore reconsider the definition.
|
||||
await device.resolveDefinition(true);
|
||||
this.eventBus.emitDevicesChanged();
|
||||
this.eventBus.emitExposesChanged({device});
|
||||
|
||||
return utils.getResponse(message, {id: message.id}, null);
|
||||
}
|
||||
|
||||
+2
-2
@@ -42,8 +42,8 @@ export default class Device {
|
||||
}
|
||||
}
|
||||
|
||||
async resolveDefinition(): Promise<void> {
|
||||
if (!this.zh.interviewing && (!this.definition || this._definitionModelID !== this.zh.modelID)) {
|
||||
async resolveDefinition(ignoreCache = false): Promise<void> {
|
||||
if (!this.zh.interviewing && (!this.definition || this._definitionModelID !== this.zh.modelID || ignoreCache)) {
|
||||
this.definition = await zhc.findByDevice(this.zh, true);
|
||||
this._definitionModelID = this.zh.modelID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user