mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-04 01:40:53 +00:00
fix: Publish groups on device leave (#32676)
This commit is contained in:
@@ -141,6 +141,7 @@ export default class Bridge extends Extension {
|
||||
await this.mqtt.publish("bridge/event", stringify(payload));
|
||||
});
|
||||
this.eventBus.onDeviceLeave(this, async (data) => {
|
||||
await this.publishGroups();
|
||||
await this.publishDevices();
|
||||
await this.publishDefinitions();
|
||||
|
||||
|
||||
@@ -2806,7 +2806,7 @@ describe("Extension: Bridge", () => {
|
||||
mockMQTTPublishAsync.mockClear();
|
||||
await mockZHEvents.deviceLeave({ieeeAddr: devices.bulb.ieeeAddr});
|
||||
await flushPromises();
|
||||
expect(mockMQTTPublishAsync).toHaveBeenCalledTimes(3);
|
||||
expect(mockMQTTPublishAsync).toHaveBeenCalledTimes(4);
|
||||
expect(mockMQTTPublishAsync).toHaveBeenCalledWith(
|
||||
"zigbee2mqtt/bridge/event",
|
||||
stringify({type: "device_leave", data: {ieee_address: "0x000b57fffec6a5b2", friendly_name: "bulb"}}),
|
||||
@@ -2819,6 +2819,7 @@ describe("Extension: Bridge", () => {
|
||||
expect.any(String),
|
||||
{retain: true},
|
||||
);
|
||||
expect(mockMQTTPublishAsync).toHaveBeenCalledWith("zigbee2mqtt/bridge/groups", expect.any(String), {retain: true});
|
||||
});
|
||||
|
||||
it("Should allow permit join on all", async () => {
|
||||
|
||||
Reference in New Issue
Block a user