fix: Refresh exposes after manual device configure (#32486)

This commit is contained in:
Maximilian Rink
2026-07-05 08:50:33 +02:00
committed by GitHub
parent 4b0c3067ff
commit 344776b633
2 changed files with 21 additions and 9 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ export default class Configure extends Extension {
logger.info(`Successfully configured '${device.name}' (definition v${definitionVersion})`);
device.zh.meta.configured = definitionVersion;
device.zh.save();
this.eventBus.emitDevicesChanged();
this.eventBus.emitExposesAndDevicesChanged(device);
} catch (error) {
const newAttempts = attempts + 1;
this.attempts.set(device.ieeeAddr, newAttempts);
+20 -8
View File
@@ -193,16 +193,28 @@ describe("Extension: Configure", () => {
});
it("Should allow to configure via MQTT", async () => {
const emitDevicesChanged = vi.spyOn(controller.eventBus, "emitDevicesChanged");
const emitExposesChanged = vi.spyOn(controller.eventBus, "emitExposesChanged");
mockClear(devices.remote);
expectRemoteNotConfigured();
await mockMQTTEvents.message("zigbee2mqtt/bridge/request/device/configure", "remote");
await flushPromises();
expectRemoteConfigured();
expect(mockMQTTPublishAsync).toHaveBeenCalledWith(
"zigbee2mqtt/bridge/response/device/configure",
stringify({data: {id: "remote"}, status: "ok"}),
{},
);
try {
await mockMQTTEvents.message("zigbee2mqtt/bridge/request/device/configure", "remote");
await flushPromises();
expectRemoteConfigured();
expect(emitDevicesChanged).toHaveBeenCalledTimes(1);
expect(emitExposesChanged).toHaveBeenCalledWith({
device: controller.zigbee.resolveEntity(devices.remote),
});
expect(mockMQTTPublishAsync).toHaveBeenCalledWith(
"zigbee2mqtt/bridge/response/device/configure",
stringify({data: {id: "remote"}, status: "ok"}),
{},
);
} finally {
emitExposesChanged.mockRestore();
emitDevicesChanged.mockRestore();
}
});
it("Fail to configure via MQTT when device does not exist", async () => {