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

Upgrade HomeWizard to platinum quality #82580

Merged
merged 2 commits into from
Jan 15, 2023
Merged

Conversation

DCSBL
Copy link
Contributor

@DCSBL DCSBL commented Nov 23, 2022

Proposed change

I think this integration checks all (or at least most) the boxes to mark it as platinum.

Quality index

Below the list of requirements, checked if I think the requirement is met (and/or with comments)

No score​

  • Satisfy all requirements for creating components and creating platforms.
  • Configurable via configuration.yaml -> Not allowed for new integrations

Silver 🥈​

  • Satisfying all No score level requirements.
  • Connection/configuration is handled via a component.
  • Set an appropriate SCAN_INTERVAL (if a polling integration)
  • Raise PlatformNotReady if unable to connect during platform setup (if appropriate)
  • Handles expiration of auth credentials. Refresh if possible or print correct error and fail setup. If based on a config entry, should trigger a new config entry flow to re-authorize. -> Will be added in Improve HomeWizard request issue reporting #82366
  • Handles internet unavailable. Log a warning once when unavailable, log once when reconnected.
  • Handles device/service unavailable. Log a warning once when unavailable, log once when reconnected.
  • Operations like service calls and entity methods (e.g. Set HVAC Mode) have proper exception handling. Raise ValueError on invalid user input and raise HomeAssistantError for other failures such as a problem communicating with a device. → As of Implement state error handling in HomeWizard #84991
  • Set available property to False if appropriate
  • Entities have unique ID (if available)

Gold 🥇​

  • Satisfying all Silver level requirements.
  • Configurable via config entries.
  • Don't allow configuring already configured device/service (example: no 2 entries for same hub)
  • Discoverable (if available)
  • Set unique ID in config flow (if available)
  • Raise ConfigEntryNotReady if unable to connect during entry setup (if appropriate)
  • Entities have device info (if available)
  • Tests
  • Full test coverage for the config flow
  • Above average test coverage for all integration modules
  • Tests for fetching data from the integration and controlling it
  • Has a code owner
  • Entities only subscribe to updates inside async_added_to_hass and unsubscribe inside async_will_remove_from_hass -> Not used
  • Entities have correct device classes where appropriate
  • Supports entities being disabled and leverages Entity.entity_registry_enabled_default to disable less popular entities
  • If the device/service API can remove entities, the integration should make sure to clean up the entity and device registry. -> API cannot remove entities
  • When communicating with a device or service, the integration implements the diagnostics platform which redacts sensitive information.

Platinum 🏆​

  • Satisfying all Gold level requirements.
  • Set appropriate PARALLEL_UPDATES constant -> Not quite sure about this one
  • Support config entry unloading (called when config entry is removed)
  • Integration + dependency are async
  • Uses aiohttp or httpx and allows passing in websession (if making HTTP requests)
  • Handles expired credentials (if appropriate) -> NA

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@Kane610
Copy link
Member

Kane610 commented Nov 23, 2022

As you're going from nothing to platinum I think it would be good to document what (and what Not) you're fulfilling on the quality scale

@DCSBL
Copy link
Contributor Author

DCSBL commented Nov 23, 2022

@Kane610 thanks for the suggestion, will work on that 👍

@DCSBL
Copy link
Contributor Author

DCSBL commented Nov 26, 2022

Main description has been updated with the list.

The line "From nothing to platinum".. is it more common that we take smaller steps? We can do that as well of course.

@Kane610
Copy link
Member

Kane610 commented Nov 26, 2022

Main description has been updated with the list.

The line "From nothing to platinum".. is it more common that we take smaller steps? We can do that as well of course.

There is no expected "going the line" procedure, but you should fulfil the different steps, so maybe expand what is needed for silver and put up a PR for that, etc.

@DCSBL DCSBL marked this pull request as ready for review December 16, 2022 16:00
@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Dec 20, 2022
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

For the silver level, this wasn't checked from the list:

Operations like service calls and entity methods (e.g. Set HVAC Mode) have proper exception handling. Raise ValueError on invalid user input and raise HomeAssistantError for other failures such as a problem communicating with a device. -> NA

Although it was set to be NA, that isn't correct. It does apply. Some example:

  • The button entity (identify) could throw a connection error / could fail. However, this is not handled (and should be throwing an HomeAssistantError.
  • The number entity, setting a value could fail in a similar way (and should also be throwing an HomeAssistantError in such cases, unless the value is unexpected, in that case a ValueError should be raised. Currently, these services have no error handling at all.
  • Turning a switch entity on/off imposes similar issues as the above two mentioned ones.

@frenck frenck removed the smash Indicator this PR is close to finish for merging or closing label Jan 2, 2023
@DCSBL
Copy link
Contributor Author

DCSBL commented Jan 2, 2023

Good catch, not considered. Should I change this in this PR or a separate to keep this one clean?

@frenck
Copy link
Member

frenck commented Jan 2, 2023

I would drop those in separate PR, and maybe mark this PR draft until it has been resolved.

@DCSBL DCSBL marked this pull request as draft January 2, 2023 13:51
@DCSBL
Copy link
Contributor Author

DCSBL commented Jan 2, 2023

Done! Let me know if you see any other potential issue

@frenck
Copy link
Member

frenck commented Jan 15, 2023

#84991 has been merged, I think we can move forward with this one now, right @DCSBL?

../Frenck

@DCSBL DCSBL marked this pull request as ready for review January 15, 2023 20:08
@DCSBL DCSBL requested a review from frenck January 15, 2023 20:09
@DCSBL
Copy link
Contributor Author

DCSBL commented Jan 15, 2023

Yeah, thanks for the reminder!

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks @DCSBL 👍

Congrats on the milestone! 🥇

../Frenck

@frenck frenck merged commit 8e52365 into home-assistant:dev Jan 15, 2023
@DCSBL
Copy link
Contributor Author

DCSBL commented Jan 15, 2023

Awesome! Thank you!

@DCSBL DCSBL deleted the patch-1 branch January 15, 2023 22:01
janiversen pushed a commit to janiversen/core that referenced this pull request Jan 16, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2023
@frenck frenck added the noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Jan 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
by-code-owner cla-signed code-quality dependency-bump integration: homewizard noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) Quality Scale: No score small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants