DLNA / UPNP binding


(Артем Бондаренко) #122

Continuing the discussion from DLNA / UPNP binding:

Hi, sorry, I not understand how I can install UPNP binding in my OpenHAB?


(Scott Rushworth) #123

Not much to it… download the jar, and copy it to your /addons folder. It’s still very experimental, but I’m using it successfully with a Twonky media server and Sony SA-NS400 renderers. I’m frustrated with streams not always playing, wish there was a Channel on the renders for setting an AVTransportURI (you have to use the renderers as audio sinks), and I usually have to manually restart the binding after an OH restart to get the subscriptions going and then manually set the STOP and Player states, but having the subscriptions is wonderful (was previously using scripts without subscriptions).


(Mac Fly) #124

Hi Mark !

I’m sorry to bother you again, but I just upgraded to OpenHab 2.4.0-1 Release, and my simple Volume Control doesn’t work anymore.
When I power up my Sony device, the binding discover it but the discovery seem fail :

2019-01-11 11:03:43.239 [DEBUG] [very.UpnpControlDiscoveryParticipant] - Device type MediaRenderer, manufacturer Sony Corporation, model BDV, SN# null

2019-01-11 11:03:43.240 [DEBUG] [very.UpnpControlDiscoveryParticipant] - Media renderer found: Sony Corporation, BDV

2019-01-11 11:03:43.240 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Device ‘00000000-0000-1010-8000-544249199c7c’ reachability status changed to ‘true’

2019-01-11 11:03:43.241 [DEBUG] [pcontrol.handler.UpnpRendererHandler] - Renderer status changed to true

2019-01-11 11:03:43.243 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY add upnp subscription on AVTransport

2019-01-11 11:03:43.248 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY invoke upnp action GetTransportInfo on service AVTransport with inputs {InstanceID=0}

2019-01-11 11:03:43.249 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY invoke upnp action GetProtocolInfo on service ConnectionManager with inputs {}

2019-01-11 11:03:43.249 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Could not find action ‘GetTransportInfo’ for participant ‘00000000-0000-1010-8000-544249199c7c’

2019-01-11 11:03:43.250 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Could not find action ‘GetProtocolInfo’ for participant ‘00000000-0000-1010-8000-544249199c7c’

2019-01-11 11:03:43.258 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - A GENA subscription ‘AVTransport’ for device ‘uuid:00000000-0000-1010-8000-544249199c7c’ failed

2019-01-11 11:03:43.259 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY received subscription reply false from service AVTransport

==> /var/log/openhab2/events.log <==

2019-01-11 11:03:43.252 [hingStatusInfoChangedEvent] - ‘upnpcontrol:upnprenderer:00000000-0000-1010-8000-544249199c7c’ changed from OFFLINE (COMMUNICATION_ERROR): Communication lost with SALON BLU-RAY to ONLINE

==> /var/log/openhab2/openhab.log <==

2019-01-11 11:03:44.264 [DEBUG] [very.UpnpControlDiscoveryParticipant] - Device type MediaRenderer, manufacturer Sony Corporation, model BDV, SN# null

2019-01-11 11:03:44.265 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Device ‘00000000-0000-1010-8000-544249199c7c’ reachability status changed to ‘false’

2019-01-11 11:03:44.266 [DEBUG] [very.UpnpControlDiscoveryParticipant] - Media renderer found: Sony Corporation, BDV

2019-01-11 11:03:44.267 [DEBUG] [pcontrol.handler.UpnpRendererHandler] - Renderer status changed to false

2019-01-11 11:03:44.682 [DEBUG] [very.UpnpControlDiscoveryParticipant] - Device type MediaRenderer, manufacturer Sony Corporation, model BDV, SN# null

2019-01-11 11:03:44.682 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Device ‘00000000-0000-1010-8000-544249199c7c’ reachability status changed to ‘true’

2019-01-11 11:03:44.683 [DEBUG] [very.UpnpControlDiscoveryParticipant] - Media renderer found: Sony Corporation, BDV

2019-01-11 11:03:44.683 [DEBUG] [pcontrol.handler.UpnpRendererHandler] - Renderer status changed to true

2019-01-11 11:03:44.684 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY add upnp subscription on AVTransport

2019-01-11 11:03:44.686 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY invoke upnp action GetProtocolInfo on service ConnectionManager with inputs {}

2019-01-11 11:03:44.687 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Could not find action ‘GetProtocolInfo’ for participant ‘00000000-0000-1010-8000-544249199c7c’

2019-01-11 11:03:44.689 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY invoke upnp action GetTransportInfo on service AVTransport with inputs {InstanceID=0}

2019-01-11 11:03:44.695 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - A GENA subscription ‘AVTransport’ for device ‘uuid:00000000-0000-1010-8000-544249199c7c’ failed

2019-01-11 11:03:44.695 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Could not find action ‘GetTransportInfo’ for participant ‘00000000-0000-1010-8000-544249199c7c’

2019-01-11 11:03:44.696 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY received subscription reply false from service AVTransport

==> /var/log/openhab2/events.log <==

2019-01-11 11:03:44.271 [hingStatusInfoChangedEvent] - ‘upnpcontrol:upnprenderer:00000000-0000-1010-8000-544249199c7c’ changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Communication lost with SALON BLU-RAY

2019-01-11 11:03:44.697 [hingStatusInfoChangedEvent] - ‘upnpcontrol:upnprenderer:00000000-0000-1010-8000-544249199c7c’ changed from OFFLINE (COMMUNICATION_ERROR): Communication lost with SALON BLU-RAY to ONLINE

But when I tried to send a setvolume command thru the Dimmer item :

2019-01-11 11:04:04.174 [DEBUG] [pcontrol.handler.UpnpRendererHandler] - Handle command 18 for channel upnpcontrol:upnprenderer:00000000-0000-1010-8000-544249199c7c:volume on renderer SALON BLU-RAY

2019-01-11 11:04:04.175 [DEBUG] [ding.upnpcontrol.handler.UpnpHandler] - Upnp device SALON BLU-RAY invoke upnp action SetVolume on service RenderingControl with inputs {InstanceID=0, Channel=Master, DesiredVolume=18}

2019-01-11 11:04:04.177 [DEBUG] [port.upnp.internal.UpnpIOServiceImpl] - Could not find action ‘SetVolume’ for participant ‘00000000-0000-1010-8000-544249199c7c’

…Error and nothing happend …

Any thought about it ? Tell me if I can provide you more information.

Thanks you.


(Mark Herwege) #125

@MacFly I would need to dig into the code again and start debugging and improving. I know there are issues with the binding, not just for you. I pulled this together as a quick project but didn’t have the time to keep on working on this one. I am afraid I won’t have the time for this the next few weeks. Sorry for that.
@5iver My original intention for this binding was to be able to use it as a control point to control a media server and send the media for playback to a renderer. That works for me. I actually can play more than just audio (video, photos). Again, I know there are bugs and combinations that do not work. There is a lot of potential for improvement. Registering the renderers as audio sinks is just an easy side step. Adding a URL directly to the renderer kind of defeats the whole concept of the binding. But maybe there should be a separate server thing type, which is just has a url for a streaming service channel (with a similar renderer selection channel capability). What do you think?


(Scott Rushworth) #126

Using audio sinks just is not all that user friendly, and I’ve basically simulated a playURI channel with String items, a rule, and Items to store the uuids. A Channel would have simplified this. I also generate local TTS audio alerts on the server running OH, and have the speakers access the files from the server… no media server involved, so I don’t think what your suggesting would help, at least in my implementation.

Before the binding, I used scripts for everything. Using the binding and playStream, audio often does not play after sending the command. In looking at the logs after a playStream that did not work, I found a Stop PLAY and SetAVTransportURI all being sent at the same time, in random order. And the order of the responses explains why the audio often does not play. I would have expected that the SetAVtransport wouldn’t have been sent until the response was received for the STOP. Same for the PLAY waiting for the SetAVTransport response.

private void playMedia(String url) {
    handler.stop();
    String newUrl = url;
    if (!url.startsWith("x-") && !url.startsWith("http")) {
        newUrl = "x-file-cifs:" + url;
    }
    handler.setCurrentURI(newUrl, "");
    handler.play();
}

(Mac Fly) #127

Hi Mark,
First of all, thanks you for your answer … I know this is only a side tool for you but so useful for many :slight_smile:

Here is more information about my differents tests, with the hope that will be help you when you have some spare time to dig in it.

First question is when it happend? With the help of Dockers, I have played with many milestone builds (openHAB 2.4 Milestone builds). Your binding works well until milestone 2.4.0-M7, 2.4.0-M8 and further doesn’t work anymore.

Second thing I noticed (on M8 and further) is that if my device is powered ON when I start Openhab, the binding works well but If my device is OFF at openhab start or if I power OFF and ON my device when openhab is started, the actions isn’t reconnized anymore.

Again, thanks you for this tool. At the moment, I kept a container with a light milestone 7 and only your binding, sync with my main openhab 2.4.0 release with mqtt.

Best regards,

Mac_Fly.


(Mark Herwege) #128

@5iver The logic of waiting for a message acknowledgment before taking the next action is weak in the binding. I would have to recode much of it, probably using futures to be able to wait for required return values, if there is an expected answer. I started this by copying some code from bindings like the Sonos binding, and I noticed that in most of these, there wasn’t a consistent check of message acknowledgments.
Also, I tested with a few players, and they all behaved differently as to the expected sequence before the next media queued was served.
Again, a lot of work ahead to make this logic a lot stronger. I am sorry, but I can’t focus on that in the near future.


(Mark Herwege) #129

@MacFly Nice to see you found an ingenious way to keep it in the air. Also, thank you for the info on when the binding broke. I will check what changes happened between these releases that could impact the binding.
I hope to be able to come back to this binding, but I cannot guarantee that this will be in the near future.
PS: The reason it brakes between M7 and M8 is probably in this change: upgraded to JUPnP 2.5.0 (#6625) (detail / githubweb )