DLNA / UPNP binding


(Laurens Van Acker) #41

Openhome is a protocol, not an OpenHAB replacement.


(Mac Fly) #42

that’s could be a good option too.
Bubble Upnp server can also provide playlist management to devices who don’t support it.


(Laurens Van Acker) #43

That’s correct. I use it in front of my Denon amplifier and Kodi for playlist management.


(Laurens Van Acker) #44

And there is code from them.


(B0rner) #45

Hey, i’m also interested in an UPNP/DLNA binding in order to play sound on an specific event. So it could be possible to turn on music using an switch or play my favourite song, if i’m coming home or plying “it’s raining men” on the morning of an rainy day to remember: don’t forget the umbrella, if you leave the home.

There are a lot of use cases for playing sounds in the smart home and UPNP/DLNA is an wide supported standard on many devices.

Would be great, if an plug-in/binding is available.


(Humarf) #46

Hello,

if openhome (or UPNP/DLNA) integration is still of interest to anyone I have created a solution for my home audio system that I would like to share. I wanted to be able to control openhome players in a scripted environment and I wanted a close integration to openhab. That’s why result is not a binding but 2 python scripts.

Script OHcli.py can send commands to an openhome device or fetch data from it. It is also useful to search for UPNP devices and explore their capabilities. It supports songcast called multiroom features of openhome devices. Implementation is including some useful “custom commands” as one button play/pause toggle, mute toggle, one button radio control and some more (all documented in the wiki).

OHsentinel.py acts as server. It does detection of openhome devices and can register to UPNP event mechanism of these devices. State changes can be forwarded to openhab items via RSTful API. OHsentinel.py can receive commands from OHcli.py and execute them. This makes execution faster. But there is no need to use OHsentinel.py - OHcli.py can operate fully on it’s own.

If you want to control UPNP/DLNA devices this would be possible by upgrading them with bubbleUPNPserver to playlist capable openhome devices. I think this is a better solution than operating UPNP/DLNA devices directly because in openhome environment you can use multiple control points and you can switch control points on and off while openhome device is playing. In a pure UPNP/DLNA environment this does not work because upnp device has no playlist.

If someone wants to try it out (there is also documentation available) please have a look here. In case there are potential users I can open a thread in this forum to discuss details. Just let me know.

Best
humarf


(Mac Fly) #47

Hello @humarf,

This is a very interesting thing ! thanks you for sharing it with us !
I already use Bubble Upnp server to add Upnp functionality to multiple chromecast, so switch to OpenHome will be easy.


(Humarf) #48

Hello @MacFly,

this should do without problems. I have a Sony SA-NS 510 hooked to via bubbleupnp server into the openhome world. If you do listen to internet radio with your chromecast custom feature “fakeradio” might be interesting for you to a have comfortable radio interface from openhab.

Best
humarf


(Mac Fly) #49

OHsentinel.py seem to be working like a charm !

I’m struggled ATM with the exec 2 binding… and found no way to install the exec 1 binding from Paperui.

I think I have to adapt your openhab implementation exemple to the exec2 binding with things definition.


(Humarf) #50

I am happy to hear that. Can you give me some details what went wrong with exec 2 binding? I plan to move to openhab2 in near future and would try to get this going.

I the mean time you could try to use OHsentinel’s remote facility to execute commands. What OHcli.py does when sending a command to OHsentinel.py is envoking a post request with the command string starting from positional argument “command” to remote url + cmdport from OHsentinel.conf. A post request could also be send from openhab by using http binding. Maybe this helps.


(Mac Fly) #51

With Exec2 you need to put your exec command in a .things file and declare items linked to it.
This is driving me crazy because of multiple possible point of failure and no logging at all, I will test a little bit further but I’ll probably try the POST method.

thanks you !


(Mac Fly) #52

Hi @humarf,

I tried to control my Sony Bluray Home Theater with your tool but I have a little problem and I think it’s BubbleUpnp Server related, but maybe you could help me :

The goal is to read and control the volume state.
First of all, I add the OpenHome renderer in Bubble Server, configured my device in OHsentinel.conf and register the service :

[OHproduct]
ampliSalon: uuid:f6490414-58a2-ac75-0000-00003a31c666
[ampliSalon]
statevar1: Volume, Volume, SLN_AUDIO

And it works, when I change the volume with my remote, I can see the update in the OHsentinel log (and the openhab Item is update) but when I try to send a volume command with OHcli like this :
./OHcli.py remote -r “command -n ampliSalon Volume -c VolumeInc”

I get this forbidden message :
OHsentinel - DEBUG - Response: <?xml version="1.0" encoding="utf-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>501</errorCode><errorDescription>Current state of service prevents invoking that action. org.fourthline.cling.b.a.c: Current state of service prevents invoking that action. Non-recoverable remote execution failure: 403 Forbidden..</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>

I think it is Bupnp server (openhome?) related issue because I already can set Volume on this device thru the Upnp protocol and a Upnp control point…

Any advice ?

Thanks you.


(Humarf) #53

Sounds weird. Did you set Volume via pure UPNP control point or Openhome enhanced CP?

I have a bubbleUPNPserver upgraded device as well. I can confirm that actions VolumeInc, VolumeDec are working properly via bubble.

bubble server is creating a new openhome device with a new uuid. Are you sure you addressed your command to the openhome device and not to underlying UPNP device? UPNP renderer does not offer a Volume service. It’s done via service RenderingControl.

If this is all configured correctly could you please try to invoke the action via OHcli.py --loglevel=debug command … and send me the log. I could check if it is a OHsentinel related issue.


(Mac Fly) #54

Yes, it works when I use a pure UPNP control point…
I check, on the BD player, UPNP/DLNA control is allowed for everyone, but I found a registered controller list, and as soon as I test sending a command with OHcli.py, I can see the Mac address of my server appear with the Blocked status and of course, it don’t let me allowing it with a weird error message. (I can only delete it).

I got the same error message when I tried to control the BD player with bubble upnp client through open home protocol so it probably not a OHsentinel problem …

Maybe the BD player is locked because of the registered UPNP control point, maybe to prevent multiple controller to fight together … I must try to disable my Upnp controller to see if it change anything and digging a little bit more.

I will also try with loglevel debug to OHcli and report it.

anyway thanks you for your feedback !


(Humarf) #55

That is interesting. From a point of view of an UPNP AV renderer it makes perfectly sense to deny more than one control point. Openhome solves exactly this problem.

Maybe in your description already hides the solution. Bubble server is nothing else than a proxy control point to UPNP AV renderers than can itself be controlled via openhome control point.

If it would be possible to somehow register bubble server as CP to your device it should do.


(Jens Bruhn-Hansel) #56

There is one more possibility to connect openHAB to your DLNA server (I only tested it with Twonky Server). SmartLynx offers (as beta software) a software to connect Twonky with IFTTT, so you can beam a playlist or things like this. You can connect myOpenHAB to IFTTT, too. This works, but it’s far too slow for me.

It you are looking how SmartLynx works, you will find a way to use it without IFTTT, which is much faster. I have now switches in openHAB to start (and stop) playlists and after connecting these switches with Alexa, I can now start a playlist by using Alexa, nice!


(Nolan Garrett) #57

Just adding my $.02, I would like to see a native DLNA binding that allows the use of the discovered DLNA endpoints as audio sinks. Not seeing any non-hackish way to make that work today.


(Markus Storm) #58

+1 !


(Florian Spatz) #59

Hi everyone,

I believe there might be another approach to the challange you are trying to solve. After having multiple years experience with UPNP and DLNA and testing almost any software what is out there I started this year my first steps with OpenHab and Habpanel. Bringing both parts together is also my primary goal.
Currently I’m using Serviio as Server and BubbleUPNP Server to enable Openhome.
The problem is that I don’t want to exit Habpanel and use any kind of DLNA control app.

Now to the possible solution - Serviio has a fanastic Webinterface Mediabrowser which has a fully mobile enabled design and can be integrated in habpanel through iframe. On top of that the developer announced that he will add the “play to” function for playing to any kind of DLNA device.
This would not only solve the Habpanel integration but also remove the need of Bubbleupnp or any similiar Openhome solution as the DLNA Server itself maintains the playlists that are controlable from any endpoint. Also there might be no need left for a native binding.

As said the function is not available in Serviio yet - I tested it with Twonky which already has the functionality but lacks a mobile enabled GUI.

The next release of Serviio is around the corner but we need to convince the developer to add the feature already in the next release. Thus if anyone of you has the same need I request you to add to the serviio forum in order to emphasize the need for that function.

Looking forward to any feedback on the thoughts above or if anyone knows a similiar alternative.

Thanks!


(Florian Spatz) #60

In addition to my last post - feedback from the developer: Vote for it on bitbucket
So everybody that buys into that solution, simply create an account and click vot - it just takes less than 5 minutes and will bring us full UPNP control in Habpanel through Serviio.