8000 Append name to unique id of Broadlink RM switches tomake them unique by gadgetchnnel · Pull Request #52601 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Append name to unique id of Broadlink RM switche 8000 s tomake them unique #52601

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

Conversation

gadgetchnnel
Copy link
Contributor

Breaking change

Proposed change

User defined Braodlink switch entities were being assigned given the same unique id as the device (MAC address), causing conflicts with other entities provided by the device.

This PR adds the switch name to the name to the end (in lowercase with spaces replaced by underscores).

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

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

Hey there @Danielhiversen, @felipediel, mind taking a look at this pull request as its been labeled with an integration (broadlink) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@thecode thecode added this to the 2021.7.0 milestone Jul 6, 2021
Comment on lines +198 to +200
self._attr_unique_id = (
f"{self._device.unique_id}-{self._attr_name.lower().replace(' ', '_')}"
)
Copy link
Member

Choose a reason for hiding this comment

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

This is breaking for existing users, can we migrate existing entities?

Additionally, the name cannot be used, as it user-changeable, does not viable for use in unique IDs.

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 may be wrong but, looking at the BroadlinkRMSwitch class from before 2021.7b0, it doesn't look like it previously assigned unique ids for the entities, they were added in #52177 so this looks like it may only be a breaking change if you are on the beta.

Since these are YAML configured would it actually be better to remove the unique id (but that would still be a breaking change if you're on the beta)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And, if we want unique ids for these, we could add a separate unique_id option for the switch (like the option for the template integration).

Copy link
Member

Choose a reason for hiding this comment

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

You are right about the unique_id added in #52177, however it looks like an error, from what I see in moving this line will put things back to how they were before:

self._attr_unique_id = self._device.unique_id

to below:
super().__init__(device, 1, 0)

Without any breaking changes for those who are not on dev

Copy link
Member

Choose a reason for hiding this comment

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

Yup, that indeed a regression issue, well spotted @thecode.
Will write up a quick PR to at least restore the previous functionality with the upcoming release today.

Copy link
Member
@frenck frenck Jul 7, 2021

Choose a reason for hiding this comment

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

@frenck frenck closed this in #52621 Jul 7, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2021
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.

Broadlink integration broken in core-2021.7.0b0
5 participants
0