Skip to content

Always add friendly name attribute to ZHA entities#19141

Merged
balloob merged 2 commits intohome-assistant:devfrom
damarco:zha-fix-friendly-name
Dec 13, 2018
Merged

Always add friendly name attribute to ZHA entities#19141
balloob merged 2 commits intohome-assistant:devfrom
damarco:zha-fix-friendly-name

Conversation

@damarco
Copy link
Copy Markdown
Contributor

@damarco damarco commented Dec 9, 2018

Description:

Always add a friendly name to entities so that we have a name for the device registry.

fixes #18755

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

@ghost ghost added the in progress label Dec 9, 2018
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"?

dmulcahey added a commit to dmulcahey/home-assistant that referenced this pull request Dec 10, 2018
home-assistant#19141 should be what ultimately corrects this issue.
@fabaff fabaff changed the title Always add friendly name attribute to zha entities Always add friendly name attribute to ZHA entities Dec 12, 2018
fabaff pushed a commit that referenced this pull request Dec 12, 2018
* event foundation

* implement quirks

* lock zha-quirks version

* allow quirks handling to be toggled on and off

* revert event commit

* disable warning

* update requirements_all

* Remove fix in favor of #19141

#19141 should be what ultimately corrects this issue.

* review comment
@dmulcahey
Copy link
Copy Markdown
Contributor

Just adding a note that the already merged device registry changes will cause errors if this isn’t merged before they are released

@balloob balloob added this to the 0.84.2 milestone Dec 13, 2018
@balloob balloob merged commit f60f9ba into home-assistant:dev Dec 13, 2018
@ghost ghost removed the in progress label Dec 13, 2018
balloob pushed a commit that referenced this pull request Dec 14, 2018
* Always add friendly name attribute

* Only change device_info name
@balloob balloob mentioned this pull request Dec 14, 2018
@damarco damarco deleted the zha-fix-friendly-name branch December 16, 2018 13:22
dshokouhi pushed a commit to dshokouhi/home-assistant that referenced this pull request Dec 25, 2018
)

* Always add friendly name attribute

* Only change device_info name
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.

5 participants