core icon indicating copy to clipboard operation
core copied to clipboard

Make DHCP discovery aware of the network integration

Open davidrapan opened this issue 6 months ago • 11 comments

Proposed change

DHCP Discovery currently listens (watches) only on default interface. aiodhcpwatcher was updated and has now option to specify multiple interfaces by their index. Changes in this PR are simply handing over list of active interfaces during the call of aiodhcpwatcher.async_start.

Depends on #144769

/>David

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [x] New feature (which adds functionality to an existing integration)
  • [ ] Deprecation (breaking change to happen in the future)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [ ] Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #144516
  • This PR is related to issue: #144516
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] I have followed the perfect PR recommendations
  • [x] The code has been formatted using Ruff (ruff format homeassistant tests)
  • [x] 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:

  • [x] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [x] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [x] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

davidrapan avatar May 12 '25 19:05 davidrapan

Hey there @bdraco, mind taking a look at this pull request as it has been labeled with an integration (dhcp) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of dhcp can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign dhcp Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

home-assistant[bot] avatar May 12 '25 19:05 home-assistant[bot]

Please do the library bump in a separate PR

bdraco avatar May 12 '25 19:05 bdraco

Please do the library bump in a separate PR

Done. In #144769

davidrapan avatar May 12 '25 20:05 davidrapan

What? Some checks later on wanted Optional[]... But ruff now want's to remove it?

Edit: Guess it was some typo from me then.

davidrapan avatar May 12 '25 21:05 davidrapan

We need to change the string on the frontend side now

src/translations/en.json:          "network_adapter_info": "Configure which network adapters integrations will use. Currently this setting only affects multicast traffic. A restart is required for these settings to apply.",

bdraco avatar May 12 '25 22:05 bdraco

https://github.com/home-assistant/frontend/blob/ec3fdc0ea7e821ffd1f15515bb0e2ee8cae3e2e4/src/translations/en.json#L6422

bdraco avatar May 12 '25 22:05 bdraco

Should be good to merge after we get a test and a linked PR on the frontend

bdraco avatar May 12 '25 22:05 bdraco

Configure which network adapters integrations will use. Currently this setting only affects multicast traffic and DHCP discovery. A restart

Does that sounds right?

davidrapan avatar May 12 '25 22:05 davidrapan

I think we can drop the sentence Currently this setting only affects multicast traffic as all the core discovery integrations listed on that page will now use network after this.

bdraco avatar May 12 '25 22:05 bdraco

Ah, I see. Okay then!

davidrapan avatar May 12 '25 22:05 davidrapan

https://github.com/home-assistant/frontend/pull/25452

davidrapan avatar May 12 '25 23:05 davidrapan

There is some garbage again.. Can you run the test number 7 again?

davidrapan avatar May 13 '25 05:05 davidrapan

Retested on production. Everything still works

bdraco avatar May 14 '25 05:05 bdraco

Nice! Thank you. 🎉

davidrapan avatar May 14 '25 12:05 davidrapan