DLNA / UPNP binding

My device is definitely in sleep mode.

This code indicates its possible. None of the channels in the binding work for my device as the binding stands.

Running netdisco, I can see the device:


openhome:
[{'host': '192.168.0.64',
  'manufacturer': 'Linn Products Ltd',
  'model_name': 'Klimax DS',
  'model_number': None,
  'name': 'Linn Music Room Preamp',
  'port': 55178,
  'serial': None,
  'ssdp_description': 'http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml',
  'udn': 'uuid:4c494e4e-0026-0f22-3898-012366860133',
  'upnp_device_type': 'urn:linn-co-uk:device:Preamp:1'},
 {'host': '192.168.0.64',
  'manufacturer': 'Linn Products Ltd',
  'model_name': 'Klimax DS',
  'model_number': None,
  'name': 'Linn Music Room',
  'port': 55178,
  'serial': None,
  'ssdp_description': 'http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml',
  'udn': 'uuid:4c494e4e-0026-0f22-3898-01236686013f',
  'upnp_device_type': 'urn:linn-co-uk:device:Source:1'}]


And

 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml - upnp:rootdevice>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml - uuid:4c494e4e-0026-0f22-3898-012366860133>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml - urn:linn-co-uk:device:Preamp:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml - urn:av-openhome-org:service:Product:3>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml - urn:av-openhome-org:service:Config:2>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml - urn:linn-co-uk:service:Proxy:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860133/Upnp/device.xml - urn:av-openhome-org:service:Volume:4>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - upnp:rootdevice>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - uuid:4c494e4e-0026-0f22-3898-01236686013f>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:device:Source:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:ConfigApp:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Product:3>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Credentials:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Time:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Info:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Config:2>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Transport:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Pins:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:service:Diagnostics:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:service:Volkano:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:service:Privacy:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Exakt:4>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:service:Configuration:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:service:Exakt2:2>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:service:ExaktInputs:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:linn-co-uk:service:Cloud:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Playlist:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Radio:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Receiver:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Sender:2>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-01236686013f/Upnp/device.xml - urn:av-openhome-org:service:Debug:2>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860171/Upnp/device.xml - upnp:rootdevice>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860171/Upnp/device.xml - uuid:4c494e4e-0026-0f22-3898-012366860171>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860171/Upnp/device.xml - urn:schemas-upnp-org:device:MediaRenderer:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860171/Upnp/device.xml - urn:schemas-upnp-org:service:AVTransport:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860171/Upnp/device.xml - urn:schemas-upnp-org:service:ConnectionManager:1>,
 <UPNPEntry http://192.168.0.64:55178/4c494e4e-0026-0f22-3898-012366860171/Upnp/device.xml - urn:schemas-upnp-org:service:RenderingControl:1>,

It won’t work. The binding sticks to the UPnP AV Forum standard, not the AV openhome standard: http://wiki.openhome.org/wiki/OhMedia. It can’t do anything with all the urn:av-openhome-org:… messages. The library you linked works against the AV openhome standard.

:frowning: :frowning: :frowning:

Fair enough. Ill see if this can be done using scripts like the spotify.py one that can populate items etc.

Hi Mark

I dont believe it uses the openhome standard, theres no mention here:

https://docs.linn.co.uk/wiki/index.php/UPnP

The Linn extensions are, in my understanding, the openhome ‘standard’. Look at your provided device.xml. It contains plenty of openhome descriptors. But according to that wiki, you should be able to switch them to use the uPnP AV 1.0 standard. Is there a setting somewhere in the Linn devices?

Hi Mark

I found a dev Linn forum, I’ve managed to actually switch the unit on/off and change inputs using LPEC, which is a Linn protocol like Telnet (Control 4/Creston use this). This seems far easier than trying with UPNP.

Ill write a bash script to do the commands invoked with a rule and expose to Alexa :slight_smile:

Theres no settings for UPNP on the Linn, but yes it does accept those commands.

@5iver Did you have time to look into it? I tested the code again, and ran into a few issues. The audio sink was not properly registered, and I had a SAX reader exception (probably due to a library version mismatch). I could work around both of these and did a few more cleanups.
However, I am still stuck. When I play something from the server to the renderer, my server selection goes back to the root after a while. It looks like the whole OSGI plumbing for the upnp participant is redone at that time, resetting the full state of the server. I can’t figure out why that is. If you fancy having a look, my current state of code is on my github under the upnp branch: https://github.com/mherwege/openhab-addons/tree/upnp.

Not yet… I’ve been distracted moving and expanding our vegetable garden… and added 20 blueberry bushes… and 3 more hop plants… :smile:

I just got my IDE fired up again and pulled your latest…

Could you post a compiled .JAR? I’m having issues compiling it. First time I’ve tried it and it’s not going well. Thanks.

EDIT: updated jar after version and formatting changes

@cbaxter I have uploaded it here: https://www.dropbox.com/s/df20troogfhdh6z/org.openhab.binding.upnpcontrol-2.5.6-SNAPSHOT.jar?dl=0

I’m having issue with that. I receive this in the log:
2020-05-28 12:42:23.282 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.upnpcontrol-2.5.6-SNAPSHOT.jar

I am running Openhab 2.5.5~S108-1. This binding is for 2.5.6. Could that be the issue?

It shouldn’t be. I have it running on An RPi with release version 2.5.5 at the moment.
Did you take the version at the end of the day? i updated the link, because the one I posted 12h ago was compiled straight in the IDE, and that didn’t work when run in a non-dev instance. The current version should be OK.

EDIT: also notice you still need the upnp transport when installing the binding through the addons folder. The relevant feature has changed since 2.4. The console command to install is: feature:install openhab-core-io-transport-upnp

1 Like

It’s working now. Thank you for all your help. I tried the console command with no luck and found another post that said to add the Sonos binding which uses the upnp transport. After adding that binding it quickly found 2 UPNP servers on the network. Great job on the binding and thanks again.

There was an error in the name of the feature above. It is now corrected.

Will this binding be available as part of OH 2.5.x at some stage? Is there a reason it is not in an OH GitHub repo? Many thanks for your work.

I have this working with playSound. Does it work with playStream?

Yes, you can use playStream, which is exclusively what I use.

Could you give me an example of the code you are using? I can use:
playSound(“doorbell.mp3”)
and get the sound, but using
playStream (“https://17433.live.streamtheworld.com:443/WXKRFMAAC_SC
and get nothing. I get no errors in the log, and the URL plays in VLC.
Thanks for the help.

Hmmm… you haven’t specified the sink argument. Have you set a default sink? If you haven’t set it, the default will be set to ‘System Speaker’. IIRC, the sinks found through this binding do now work well as a default sink, since the default sink will need to be reset every time OH or the binding restarts. Try using something like this…

playStream ("upnpcontrol:upnprenderer:<the_renderers_ssid>", “https://17433.live.streamtheworld.com:443/WXKRFMAAC_SC”)

You can easily find the sinks in the console by using…

audio sinks

Here are two posts with more detail…

I truly appreciate your time helping me out with this. I was trying to use the default sink but changed it to use the ssid with no change. I could still playSound but not playStream. I was using Audiophile UPnP renderer for Windows available at https://sourceforge.net/projects/audiophilerenderer/ as my default sink. I deleted that and installed foobar2000 with the UPnP/DLNA Renderer, Server, Control Point component available at https://www.foobar2000.org/. This fixed my issues and I am able to use playStream in in OpenHAB. Thanks again for your help.

1 Like