Skip to content

UPNP don't notify embedded child devices by default #4735

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrewfg
Copy link
Contributor

See #4712

Signed-off-by: Andrew Fiddian-Green [email protected]

@andrewfg andrewfg requested a review from a team as a code owner April 21, 2025 09:01
@andrewfg
Copy link
Contributor Author

Ping @lolodomo ..

Note: I wrote the code, but I do not have any time for testing, so can you please have a look at it yourself.

@andrewfg
Copy link
Contributor Author

@lo92fr if your addon discovery service participant wants to be notified about embedded child devices then it will have to override the notifyChildDevices() method.

@mherwege
Copy link
Contributor

See my question: #4712 (comment)

@andrewfg
Copy link
Contributor Author

andrewfg commented Apr 21, 2025

@mherwege either we have to modify..

  • some bindings to prevent them seeing unwanted children (e.g. Sonos) (opt out model), or
  • other bindings to explicitly allow them to see wanted children (opt in model)

On balance I think the opt in model is safer.

@mherwege
Copy link
Contributor

@mherwege either we have to modify..

  • some bindings to prevent them seeing unwanted children (e.g. Sonos) (opt out model), or
  • other bindings to explicitly allow them to see wanted children (opt in model)

On balance I think the opt in model is safer.

For upnpcontrol, which is a generic binding, you would want to see the embedded devices. That would mean the Sonos embedded media server and renderer would be discovered. I believe that is what @lolodomo wanted to prevent. It is easy enough to not have them discovered by the Sonos binding (opt-in or opt-out doesn’t matter). But you can’t avoid discovering it with the upnpcontrol binding.

@andrewfg
Copy link
Contributor Author

andrewfg commented Apr 21, 2025

@mherwege I think you misunderstand this. The OH Core service will ALWAYS discover both root and embedded devices. The bindings respective discovery participants will by default not receive the NOTIFICATIONS for embedded devices. And it you want your addon's disco participant to receive those notifications then you need to make a one liner override of its notifyChildDevices() method.

@mherwege
Copy link
Contributor

mherwege commented Apr 21, 2025

@mherwege I think you misunderstand this. The OH Core service will ALWAYS discover both root and embedded devices. The bindings respective discovery participants will by default not receive the NOTIFICATIONS for embedded devices. And it you want your addon's disco participant to receive those notifications then you need to make a one liner override of its notifyChildDevices() method.

I think I understand this well enough. Again: you would want to override this for the upnpcontrol binding because that binding would want to see the embedded devices for many devices (e.g. Denon has their media player as an embedded device). Therefore it will discover the embedded Sonos media server and media renderer. You cannot avoid that for upnpcontrol. That’s why I asked @lolodomo what binding discovered these embedded devices. Was it the sonos binding or the upnpcontrol binding?

@lolodomo
Copy link
Contributor

That’s why I asked @lolodomo what binding discovered these embedded devices. Was it the sonos binding or the upnpcontrol binding?

The Sonos binding.
The upnpcontrol binding is not installed.

@andrewfg
Copy link
Contributor Author

@lolodomo I opened this PR to resolve your problem from #4712 .. but apparently you are not too much concerned about that any more?? => So shall I close this one?

@lolodomo
Copy link
Contributor

lolodomo commented May 25, 2025

Of course I am interested. What is expected from me? If this is a review, I can probably do it but I am not a maintainer for the core framework.

@kaikreuzer
Copy link
Member

I cannot judge whether this feature is required, but if the binding maintainers ask for it, I'll happily merge it.
Wrt opt-in/opt-out: For backward compatibility reasons, I would think it is better to go for an opt-out, so that the existing behavior is not impacted, wdyt @andrewfg?

Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

Code looks good to me.

@lolodomo
Copy link
Contributor

Once merged, I will tell you if Sonos discovery is fixed. But we already know that it will.

@andrewfg
Copy link
Contributor Author

andrewfg commented May 26, 2025

We may need to adjust that other binding that does require discovery of embedded children.

—-

EDIT specifically https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/discovery/UpnpControlDiscoveryParticipant.java should override notifyChildDevices() and return true..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants