Skip to content
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

Improve discovering upnp/igd device by always using the SSDP-discovery for the Unique Device Name #111487

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

StevenLooman
Copy link
Contributor

@StevenLooman StevenLooman commented Feb 26, 2024

Proposed change

Instead of using/storing the UDN from the device description, store the UDN from the SSDP discovery. The latter is used to find the device when initializing the component. Normally, the UDN should be the same in both the SSDP communication and the device description, but alas, broken UPnP implementations exist.

This should fix #110216, and hopefully not break any existing installations. If any new issues arise after this change, the plan is to revert this change.

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

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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format 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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@StevenLooman StevenLooman changed the title Always use the UDN found in the SSDP discovery, instead of the device description Improve finding upnp/igd device by always using the SSDP-discovery for the Unique Device Name Feb 26, 2024
@StevenLooman
Copy link
Contributor Author

If possible, please don't add this to 2024.2.4, but rather add this to the 2024.3.0 beta. A bit of more testing cannot hurt.

@StevenLooman StevenLooman changed the title Improve finding upnp/igd device by always using the SSDP-discovery for the Unique Device Name Improve discovering upnp/igd device by always using the SSDP-discovery for the Unique Device Name Feb 26, 2024
@StevenLooman StevenLooman added this to the 2024.3.1 milestone Mar 7, 2024
@Kane610
Copy link
Member

Kane610 commented Mar 9, 2024

If youre insecure about the end result of this change maybe not put it in milestone 2024.3.1?

@StevenLooman
Copy link
Contributor Author

StevenLooman commented Mar 10, 2024

I feel confident enough to include it now.

At the time when I created this PR there was no 2024.3.b0 milestone, only one for 2024.2.

@balloob balloob merged commit cd4e870 into home-assistant:dev Mar 12, 2024
23 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2024
@frenck frenck mentioned this pull request Mar 13, 2024
"mock_mac_address_from_host",
)
async def test_flow_ssdp_with_mismatched_udn(hass: HomeAssistant) -> None:
"""Test config flow: discovered + configured through ssdp, where the UDN differs in the SSDP-discovery vs device description."""
Copy link
Member

Choose a reason for hiding this comment

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

Please limit docstring lines to 72 characters per line, in accordance with PEP8.

The first line is a header and should be a single sentence. After that an optional body can follow separated from the header by a blank line.

@home-assistant home-assistant unlocked this conversation Mar 19, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2024
@StevenLooman StevenLooman deleted the upnp_fix_110216 branch March 29, 2024 17:13
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.

Upnp - Device not discovered
5 participants