GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add hass_compat to feature by rytilahti · Pull Request #879 · python-kasa/python-kasa

Conversation

@rytilahti

@rytilahti rytilahti commented Apr 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This adds hass_compat (name suggestions welcome!) that allows defining extra attributes to homeassistant's *entitydescriptions for better and cleaner UX. At the moment this is just converted to dict and passed directly to *entitydescriptions.

  • Disable some diagnostic features per default
  • Hide some sensor information (like historical consumption) from the dashboard, while still keeping them active

This is based on #872 which needs to be merged first.
Fixes #842

image
image
image
image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rytilahti added 4 commits April 26, 2024 16:55
@rytilahti
Improve temperature controls
d958a49
This improves the temperature control features to allow implementing climate platform support for homeassistant
Also adds frostprotection module, which is basically also used to turn the thermostat on and off.
@rytilahti
Improve tests
348d47d
@rytilahti
Add tests for modes that cause warnings
c2f8cbb
@rytilahti
Add hass_compat to feature
527dc8d
@rytilahti rytilahti added the enhancement New feature or request label Apr 28, 2024
This was referenced Apr 28, 2024
Dynamic entity creation for tplink home-assistant/core#111151
Closed
Implement choice feature type #880
Merged
@rytilahti rytilahti linked an issue Apr 28, 2024 that may be closed by this pull request
Allow exposing extra feature metadata #842
Closed
@rytilahti rytilahti mentioned this pull request Apr 29, 2024
[META] 0.7 series - module support for SMART devices, support for introspectable device features and refactoring the library #783
Closed
26 of 31 tasks
@sdb9696

sdb9696 commented Apr 30, 2024

Copy link
Copy Markdown
Contributor

It would be good to close out the open question here from @bdraco home-assistant/core#111151 (comment). It might be helpful to list some of the things/scenarios we're currently unable to derive in HA. For example I thought it was going to be sufficient to use the Feature.Category.Debug to drive entity_registry_enabled_default and I'm not sure why we need entity_registry_visible_default because they both hide the entities and I don't believe we have a need for entities that are enabled & hidden.

For the DeviceClass and StateClass it does seem to suggest a lot of HA development knowledge when creating a feature as to how these are all treated in HA. Maybe we could maintain a set of FeatureName to class mappings in the HA integration for those we want to set specifically and then derive a sensible default for those not specified.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rytilahti
rytilahti force-pushed the feat/tempcontrol_improvements branch from c2f8cbb to 6d12158 Compare May 2, 2024 13:03
Base automatically changed from feat/tempcontrol_improvements to master May 2, 2024 13:05
@rytilahti

rytilahti commented May 2, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I commented on that thread on this, but I agree that we should not proceed with this approach, but leave it to the homeassistant integration to do the mapping. Some of this can be done automatically, but for some we are going to need a mapping inside homeassistant. At least for those that require manual mapping, we are going to need to set the id manually to avoid breaking things if we one day decide to update the naming.

The difference between hiding & disabling is that the disabled entities won't be added to the state machine at all, but hidden ones are not added to the panes like the dashboard automatically. If you take a look at the screenshots in the description, you see that not all sensors (mainly the historical emeter ones) are not added, even when they are shown in the device page and recorded as expected.

On categorization, we could use the Debug to disable the entities, and moving the ones we want to be enabled to use Info, while mapping both Info and Debug to be entity_category=Diagnostics. Is that what you mean?

This would make us have the following categorization rules:
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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sdb9696

sdb9696 commented May 3, 2024

Copy link
Copy Markdown
Contributor

At least for those that require manual mapping, we are going to need to set the id manually to avoid breaking things if we one day decide to update the naming.

Or we set the id if/when we change the naming?

On categorization, we could use the Debug to disable the entities, and moving the ones we want to be enabled to use Info, while mapping both Info and Debug to be entity_category=Diagnostics. Is that what you mean?

Yes, I think this is simplest and we can always use overrides in HA if necessary.

This would make us have the following categorization rules: 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

Agreed. Then in HA we have a mapping of feature ids > (device_class, state_class) etc. The mappings can presumably live in each of the entity files as different entities have different description values.

rytilahti reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rytilahti

rytilahti commented May 6, 2024

Copy link
Copy Markdown
Member Author

Or we set the id if/when we change the naming?

I think we should do this from the get-go, as it will also allow us to use the the ids as translation keys.

Yes, I think this is simplest and we can always use overrides in HA if necessary.

Okay, I'll proceed to create a new PR that updates the categorization to follow this plan.

Agreed. Then in HA we have a mapping of feature ids > (device_class, state_class) etc. The mappings can presumably live in each of the entity files as different entities have different description values.

Makes sense to me, thanks for your input! 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rytilahti rytilahti mentioned this pull request May 7, 2024
Improve categorization of features #904
Merged
@rytilahti

rytilahti commented May 7, 2024

Copy link
Copy Markdown
Member Author

Replaced with #904.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rytilahti rytilahti closed this May 7, 2024
@rytilahti
rytilahti deleted the feat/homeassistant_extras branch May 7, 2024 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Allow exposing extra feature metadata

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rytilahti @sdb9696
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.