-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Append name to unique id of Broadlink RM switches tomake them unique #52601
Conversation
Hey there @Danielhiversen, @felipediel, mind taking a look at this pull request as its been labeled with an integration ( |
self._attr_unique_id = ( | ||
f"{self._device.unique_id}-{self._attr_name.lower().replace(' ', '_')}" | ||
) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: