Skip to content

Add zha typing [core.discovery] (1)#68359

Merged
Adminiuga merged 2 commits intohome-assistant:devfrom
cdce8p:zha-discovery_1
Mar 19, 2022
Merged

Add zha typing [core.discovery] (1)#68359
Adminiuga merged 2 commits intohome-assistant:devfrom
cdce8p:zha-discovery_1

Conversation

@cdce8p
Copy link
Copy Markdown
Member

@cdce8p cdce8p commented Mar 19, 2022

Proposed change

  • Replace imports from zha/core/typing.py
    • ZhaEntityType -> ZhaEntity
    • ZhaDeviceType -> ZHADevice
    • ChannelType -> base.ZigbeeChannel
    • ChannelPoolType -> ChannelPool
    • ZhaGroupType -> ZHAGroup
  • Fix async_add_entities typing. The entities parameter need to accept a class type, not an instance.
    -> type[ZhaEntity]
  • GroupProbe._hass: Don't initialize it with None as this complicates typing. Before GroupProbe is used, initialize is called anyway which sets _hass.
    async def async_initialize(self):
    """Initialize controller and connect radio."""
    discovery.PROBE.initialize(self._hass)
    discovery.GROUP_PROBE.initialize(self._hass)

    zha_gateway = ZHAGateway(hass, config, config_entry)
    await zha_gateway.async_initialize()

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)
  • 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.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link
Copy Markdown

Hey there @dmulcahey, @Adminiuga, mind taking a look at this pull request as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Copy link
Copy Markdown
Contributor

@Adminiuga Adminiuga left a comment

Choose a reason for hiding this comment

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

Lgtm

@Adminiuga Adminiuga merged commit 1263205 into home-assistant:dev Mar 19, 2022
@cdce8p cdce8p deleted the zha-discovery_1 branch March 19, 2022 11:40
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants