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

Fix missing EntityDescription names in Overkiz #95583

Merged
merged 3 commits into from Jul 1, 2023

Conversation

iMicknl
Copy link
Contributor

@iMicknl iMicknl commented Jun 29, 2023

Proposed change

The fix in #95238 caused an issue with all entities that use an EntityDescription, this fix should resolve this. Tested on 2 of my accounts and now all entities show up correctly.

(unfortunately we don't have tests for this part, thus I didn't catch it last time).

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
  • I have followed the perfect PR recommendations
  • 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:

@home-assistant
Copy link

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

Code owner commands

Code owners of overkiz 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 overkiz Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@balloob balloob added this to the 2023.7.0 milestone Jun 30, 2023
@@ -119,3 +119,5 @@ def __init__(
# In case of sub device, use the provided label
# and append the name of the type of entity
self._attr_name = f"{self.device.label} {description.name}"
else:
self._attr_name = description.name
Copy link
Member

Choose a reason for hiding this comment

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

Casting something to string meant that both None and UndefinedType (if no name was set) got turned into a string. I removed that statement and now type checking is correctly complaining.

It is better to just set name=None in the entity descriptions that need it.

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 will need to have a better look here... Setting name to None in entity description won't work, because we actually want to use the name from the entity description.

There are other cases where we want to inherit the name from the device name, for example for cover entities. Since a recent change in core, it will print an error when we implicit inherit the name from the device. Looking at this at a first glance, it will require more changes to explicit set the name.

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 have made a fix for now. However I should have a better look in the coming days (or shortly after the next release), to see if we can rewrite the OverkizEntity.

@iMicknl iMicknl marked this pull request as draft June 30, 2023 19:29
@iMicknl iMicknl marked this pull request as ready for review June 30, 2023 19:38
@balloob balloob merged commit 8b159d0 into home-assistant:dev Jul 1, 2023
23 checks passed
@iMicknl iMicknl deleted the fix_overkiz_device_names branch July 1, 2023 07:03
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2023
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.

None yet

2 participants