Last modified 8 years ago Last modified on 2015-12-28 13:24:29

The DLNA Media Controller plugin for Vera

This plugin is a DLNA Control Point. It can control any DLNA Media Renderer, browse media on any DLNA Media Server and connect a Media Server to a compatible Media Renderer to render media

Installation

What you need

  • Vera with UI5, UI6 (not tested) or UI7
  • At least one DLNA media server and one DLNA Media renderer
  • The UPnP event proxy plugin
  • The DLNA Media Controller plugin

How To (installation from the MiOS Marketplace)

It is the recommended method for installing the plugin. You need at least version 1.1 for UI6 and UI7.

  • Install the UPnP event proxy plugin from the MiOS Marketplace.
  • Install the DLNA Media Controller plugin from the MiOS Marketplace.
  • When installation is done (after the creation of a new device and a reload of the lua engine), refresh your Web browser cache (Ctrl+F5 in most of the browsers) before starting the setup step

How To (manual installation)

It is the installation method required if you don't have access to the MiOS marketplace.

  • Upload the plugin files:
    • Unzip the ZIP archive
    • Use WinSCP ( http://winscp.net/eng/index.php ) to upload certain files:
      • DLNA.png go into /www/cmh/skins/default/icons/
    • In APPS section, open Develop Apps >> Luup Files and upload the following files, check the Restart Luup after upload checkbox and click GO
      • D_DLNAMediaController1.json
      • D_DLNAMediaController1.xml
      • I_DLNAMediaController1.xml
      • J_DLNAMediaController1.js
      • L_DLNATTS.lua
      • L_DLNAUPnPUtility.lua
      • S_DLNAAVTransport1.xml
      • S_DLNAMediaController1.xml
      • S_DLNARenderingControl1.xml

Create a device

If you installed the plugin from the MiOS Marketplace, one device is automatically created. But if you have several media renderers and you want to drive more than one with the Vera, you have to add additional devices in the Vera, one for each media renderer you want to control.

  • Open APPS section; open Develop Apps >> Create Device.
    • In the !Upnp Device Filename input box enter D_DLNAMediaController1.xml.
    • In the Description input box enter a name for the panel device.
    • In the Parent device list box select No parent.
    • Click Create device.
  • Close the popup window that informs you about the creation of a new device, then push the Reload button.
  • When reload is done, refresh your Web browser cache (Ctrl+F5 in most of the browsers)

If you installed the plugin from the Marketplace and you are running UI7, an easier way to create an additional device is the following:

  • Open Apps menu; open My apps sub-menu.
  • Push the Details button in front of your DLNA Media Controller plugin.
  • Push the Create another button.
  • Wait for the automatic reload, then refresh your Web browser cache (Ctrl+F5 in most of the browsers)

Select your media renderer

This step will allow to link a Vera device to a physical media renderer. Note it can be used too to assign the Vera device to a different media renderer. Please note that you must avoid having several Vera devices linked to the same media renderer.

  • Find your new device in the UI,
  • Click on its wrench button,
  • Open the Settings tab,
  • Push the Discover button and wait for few seconds until the selection box is filled and the Select button is enabled again,
  • Select your media renderer in the selection box and then push the Select button,
  • If the automatic discovery is not working (the selection box remains empty), you can enter the URL of your renderer XML description file in the field New URL and then push the Select button,
  • Wait for few seconds for a complete initialiazation

Automatic discovery (UPnP discovery) could require an additional network setup of your Vera Lite, consisting in an update of the routing table of your Vera. Do it only if necessary. You can install and uninstall this patch using the plugin UI:

  • Find your new device in the UI,
  • Click on its wrench button,
  • Open the Settings tab,
  • Push the Install button to install the patch or Uninstall button to uninstall the patch.
  • Wait for the automatic reload.

For technical explanation of what is done by this patch, please read this message: http://forum.micasaverde.com/index.php/topic,16905.msg132502.html#msg132502

Scenes

Making a renderer play a media delivered by a media server

This functionality is exposed declaratively through the PlayDMSMedia action under Advanced Scenes.

Making a renderer say something

The DLNA Media Controller plugin exposes Text to Speech capability through Google's service. The functionality is exposed declaratively through the Say action under Advanced Scenes. The functionality is also exposed programmatically via Lua code.

To play a message, use this lua code:

luup.call_action("urn:dlna-org:serviceId:DLNAMediaController1", "Say",
                 {Text="The sun shines outside", Language="en"},
                 666)

This action will pause the current playback, say the text, and then the playback will be resumed.

Language is either a string of 2 characters, like en, fr ... or a string of 5 characters like en-US, en-GB, fr-FR, fr-CA, ...

To play a message setting the volume for the message at level 60:

luup.call_action("urn:dlna-org:serviceId:DLNAMediaController1", "Say",
                 {Text="The sun shines outside", Language="en", Volume=60},
                 666)

The volume will be adjusted to play the message, and finally restored to its previous level. When the Volume parameter is not used, the volume is not adjusted and the message is played with the current volume.

To play a message using your personal OSX TTS server rather than using Google Internet service:

luup.call_action("urn:dlna-org:serviceId:DLNAMediaController1", "Say",
                 {Text="The sun shines outside", Language="en", Engine="OSX_TTS_SERVER"},
                 666)

Four accepted values for the engine:

  • "GOOGLE" for the Google TTS Internet service
  • "MICROSOFT" for the Microsoft Translator Internet service
  • "OSX_TTS_SERVER" for a personal OSX TTS server
  • "MARY" for a personal MaryTTS server

In addition, the Text to Speech capability can be setup with the following variables (use the TTS tab to adjust the values):

  • DefaultLanguageTTS - default language used when calling the Say action; must be either a string of 2 characters like "en" for example or a string of 5 characters like "en-US" or "en-GB" for example
  • DefaultEngineTTS - default engine used when calling the Say action; must be either GOOGLE, MICROSOFT, OSX_TTS_SERVER or MARY
  • GoogleTTSServerURL - the Google URL to be used
  • OSXTTSServerURL - defines the location of your OSX TTS server; something like http://www.mypersonaltts.org:80
  • MaryTTSServerURL - defines the location of your MaryTTS server; something like http://192.168.0.50:59125 assuming 192.168.0.50 is the IP address of your server running MaryTTS
  • MicrosoftClientId - Client ID you got when you regisered your application on the Microsoft Azure Marketplace
  • MicrosoftClientSecret - Client Secret you got when you regisered your application on the Microsoft Azure Marketplace

Notes:

  • Google service is already not working every time (generally only few times per day) and may be removed at any time
  • Explanations on how to get Microsoft Translator credentials: https://msdn.microsoft.com/en-us/library/mt146806.aspx ; don't forget to get the free 2 Million characters per month subscription; finally set your Client ID and Client Secret in the TTS tab of the plugin (and push the Set button to save)
  • Explanations on how to setup the OSX TTS server: http://wolfpaulus.com/jounal/mac/ttsserver/
  • Parameters not specified will default internally. (Language=en, Engine=GOOGLE, Volume=nil) By default, the volume is not set.

Making a renderer play an alert message

This functionality is exposed declaratively through the Play action under Advanced Scenes. The functionality is also exposed programmatically via Lua code:

luup.call_action("urn:dlna-org:serviceId:DLNAMediaController1", "Play",
                 {URI="...", Duration=15},
                 666)

This action will try to start the playback of a media not necessarily delivered by a media server. URI parameter will be typically a WEB URL (HTTP URL) like for example a MP3 stream. This will not be accepted by all media renderers.

You can choose a protocol using the Protocol parameter to help the media renderer identifying the type of your media. This protocol has to be one supported by the media renderer.

If Duration parameter is set to a greater value than 0, this action will pause the current playback, play the alert, and the previous playback will be resumed when the delay defined by Duration expires. If Duration parameter is unset or set to 0, this action will pause the current playback, play the alert, but then the previous playback will not be resumed.

You can use the optional parameter Volume. The usage is exactly the same as for the Say action.

Notes:

  • Parameters not specified will default internally. (Duration=0, Protocol="", Volume=nil) By default, the volume is not set.

Service Variables

urn:dlna-org:serviceId:DLNAMediaController1

  • BrowseResult - for plugin internal usage
  • CheckStateRate - number of minutes between each automatic online check, "0" to disable the automatic check
  • DebugLogs - "1" when the debug logs are enabled or "0" when disabled
  • DefaultLanguageTTS - default language for TTS, for example "en" or "en-US"
  • DefaultEngineTTS - default engine for TTS, either "GOOGLE" or "MICROSOFT" or "OSX_TTS_SERVER" or "MARY"
  • DelayBeforePlayback -
  • DescriptionURL - description URL for the media renderer
  • DiscoveryPatchInstalled - "1" when the !UPnP discovery patch is installed or "0" when not installed
  • DMRDiscoveryResult - for plugin internal usage
  • DMSDiscoveryResult - for plugin internal usage
  • GoogleTTSServerURL - the Google URL to be used for TTS
  • MaryTTSServerURL - URL of the MaryTTS server
  • MaxVolume - maximum volume handled by the media renderer
  • MicrosoftClientId - Client ID you got when you regisered your application on the Microsoft Azure Marketplace
  • MicrosoftClientSecret - Client Secret you got when you regisered your application on the Microsoft Azure Marketplace
  • MinVolume - minimum volume handled by the media renderer
  • ModelName - model of the media renderer
  • Online - "1" when the media renderer is online or "0" when it is offline
  • OSXTTSServerURL - URL of the TTS server
  • PlaybackResult - for plugin internal usage
  • PluginVersion - plugin version
  • ProxyUsed - "proxy is in use" or "proxy is not in use" to indicate if the UPnP event proxy is in use
  • RouterIp - router/firewall IP when the media renderer can access the Vera only with a port forwarding rule
  • RouterPort - router/firewall port when the media renderer can access the Vera only with a port forwarding rule

urn:upnp-org:serviceId:AVTransport

  • AVTransportURI -
  • AVTransportURIMetaData -
  • CurrentAlbum -
  • CurrentAlbumArt -
  • CurrentAlbumArt2 -
  • CurrentArtist -
  • CurrentMediaDuration -
  • CurrentPlayMode -
  • CurrentStatus -
  • CurrentTitle -
  • CurrentTrack -
  • CurrentTrackDuration -
  • CurrentTrackMetaData -
  • CurrentTrackURI -
  • CurrentTransportActions -
  • NumberOfTracks -
  • RelativeTimePosition
  • TransportPlaySpeed - not updated when the UPnP event proxy is used
  • TransportState -
  • TransportStatus -

urn:upnp-org:serviceId:ConnectionManager

  • SinkProtocolInfo -

urn:upnp-org:serviceId:RenderingControl

  • Mute - "1" if volume muted or "0" if unmuted
  • Volume - volume value, range depends on the media renderer