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

Improve categorization of features #904

Merged
merged 6 commits into from
May 7, 2024
Merged

Conversation

rytilahti
Copy link
Member

@rytilahti rytilahti commented May 7, 2024

This will update the categorization of features as discussed in the now-obsolete #879:

  • Primary: primary controls (state, brightness, etc.) & sensors (like temperature, emeter)
  • Config: secondary controls, entity_category=Config
  • Info: diagnostic information that is enabled per default in homeassistant
  • Debug: diagnostic information that is disabled per default

The id is also made mandatory for features, which will allow using it as a translation key without fear of breaking the "API" inadvertently.

@rytilahti rytilahti added the enhancement New feature or request label May 7, 2024
Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 90.39%. Comparing base (50b5107) to head (f8eb28f).

Files Patch % Lines
kasa/module.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #904      +/-   ##
==========================================
- Coverage   90.40%   90.39%   -0.01%     
==========================================
  Files          70       70              
  Lines        4941     4937       -4     
  Branches     1220     1219       -1     
==========================================
- Hits         4467     4463       -4     
  Misses        384      384              
  Partials       90       90              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@sdb9696 sdb9696 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, there's a lot of changes across files here so I think we should get this merged asap to avoid merge conflicts. Two questions we can address subsequently are:

  1. Should we make category a required parameter that must be explicitly set. It's being set on so many features now this shouldn't be too onerous.
  2. Should we have some mechanism for indicating the type of data in sensors, e.g. timestamps, so we can derive more sensor classes in HA. Maybe this could be added to unit as seconds etc.

@sdb9696 sdb9696 merged commit 55653d0 into master May 7, 2024
25 of 27 checks passed
@sdb9696 sdb9696 deleted the feat/improve_categories_add_id branch May 7, 2024 09:13
@rytilahti
Copy link
Member Author

Should we make category a required parameter that must be explicitly set. It's being set on so many features now this shouldn't be too onerous.

Yeah, we should probably require explicit setting for category and type, and remove the magic from __post_init__ altogether. Explicit > implicit.

Should we have some mechanism for indicating the type of data in sensors, e.g. timestamps, so we can derive more sensor classes in HA. Maybe this could be added to unit as seconds etc.

Worth considering, but it probably should probably be explicit and separate from the unit. As we are still going to need have some static mapping inside the HA integration, it's not that crucial to have this.

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

Successfully merging this pull request may close these issues.

None yet

2 participants