Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions homeassistant/components/overkiz/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
elif isinstance(description.name, str):
self._attr_name = description.name

Copy link
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
Member 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.