Integrate UPnP/DLNA devices into your KNX system with ayControl
In this article, we will show you how to integrate UPnP/DLNA compatible devices with the new functions of ayControl KNX + IoT.
Currently, ayControl KNX + IoT can control every UPnP/DLNA compatible device which is a media renderer (urn:schemas-upnp-org:device:MediaRenderer:1). Nearly all modern TVs, Receivers, Consoles, Media servers, Speakers and other media devices have this capability.
In just a few steps, you will be able to control your UPnP/DLNA compatible devices and use them in EcoButler automation rules. Features include basic playback control (play, pause, stop, next, …), audio control (volume, mute) and media control (music, movies, internet radio streams, …). More features and vendor specific services are coming soon!
If you have any problems during configuration, please refer to the Troubleshooting section at the bottom of this article!
Creating the UPNP connection and control media renderers
- Create a new IoT connection in the ayControl Editor and select “UPnP/DLNA device (MediaRenderer)” from the list.
- After clicking OK, you can name your connection. e.g. “Speaker Bathroom”
- To identify and locate the device you want to control, ayControl uses its UPnP UUID (Universally Unique Identifier). The ayControl Editor will soon feature a UPnP browser which conveniently shows you the names of your devices and their UUIDs, but until then, you need to use one of the various other possibilities to find the UUID of your device (See below for Windows/macOS instructions).
- You can find the UUID in the USN string of the device, e.g. “USN: uuid:00113208-fd83-0011-83fd-83fd08321100::urn:schemas-upnp-org:device:MediaRenderer:1″. Please only copy the raw UUID into the field in the ayControl Editor, in our example “00113208-fd83-0011-83fd-83fd08321100″, and finish.
Your UPnP/DLNA media renderer connection is now ready to use, basic controls should work!
UUID Discovery on Windows
On Windows, discovery is done with a small tool like the “UPnP Tester”.
- Download and open UPnP Tester (32 or 64 bit)
- Follow the on-screen instructions
- Select “Media Renderers” in the top left dropdow menu
- Right click on the device you want to control and select “Properties”
- You can now copy the USN string, which includes the UUID
UUID Discovery on macOS
On macOS, discovery is done with the Homebrew package gupnp-tools.
- Open a Terminal and install Homebrew
- Install the UPnP discovery tool
brew install gupnp-tools
- Run the UPnP discovery tool and search for media renderers
gssdp-discover -t urn:schemas-upnp-org:device:MediaRenderer:1
- You now get a list of all discovered media renderers and their USN, which includes the UUID. Identify the device you want to control by its IP address.
Play video/audio/images on a media renderer
You can command your UPnP media renderer to play any media file accessible from the network. In ayControl, this is done via the “Set Media URI” address, which accepts the URI to a video/audio/stream file.
- Create a new button control element with the write target “Set Media URI”
- Find the URI/location of the media file you want to play. This can either be a file from the internet, something in your local network or a file stored on the media renderer itself. You can find some examples below.
- Put the URI into the value field of the button action and finish. Make sure it’s the full URI, including the protocol and that you have enclosed it in quotation marks. (e.g. “https://somewebradio.org/stream.mp3″)
Now, the media can be set by pressing the button or using it in the EcoButler.
Examples for media URIs
Some example URIs to use with a media renderer. Internet examples work, use them for testing purposes.
- Internet: “https://br-b5aktuell-live.cast.addradio.de/br/b5aktuell/live/mp3/128/stream.mp3″, “https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4″
- Network: “https://192.168.1.20/images/holiday/34647.jpeg”, “https://mediaserver.local/movies/somemovie.mp4″
- Local: “file:///media/music/sometrack.mp3″, “file:///media/movies/somemovie.mp4″
Q: Why am I unable to find the device I want to control?
A: Make sure the computer you use to discover is in the same network as the device you want to control and that the device is turned on. If it still cannot be found, the device may not be capable of media rendering and cannot be used.
Q: Why does setting the media URI fail?
A: If the media renderer is playing something else when setting the URI, it will refuse to play the new media. You first have to send a Stop command, then set the media and then send a Play command again.
Q: Why does the media renderer refuse to play my media URI?
A: Check if the media file is accessible (e.g. in your Browser) and playable on other devices. If it is, chances are that the selected media renderer doesn’t support the file format. Due to the fact that there are loads of different UPnP/DLNA compatible devices from different manufactures out there, not all can play the same video/audio/image formats.
Q: Why does the volume slider only work partially?
A: By default, it is configured to slide between a range of 0 to 100 (most UPnP media renderers). Some devices can have a different volume range, e.g. 0-15, please adjust the slider control element accordingly.