Skip to content
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions homeassistant/components/zha/entities/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def __init__(self, endpoint, in_clusters, out_clusters, manufacturer,
endpoint.endpoint_id,
kwargs.get('entity_suffix', ''),
)
self._device_state_attributes['friendly_name'] = "{}_{}{}".format(

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.

This is wrong:

  • Define the name property to set the name
  • A name should not contain underscores, endpoint IDs etc. That's not a name, that's an identifier.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Understood. In that case I would skip the friendly name if we do not have model/manufacturer information and use the ieee network address as a name for the device registry. Is that ok?

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.

What you're changing is not for the device registry, this is for the entity

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, but currently the friendly name attribute is used as a name for the device registry. If there is no friendly name it errs out when adding it to the device registry. That is what I am trying to fix.

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.

Then that should be fixed inside the device_info method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, is it ok to use the ieee network address as a name for the device registry? Or is there any other preferred naming convention?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with balloob, If we don't have Manufacturer/Model, don't set 'friendly_name' at all and for the device_info['name'] use IEEE or "ZHA + IEEE"?

ieeetail,
endpoint.endpoint_id,
kwargs.get('entity_suffix', ''),
)

self._endpoint = endpoint
self._in_clusters = in_clusters
Expand Down