-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
SMA add DHCP strictness #145753
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
base: dev
Are you sure you want to change the base?
SMA add DHCP strictness #145753
Conversation
Hey there @kellerza, @rklomp, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Note: don't review or merge this yet, since it's used for a custom component and people can help to check if this works. :) |
If an existing entry is in capitals, this change might lead to a duplicate config entry. So may be we should check if there are existing entries for the mac address? |
In the end that is what we want to achieve, we're currently checking on the |
It would help to avoid duplicate entries I guess. |
May be we can update an existing entry with the Mac address if the unique ID matches? |
|
This has been confirmed as a fix. Let's await a few more users' responses. |
Can we add a test for the new code? Also include a case where some an old entry exists and is to be converted to a dynamical host. |
|
||
# Manual installations not always provide a MAC address | ||
# This is the first gatekeeper to avoid duplicates | ||
self._async_abort_entries_match({CONF_HOST: self._discovery_data[CONF_HOST]}) |
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 can be removed in a next iteration.
if serial_number.startswith("sma"): | ||
serial_number = serial_number.removeprefix("sma") | ||
serial_number = serial_number.split("-", 1)[0] | ||
await self.async_set_unique_id(serial_number) |
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.
Is a migration needed for all the existing entries that may have a dash in their unique ID?
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.
At first glance it doesn't look like it. The manual setup entries have been configured without the "sma" prefix and the dash.
I am not 100% familiar with the exact range of serial numbers, nor can I find the proper information - it's as bit on reverse engineering and what I can find in pyama.
Breaking change
Proposed change
Potential bugfix for #145024
This needs some testing during the Beta week, so let's hope we have some volunteers - DHCP testing is hard on DEV.
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: