Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: remove groups from hass #23492

Merged
merged 10 commits into from
Aug 4, 2024

Conversation

LaurentvdBos
Copy link
Contributor

Removing a group from zigbee2mqtt does not remove it from Home Assistant. This PR adds a separate event for this purpose and extends the Home Assistant plugin to inform Home Assistant about the removal.

I think that in an ideal world, one would have added a new onEntityRemoved event, which gets fired when either a device or a group gets removed, since now there is some code duplication between device and group removal. I did not want to do this, since that is an interface change of the package.

@Koenkk
Copy link
Owner

Koenkk commented Aug 3, 2024

I think that in an ideal world, one would have added a new onEntityRemoved event, which gets fired when either a device or a group gets removed, since now there is some code duplication between device and group removal. I did not want to do this, since that is an interface change of the package.

That's exactly what I was thinking before I saw this. Besides homeassistant, only the availability extension uses onDeviceRemoved so it shouldn't be difficult to change. I guess we should update the type as follows:

type EntityRemoved = {id: string | number; name: string, type: 'group' | 'device'};

@LaurentvdBos
Copy link
Contributor Author

Excellent that that is possible. Here is the revised version. This ...

type EntityRemoved = {id: string | number; name: string, type: 'group' | 'device'};

... is now there, see typed.d.ts.

Maybe good that, if you accept this PR, to mention somewhere in the changelog that this interface change happened? The event got renamed, so fortunately there is no behavior change of existing events (which would result in very subtle breakage...).

@Koenkk Koenkk merged commit d0f5733 into Koenkk:master Aug 4, 2024
11 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Aug 4, 2024

Maybe good that, if you accept this PR, to mention somewhere in the changelog that this interface change happened?

This is mostly an internal interface (can be used by external extensions), I will mention it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants