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

Record Plugwise Quality Scale #131888

Merged
merged 6 commits into from
Dec 2, 2024
Merged

Conversation

CoMPaTech
Copy link
Contributor

@CoMPaTech CoMPaTech commented Nov 29, 2024

Proposed change

Add initial quality indication as per new rules

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

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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format 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.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @bouwew, @frenck, mind taking a look at this pull request as it has been labeled with an integration (plugwise) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of plugwise can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign plugwise Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@CoMPaTech
Copy link
Contributor Author

Most dones have been completed for a long time, added the exempts accordingly to my best knowledge

@CoMPaTech CoMPaTech marked this pull request as ready for review November 29, 2024 10:04
@CoMPaTech CoMPaTech requested review from frenck and a team as code owners November 29, 2024 10:04
homeassistant/components/plugwise/quality_scale.yaml Outdated Show resolved Hide resolved
reconfiguration-flow:
status: exempt
comment: This integration does not have any reconfiguration steps
dynamic-devices: done
Copy link
Member

Choose a reason for hiding this comment

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

binary_sensor.py has this logic, but button.py not?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry what do you mean here?
Reboot vs Restart? Remove the _attr_translation_key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is the unload part, it's in all others but button

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't even spot that one. I think we had that discussion before. Ideally we use the device class name for consistency.

But what I meant here was, binary sensors are added on the fly, but button are not, why is that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I kept the code in button.py simple because there is only one button defined at the moment, and I don't foresee any more buttons being added in the future.

Also this button is connected to the gateway-device, it will never change.
When this device changes a new Plugwise integration must be added because the ID = pw changes.

Now that I write this, this could be a reason for adding reconfiguring!?

homeassistant/components/plugwise/quality_scale.yaml Outdated Show resolved Hide resolved
Comment on lines 47 to 49
reconfiguration-flow:
status: exempt
comment: This integration does not have any reconfiguration steps
Copy link
Member

Choose a reason for hiding this comment

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

And why would that make it exempt?

homeassistant/components/plugwise/quality_scale.yaml Outdated Show resolved Hide resolved
parallel-updates:
status: done
comment: Using coordinator
test-coverage: done
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to also have tests that check failing calls in the number tests

parallel-updates:
status: done
comment: Using coordinator
test-coverage: done
Copy link
Member

Choose a reason for hiding this comment

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

test_sensor.py line 161:

Instead of enabling entities on the fly

    entity_registry.async_update_entity(entity_id=entity_id, disabled_by=None)
    await hass.async_block_till_done()

    await hass.config_entries.async_reload(init_integration.entry_id)
    await hass.async_block_till_done()

use a fixture:

@pytest.mark.usefixtures("entity_registry_enabled_by_default")

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, thanks, there are also some other similar test-improvements on its way...

homeassistant/components/plugwise/quality_scale.yaml Outdated Show resolved Hide resolved
Comment on lines 29 to 31
parallel-updates:
status: done
comment: Using coordinator
Copy link
Member

Choose a reason for hiding this comment

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

But you have mutable platforms, and they also have a need for parallel-updates

@home-assistant
Copy link

home-assistant bot commented Dec 2, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft December 2, 2024 09:42
@CoMPaTech
Copy link
Contributor Author

Updated the quality scale as discussed for benchmark, with follow-up incrementals PRs 'done'-ing the todo's. As already shared in chat, thanks for you thorough review @joostlek, highly appreciated!

comment: Using coordinator, but required due to mutable platform
test-coverage:
status: todo
comment: Consider using snapshots + consistency in setup calls + add numerical tests + use fixtures
Copy link
Member

Choose a reason for hiding this comment

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

Note that the snapshots was an opinionated comment. Snapshots are a great way to fixate data structures and to see what fixture creates what and what the effect of changes on them are

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I interpreted it that way, hence noting as a consideration :)

@CoMPaTech CoMPaTech marked this pull request as ready for review December 2, 2024 12:50
common-modules:
status: todo
comment: Verify entity for async_added_to_hass usage (discard?)
docs-high-level-description: done
Copy link
Member

Choose a reason for hiding this comment

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

I must say, when I read the docs, I am missing what Plugwise is. I think we should make the docs more accessible for users who are looking to buy a new device for example. We never really explain what plugwise is or what a smile is for example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will create a new docs PR for this (already spotted it myself as well) - set to todo

status: todo
comment: Verify entity for async_added_to_hass usage (discard?)
docs-high-level-description: done
docs-installation-instructions: done
Copy link
Member

Choose a reason for hiding this comment

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

I am missing the default config flow setup snippet and I personally think the text is a bit too literal. I think there is room for improvement here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linked to PR-in-progress / set to todo

comment: Verify entity for async_added_to_hass usage (discard?)
docs-high-level-description: done
docs-installation-instructions: done
docs-removal-instructions: done
Copy link
Member

Choose a reason for hiding this comment

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

I'm missing this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linked to PR-in-progress / set to todo

comment: Consider using snapshots + consistency in setup calls + add numerical tests + use fixtures
integration-owner: done
docs-installation-parameters: done
docs-configuration-parameters: done
Copy link
Member

Choose a reason for hiding this comment

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

No options flow, so this would be exempt

status: todo
comment: Consider using snapshots + consistency in setup calls + add numerical tests + use fixtures
integration-owner: done
docs-installation-parameters: done
Copy link
Member

Choose a reason for hiding this comment

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

It does describe it but it could use the configuration block for it maybe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linked to PR-in-progress / set to todo

Comment on lines 79 to 85
docs-use-cases: done
docs-supported-devices: done
docs-supported-functions: done
docs-data-update: done
docs-known-limitations: done
docs-troubleshooting: done
docs-examples: done
Copy link
Member

Choose a reason for hiding this comment

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

I am missing a few of these in the docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All set to todo just for re-checking one by one

@home-assistant home-assistant bot marked this pull request as draft December 2, 2024 13:08
common-modules:
status: todo
comment: Verify entity for async_added_to_hass usage (discard?)
docs-high-level-description: done
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
docs-high-level-description: done
docs-high-level-description: todo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as future todo

status: todo
comment: Verify entity for async_added_to_hass usage (discard?)
docs-high-level-description: done
docs-installation-instructions: done
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
docs-installation-instructions: done
docs-installation-instructions: todo

Copy link
Contributor Author

@CoMPaTech CoMPaTech Dec 2, 2024

Choose a reason for hiding this comment

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

Docs PR was just closed, but let's leave it as todo to make a process out of this. E.g. set to todo, create small update PR to indicate (with reference PR to docs) that it's done.

@joostlek joostlek changed the title Plugwise quality Record Plugwise Quality Scale Dec 2, 2024
@joostlek joostlek marked this pull request as ready for review December 2, 2024 14:20
@joostlek joostlek merged commit 13e9f19 into home-assistant:dev Dec 2, 2024
34 checks passed
@CoMPaTech CoMPaTech deleted the plugwise_quality branch December 2, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants