SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
740 stars 112 forks source link

[Bug] Remove unavailable/disabled entities #255

Closed SecKatie closed 1 year ago

SecKatie commented 2 years ago

Describe the bug

After the update to remove sensors that were hammering the Wyze servers there are a large number of unavailable entities that cannot be removed from Home Assistant.

To Reproduce Steps to reproduce the behavior:

  1. Upgrade from a version that supports motion sensors/contact sensors
  2. Open the "Integrations" page under "Configuration"
  3. Click on the "entities" hyperlink under the Wyze integration
  4. See that many unavailable entities are listed

Expected behavior

Entities that are no longer supported should be cleaned up on a reboot.

System configuration System: Docker HA Version: core-2021.9.7 WyzeApi Version: 2021.9.3

JoeSchubert commented 2 years ago

This bug may make more sense as "remove platforms that are not part of the integration".

I'd be a little upset if the integration removed something just because I disable it, or it goes offline for a bit.

SecKatie commented 2 years ago

Yeah the primary issue is we disabled the binary sensors but the entities are still there

JoeSchubert commented 2 years ago

I think it would make more sense then to do a "cleanup loop" during init to make sure why pre-existing entities belong to an included platform and just remove them if they don't.

JoeSchubert commented 2 years ago

I only listed the models that I currently own... we'll probably need to poll the userbase to ensure that we get all the models covered using something like this...

But what do you think about handling this bug something like this? https://github.com/yoinx/ha-wyzeapi/commits/bug_255-remove_unsupported_devices

Actually... I might have to loop through the entities as well and check against the device they're linked to and verify that it's supported.

SecKatie commented 2 years ago

@yoinx this was fixed in a previous release right?

JoeSchubert commented 2 years ago

@JoshuaMulliken it was in a testing set of features that I guess got merged I don't see it in master though.

But it introduced a bug as reported here https://github.com/JoshuaMulliken/ha-wyzeapi/issues/144#issuecomment-986412679

JoeSchubert commented 2 years ago

It was added into develop in this commit. https://github.com/JoshuaMulliken/ha-wyzeapi/commit/923707c37e38dc63ddb2b74bf194075e078cc47f

But I don't even see that function in master... So not sure how they're getting the issue in the current release.

SecKatie commented 2 years ago

Weird. Maybe they had installed the beta?

JoeSchubert commented 2 years ago

@JoshuaMulliken did we still want to try and pursue this, or just leave it to the end-user to delete/cleanup dead entities?

SecKatie commented 2 years ago

I am pretty sure that a fix for this is in prerelease. When that goes to stable (hopefully today) this should get closed

JoeSchubert commented 2 years ago

Oh? I thought the only thing related to removing anything there concerned properly removing updaters from the wyzeapy update manager.

SecKatie commented 2 years ago

@yoinx ahh you might be right...

JoeSchubert commented 1 year ago

@JoshuaMulliken I've been gone for awhile... Is this still an issue or can it be closed?

SecKatie commented 1 year ago

Yeah, I think we can close it!