DLNA / UPNP binding

Try feature:install openhab-transport-upnp. You need to explicitly load the transport if no other binding you use relies on the UPnP transport.
There is a configuration option on the thing to increase the timeout, but I doubt that’s the issue. It may be GENA. events are not started because of the missing feature, so no event messages are received.

Yes, that solved the error messages. I did:

feature:install openhab-transport-upnp
bundle:restart  org.openhab.binding.upnpcontrol

Now even with debug messages on, I can’t spot an error. But the speaker stays silent. :frowning:

Would it be usefull to create a complete debug log from start to completion (playing)?

I just tried setting different stream URI with mp3 as extension. It seems, it was not able to extract the stream from the m3u. I downloaded the m3u to disk and have extracted the URI ending with stream.mp and it works! Still there’s no error message when it does not accept the URI and the timeout message is also still there (must have missed it before).

2020-10-08 16:35:04.995 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action SetAVTransportURI on service AVTransport with inputs {InstanceID=0, CurrentURI=http://swr-edge-2022-dus-lg-cdn.cast.addradio.de/swr/dasding/live/mp3/128/stream.mp3, CurrentURIMetaData=}
2020-10-08 16:35:05.046 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action SetAVTransportURI on service AVTransport reply {}
2020-10-08 16:35:07.496 [DEBUG] [internal.handler.UpnpRendererHandler] - Timeout exception, media URI not yet set in renderer XW-SMA3 2337FB, trying to play anyway
2020-10-08 16:35:07.497 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action Play on service AVTransport with inputs {Speed=1, InstanceID=0}
2020-10-08 16:35:07.507 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action Play on service AVTransport reply {}

I’m also able to use playStream as I was able to do before upgrade to 2.3.

Thanks a lot for this great work! :slight_smile:

1 Like

@DonStefano I don’t see any event messages coming back in your debug log extract. So I still think something is wrong and the GENA events are not arriving. A debug log from the start may be helpful, see if we can find something there. Beyond that, you may also want to look into logging org.jupnp.transport.

I don’t have a good way to catch the errors as in the example you gave. The UpnpIOService writes the error in the debug log, but eats the error and does not return it to the binding. The binding only sees (or doesn’t see) the result. I expect you would see the error in the log if you turn on debug logging for org.eclipse.smarthome.io.transport.upnp.

I have enabled debug log for org.eclipse.smarthome.io.transport.upnp since a while now and most of the time the service was running smoothly without problems. Only message I saw regularly in the log was:

2020-10-30 13:12:20.578 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Polling participant '5F9EC1B3-ED59-79C2-4530-745E1C2337FB' through Action 'GetCurrentConnectionIDs' of Service 'ConnectionManager' 

But from time to time it seems to loose connection and is no longer responding to commands. Then the regular log sequence is like:

2020-10-30 13:12:31.504 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action GetCurrentConnectionInfo on service ConnectionManager with inputs {ConnectionId=0}
2020-10-30 13:12:41.504 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Current state of service prevents invoking that action. Connection error or no response received.
2020-10-30 13:12:41.505 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action GetCurrentConnectionInfo on service ConnectionManager reply {}
2020-10-30 13:13:26.504 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action GetProtocolInfo on service ConnectionManager with inputs {}

When I try to set URI it gives:

2020-10-30 13:24:00.591 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Polling participant '5F9EC1B3-ED59-79C2-4530-745E1C2337FB' through Action 'GetCurrentConnectionIDs' of Service 'ConnectionManager' 
2020-10-30 13:24:08.015 [DEBUG] [internal.handler.UpnpRendererHandler] - Handle command http://swr-edge-2022-dus-lg-cdn.cast.addradio.de/swr/dasding/live/mp3/128/stream.mp3 for channel upnpcontrol:upnprenderer:5F9EC1B3-ED59-79C2-4530-745E1C2337FB:uri on renderer XW-SMA3 2337
2020-10-30 13:24:08.016 [DEBUG] [internal.handler.UpnpRendererHandler] - New URI http://swr-edge-2022-dus-lg-cdn.cast.addradio.de/swr/dasding/live/mp3/128/stream.mp3 is same as previous on renderer XW-SMA3 2337FB
2020-10-30 13:24:08.017 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action SetAVTransportURI on service AVTransport with inputs {InstanceID=0, CurrentURI=http://swr-edge-2022-dus-lg-cdn.cast.addradio.de/swr/dasding/live/mp3/128/stream.mp3, CurrentURIMetaData=}
2020-10-30 13:24:18.018 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Current state of service prevents invoking that action. Connection error or no response received.
2020-10-30 13:24:18.018 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action SetAVTransportURI on service AVTransport reply {}
2020-10-30 13:24:18.019 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action GetCurrentConnectionInfo on service ConnectionManager with inputs {ConnectionId=0}
2020-10-30 13:24:28.019 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Current state of service prevents invoking that action. Connection error or no response received.
2020-10-30 13:24:28.020 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action GetCurrentConnectionInfo on service ConnectionManager reply {}
2020-10-30 13:24:28.020 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action GetProtocolInfo on service ConnectionManager with inputs {}
2020-10-30 13:24:38.021 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Current state of service prevents invoking that action. Connection error or no response received.
2020-10-30 13:24:38.021 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action GetProtocolInfo on service ConnectionManager reply {}
2020-10-30 13:24:38.022 [DEBUG] [control.internal.handler.UpnpHandler] - UPnP device XW-SMA3 2337FB invoke upnp action Play on service AVTransport with inputs {Speed=1, InstanceID=0}

This situation stays until restart of OH.

I’m still encountering the issue. After a few days of usage the thing becomes offline. I have done some googeling and found a similar problem exists in SONOS binding: Too much time before a Sonos thing becomes definitively ONLINE
After trying the workaround to manually restart the jupnp bundle also my device became available again. My remaining problem is, that I can’t effectively find out the situation when the thing is really offline as it also becomes offline for a short period of time when I switch off power, and comes back online after rediscovering the device, because it is not really switched off and network communication stays alive. Does the 3.0 binding use newer version of jupnp? My 2.5.11 openHAB installation shows jupnp version 2.5.2.

I am moving my system to openhab 3 and I can confirm, latest stable version still uses v2.5.2.

1 Like

It seems to be latest release when looking at: GitHub - jupnp/jupnp: UPnP/DLNA library for Java

There are a few bugs open right now dealing with some thread usage that may resolve this. Do you use either denonmarantz, ecobee, or samsungtv?

I have installed samsungtv but not really using it. You say, it interferes with UPNP?

Yes there are some thread issues with it that are causing an exhaustion problem.

I will uninstall and test without it.

Ok. Please hold on doing any 3.1 snapshot updates, the last commit broke something. I’ve already submitted a bug for it so hopefully the 3.1 snapshot should fix all of this soon.

3.1.0-S2130 and beyond should now be stable for the bindings in question. I would suggest anyone who is having the issue of the upnp devices falling off and not coming back to move to that snapshot and see if that resolves it. If not, please do a thread/stack dump and post it so we can see what is causing the starvation issue.

Cross posting from a few other threads…

For those interested in testing, this is a very experimental image (although it seems to be stable on my system) that may resolve this issue. In fact, it may significantly improve performance of upnp devices.
This version of jupnp has some extra code on the threads that let them work without a pool. There is a chance that this can cause instant spikes in memory or cpu, but they should be short lived.

In addition to retryAfterSeconds, add:

org.jupnp:asyncThreadPool=false
org.jupnp:mainThreadPool=false

Please make the config addition with OH stopped, it will be highly disruptive if it’s active.

Please report success or failure so we can determine if this should get merged. Thanks!

Hello everyone. I’ve installed the UpnP binding and managed to get it working. I am using Habpanel to control my devices and thought to do the same for the UpnP. The problem is that the widget SELECTION allows me to access the folders an files and displays them correctly, but it does not refresh at every change made.
In other words, I select the widget SELECTION, the window with the folders pops-up. I select the desired folder and see the main widget update its state. When I re-press the widget to go into the next folder, it displays the same folders shown in the previous folder. Any ideas how to solve this issue? I am using the native Qnap NAS DLNA capability. Do I need to install Twonky or Serviio?

OpenHab version 3.4.2

Probably the limitations of BasicUI also apply to Habpanel?

BasicUI does not support dynamic refreshing of the selection list in the upnpserver channels renderer, browse, playlistselect and in the upnprenderer channel favoriteselect. A refresh of the browser will be required to show the adjusted selection list.

How is the behaviour when using MainUI or a page reload when using HabPanel?

In MainUi the channel works as expected. In Habpanel even a refresh does not help. You need to select a different page and then return to the page with the widget pointing at the “Current Media id” channel. Then you can make your next selection. It is very annoying.

Can anyone tell me how to get the player on main UI? Since the channel uses an integrated widget, I do not seem to find a solution to get it to work on Main UI. Thanks for the help.

I assume that you are new the MainUI?

  1. You can start with the Semantic Model to get an auto-generated dashboard of your controls. → gets all of your stuff to the dashboard but very generic.
  2. You can create a widget on your own or get one from the marketplace like Multiroom Audio Player or Custom Widget: Music Control. → gets just your audio player done and could require more time for customization.

I did both in that particular order.