SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
746 stars 114 forks source link

Attribute Clean-Up #373

Closed brg468 closed 1 year ago

brg468 commented 2 years ago

Is your feature request related to a problem? Please describe.

As discussed here, there are several attributes that are returned that are potentially adding to the database unnecessarily. Looking to see if any of these are being used in automations, scripts, etc., and could potentially be removed. Some that I've found:

Feel free to add any others or comment. To be clear, these are items found under attributes of each entity on the frontend or developer tools. These should all be things that are available somewhere else or not routinely used but we would like some feedback before removal.

tggman commented 2 years ago

In general, I'm in favor of anything that reduces the size of, and how often data is written to, the database. I myself have used the MAC for debugging purposes but wouldn't mind taking the extra step of looking up the IP address in my router to get the MAC

SecKatie commented 2 years ago

Thanks for the feedback @tggman!

I will hold this task open for 2 weeks to collect additional feedback and then we can start implementing any required changes.

brg468 commented 2 years ago

One thing I noticed after re-reading the warning that was posted in the link above, is that the attributes are only written to the database when the entity state changes. That changes my thinking on this a bit.

I still think Battery Percentage should be either removed or broken out into its own sensor (is it already?), and the duplicated attributes should definitely be removed. But for things like lights, switches, siren, etc., these things (more than likely) aren't generating many state changes so the impact on the database should be minimal. Things like MAC are static so the impact should be minimal. The less attributes for each entity the better, but maybe not all entities are the same in that regard. The biggest culprit I would think would be things like motion or temperature sensors, but there aren't any of those supported right now (I don't think). Again just food for thought.

Bold added for emphasis *Entities that generate a significant amount of state changes can quickly increase the size of the database when the extra_state_attributes also change frequently. Minimize the number of extra_state_attributes for these entities by removing non-critical attributes or creating additional sensor entities.

JoeSchubert commented 2 years ago

As far as I can recall, anything with a battery has had the battery broken out into it's own entity. That occurred after I had added it to the device info, which only occurred because I couldn't figure out linking the entities for batteries when I started with this.

I 100% support removing those for the device info. However, I know at least one person wanted them to stay to make them easier to get from node red. But, honestly, there are likely other ways to get the info from the devices in node red.

JoeSchubert commented 1 year ago

Did we decide against implementing this? It looks like the battery% is still in the device info.

Or did it not generate much difference in the database?

brg468 commented 1 year ago

I don’t think it would have much of an impact on the database, but I also don’t have any devices with batteries. I still think removing the redundant attributes like state, available and model would be a good call.

tggman commented 1 year ago

Sorry guys if this is off topic?, but I didn't know where to put this question so this seemed like as good a place as any ...

@brg468 and @JoshuaMulliken I'm going all-IN with LIFX bulbs and all-OUT with pretty much everything Wyze. I noticed HACS has special / specific remove instructions. Are there any special remove instructions for the wyzeapy and/or ha-wyzeapi integrations?

And guys THANK YOU for all your efforts. It's been fun.

brg468 commented 1 year ago

I don’t think there’s anything special, just delete the integration then you can remove it from HACS as well.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

brg468 commented 1 year ago

Let me know if you think I should pursue this @SecKatie, I keep forgetting about it. I think we decided it’s not really necessary but at the same time why have all these redundant attributes…

SecKatie commented 1 year ago

Definitely up to you! I don't have a preference either way.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 5 days with no activity.