DLNA / UPNP binding

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

@5iver I have been doing some more work on the binding. I hope you have not done too much yet. I even created a README. So, apart from further testing and some cleanup, it may actually be getting close enough to a state that can be submitted.
The main changes are all in browsing through the content directory on the media server. I have done away with the switch items to submit something and have it command straight from the browse or search.
I pushed it all to my github, but need some more time to test if all still works.
I would be OK to submit this if you have not advanced too much yet. But I would be looking for further help to maintain this binding.

Fantastic!

No worries… the maintainers are doing a very consistent job of ignoring me and my imy ideas for automation… including my PRs, so I have pretty much given up on OH development ATM and have been spending my time in the garden.

That is good news! If you get it submitted, I am sure there will be a LOT of interest and support. I’m glad it is moving forward and not withered on the vine! If you need to step away, I will definitely help out.

Your work is highly valued by me and many others. I have been tracking your PR’s and I understand the frustration. You are touching an area that does not fit in the standard pattern yet, and it always takes a very long time to come to a conclusion for the key decisions with openHAB maintainers, if one is ever reached at all. I still believe it will progress eventually, but I expect to see that rather towards 3.0.0 than 2.5.x. Don’t walk away from it on your side please.

While working on this binding, I ran into issues that only can be resolved in the core or UI’s. Again, core developers are aware of many of these, but it will not be fully resolved before 3.0.0. Specifically, issues I have are:

  • The ability to dynamically refresh DynamicStateOptionList and DynamicCommandOptionList objects in the UI’s. See openhab/openhab-core#1505 and openhab/openhab-addons#7396 (comment). This is key if you want a UI that is able to browse through the content hierarchy.
  • There is no text input field possibility in BasicUI. This would be useful to be able to put in a textual search string to search the content directory. There is some workaround using a Webview element here, but it comes with its challenges. See also openhab/openhab-webui#274.

In the mean time, enjoy gardening.

1 Like

I have created a pull request to get this part of the official distribution sometime.

1 Like

Hey there,
I use the binding for About one year now and really like it. But I also have the issue that sometimes the playStream wont start and it has to be send a second or third time. Is this fix applied in the latest binding version 2.5.6 or has it to be done in my dsl Code?

BTW: If you neet someone to test your binding and give a Feedback, I am happy to help.

Thanks and Greetings Andy

@Mherwege, I figured it was best to get the discussion out of the merged PR (wahoo!!!) and over to the forum :slightly_smiling_face:. It’ll hopefully stir up some testers too!

Mute

This was my concern… all I saw for the description was LF/RF Volume.

The label is abreviated, the description in the channel type definition is not.

This is what I was referring to. IMO, the Channel name is fine, but it wold be better to have a more descriptive label…

In testing the latest from your fork in Basic UI, Mute seems to behave differently than the previous version, but the Item still does not reflect the current state of the speaker. I know they are different, but Stop is also not updating correctly. Both can still be controlled by toggling the switch though, so both still seem to be functional.

Media Server

Having to refresh is unfortunate, because this is such awesome functionality! The only issue I have come across is that sometimes the command to navigate up the tree does not do anything. I’ve gotten it unstuck by navigating down and then up again. I’ve only seen this in the UI, but I suspect it is happening in my rule below too, since sometimes nothing plays. This is what was causing me trouble earlier.

Feature Requests

  1. How about a control Channel for the selected renderer? This could make the UI experience a little easier. At least, it would have been helpful while testing!
  2. You can navigate up by using ‘–’, but an option to go all the way to the top/root would be nice. Maybe three or four (’—’, ‘----’)?

Example Script

Here is a Jython script that I used to navigate to a playlist. I have not yet found a way to randomize the playback without reading through the StateOptions, but I’m still searching. IIRC, there is a way to do it… maybe in the sort. The sleeps are necessary, so it looks like waiting for a response would be helpful. Also, I know some renderers do not behave when sent multiple requests quickly, so a configuration value to wait between sends would be would be useful for some people, and might also eliminate the need to wait for a response, but a queue would need to be implemented.

Random thought… a long time, I used SmartThings. There was a community submitted for controlling UPnP. There may be some interesting bits in there.

from time import sleep
from core.log import logging, LOG_PREFIX#, log_traceback

LOG = logging.getLogger("{}.TEST_3".format(LOG_PREFIX))

LOG.warn("Start")
#events.sendCommand("Twonky_Renderer", "upnpcontrol:upnprenderer:5f9ec1b3-ed59-1900-4530-0007f522dcaf")
events.sendCommand("DS_FamilyRoom_Speaker_Stop", "ON")

# selected playlist
events.sendCommand("Twonky_Browse", "--")
sleep(0.25)
# selection of playlists
events.sendCommand("Twonky_Browse", "--")
sleep(0.25)
# Artist Index, Artist/Album, By Folder, Genre/Artist/Album, Playlists
events.sendCommand("Twonky_Browse", "--")
sleep(0.25)
# Music, Photos, Videos

LOG.warn("BEFORE: Twonky_Search_Criteria: {}, Twonky_Browse: {}, Twonky_ID: {}".format(items["Twonky_Search_Criteria"], items["Twonky_Browse"], items["Twonky_ID"]))

#events.sendCommand("Twonky_Search_Criteria", 'dc:title = "5" and upnp:class = "object.container.playlistContainer"')
events.sendCommand("Twonky_Search_Criteria", 'dc:title = "_Wake up!" and upnp:class = "object.container.playlistContainer"')

sleep(0.25)
LOG.warn("AFTER SEARCH: Twonky_Search_Criteria: {}, Twonky_Browse: {}, Twonky_ID: {}".format(items["Twonky_Search_Criteria"], items["Twonky_Browse"], items["Twonky_ID"]))
events.sendCommand("Twonky_Browse", items["Twonky_ID"].toString())

sleep(0.25)
LOG.warn("AFTER BROWSE: Twonky_Search_Criteria: {}, Twonky_Browse: {}, Twonky_ID: {}".format(items["Twonky_Search_Criteria"], items["Twonky_Browse"], items["Twonky_ID"]))

events.sendCommand("DS_FamilyRoom_Speaker_Player", "PLAY")
LOG.warn("End")

Note where I update the Browse Item to the ID Item. Is this possibly a bug?

That should be better now in the development version on my github. I now create these extra channels dynamically, after checking if they exist in the renderer, and use a lookup table for meaningful names.

It’s probably worth testing again with the latest code. It works for me in my test environment.

Stop is not expected to update when the player is stopped from the renderer. But the control should change from play to pause. Is that also not working?

It would be nice to see debug logs when this is happening.

Could indeed be useful to provide a minimal renderer control channel on the server thing. That will require some coding.

Did you try putting 0 in the “currentid” channel? That should always be the top of the tree.

Indeed, waiting for a response before doing a next browse makes a lot of sense. I will see if I can put that in. Creating a queue is a lot more effort, so let’s see if waiting for a response is sufficient.

Could be, but the result is in the log I don’t see. Could you add the log?

@5iver I have done some work, but didn’t test it yet. The code is on github.

Implemented.

Implemented.

I don’t think it is possible in the sort criteria. I may have to implement that in the binding. It would then also be useful to add a continuous play mode, because in its current state, the playing stops at the end of the queue. It would allow restarting.

Another thing on my wishlist is to implement a notification action, that would interrupt and resume the current playing audio. Not sure it that will be easy to do.

By the way, I see – (2 dashes) in your commands in the script to go up the tree. I implemented that to be … (2 dots). Does that work?

I usually skip checks and tests when I build, but I didn’t the first time and CAT complained about spaces rather than tabs in the things-types.xml. The dynamic Channels for the UPnPRenderer work properly… at least they are not being created when they aren’t supported. Mute is working perfectly!

UPnPServer Channels
The added Channels for the UPnPServer are great! They work properly, but Player and Stop are not updating in the UI. This was while music was not playing and after a refresh…

UPnPServer channels.log (6.7 KB)

… but the Items for the renderer were displayed correctly. Possibly related… when the Renderer is changed, I would expect that the Items would get updated, but this does not appear to be happening.

STOP
I understand Stop better now. The renderers already had states assigned for Stop and the binding is not updating the states.

image

Is the intention to configure the Stop Items with autoupdate=“false”? The trouble with this is that the Alexa skill does not work with Items that have this setting. At least, it didn’t at some point and I am not aware of it changing.

PAUSE
My renderer does not support Pause for the type of media I was using. I’d need to double check, but I don’t think they support pause at all, even though the CurrentTransportActions show Pause as valid. After selecting Pause, the song still plays and the Player Item stays PAUSE. The same occurs with another control point. BTW, I have tried many of them and this is by far the best.

2020-08-19 15:12:36.587 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpRendererHandler] - Handle command PAUSE for channel upnpcontrol:upnprenderer:5f9ec1b3-ed59-1900-4530-0007f522dcaf:control on renderer Family Room
2020-08-19 15:12:36.596 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpHandler] - Upnp device Family Room invoke upnp action Pause on service AVTransport with inputs {InstanceID=0}
2020-08-19 15:12:36.597 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpHandler] - Upnp device Family Room invoke upnp action Pause on service AVTransport reply {}

Since I don’t think it can be disabled in the wdiget, I think it would be best to check the TransportState if there is no response to Pause. Is this already done if there is no response to Play?

BROWSE
After a selection is made, the title of the current selection appears. After refreshing, the ID appears, which is different than what is displayed by currentid. Is Browse supposed to display the title of the ID?

Before refresh…


After refresh…

SEARCH

Running this…

from time import sleep

from core.log import logging, LOG_PREFIX#, log_traceback
LOG = logging.getLogger("{}.TEST_3".format(LOG_PREFIX))

LOG.warn("START: Twonky_Search_Criteria: {}, Twonky_Browse: {}, Twonky_ID: {}".format(items["Twonky_Search_Criteria"], items["Twonky_Browse"], items["Twonky_ID"]))

# selected playlist
events.sendCommand("Twonky_Browse", "..")
sleep(0.25)
# selection of playlists
events.sendCommand("Twonky_Browse", "..")
sleep(0.25)
# Artist Index, Artist/Album, By Folder, Genre/Artist/Album, Playlists
events.sendCommand("Twonky_Browse", "..")
sleep(0.25)
# Music, Photos, Videos

LOG.warn("BEFORE: Twonky_Search_Criteria: {}, Twonky_Browse: {}, Twonky_ID: {}".format(items["Twonky_Search_Criteria"], items["Twonky_Browse"], items["Twonky_ID"]))

if items["Twonky_Search_Criteria"].toString() == 'dc:title = "5" and upnp:class = "object.container.playlistContainer"':
    events.sendCommand("Twonky_Search_Criteria", 'dc:title = "_Wake up!" and upnp:class = "object.container.playlistContainer"')
else:
    events.sendCommand("Twonky_Search_Criteria", 'dc:title = "5" and upnp:class = "object.container.playlistContainer"')

sleep(0.25)
LOG.warn("AFTER SEARCH: Twonky_Search_Criteria: {}, Twonky_Browse: {}, Twonky_ID: {}".format(items["Twonky_Search_Criteria"], items["Twonky_Browse"], items["Twonky_ID"]))

… the binding logs this…
Search.log (23.8 KB)

… and the script logs this…

2020-08-19 18:22:02.613 [WARN ] [jython.TEST_3] - START: Twonky_Search_Criteria: dc:title = "5" and upnp:class = "object.container.playlistContainer", Twonky_Browse: .., Twonky_ID: 0$1$9$154574
2020-08-19 18:22:02.865 [WARN ] [jython.TEST_3] - BEFORE: Twonky_Search_Criteria: dc:title = "5" and upnp:class = "object.container.playlistContainer", Twonky_Browse: .., Twonky_ID: 0$1
2020-08-19 18:22:03.116 [WARN ] [jython.TEST_3] - AFTER SEARCH: Twonky_Search_Criteria: dc:title = "_Wake up!" and upnp:class = "object.container.playlistContainer", Twonky_Browse: .., Twonky_ID: 0$1$9$154597

The Browse Item is not updated, but the CurrentID is. I need to manually update the Browse Item with the CurrentID Item in order to play the search result. If I run this and go to Basic UI, the BrowseStateDescription is populated…

… and I can make a selection to populate Browse and then hit Play. What I’d like, is to Search and have Browse populated, so that I can just hit Play. Or maybe Play could start on it’s own after a successful search. If implemented, all you’d need is to set the state of Search to play a playlist.

I do something similar using scripts to play an alarm in the morning, play random streams when someone closes the bathroom door, play random sound effects based on the holiday when any motion or door sensor is triggered (awesome for Halloween!), etc.

Playlist stops
When playing a playlist, the music sometimes just stops…
playlist stops.log (15.8 KB)

I haven’t seen this again, possibly due to the wait for prevous browse request.

Back when I used SmartThings, one of the only good things about it was this app. There may be some functionality in it that could be implement here. There is a GH link at the bottom of the OP…

Yes, two periods works!

I spent a lot of time researching it a couple years ago and don’t recall the outcome. In the back of my head, I think I remember an update to the specificaltion for it, but my media server at the time did not support it. I’ll look into this.

I thought currentid was a read-only Channel! I tried this and there was a message about an invalid target, but it seemed to work…

2020-08-19 19:05:00.517 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Handle command 0 for channel upnpcontrol:upnpserver:55076f6e-6b79-1d65-a4eb-00089bd0e8f2:currentid on server TwonkyMedia [NAS01]
2020-08-19 19:05:00.517 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Setting currentId to 0
2020-08-19 19:05:00.517 [INFO ] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Trying to browse invalid target 0
2020-08-19 19:05:00.517 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Browse target 0
2020-08-19 19:05:00.559 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpHandler] - Upnp device TwonkyMedia [NAS01] invoke upnp action Browse on service ContentDirectory with inputs {SortCriteria=+dc:title, ObjectID=0, Filter=*, BrowseFlag=BrowseDirectChildren, RequestedCount=0, StartingIndex=0}
2020-08-19 19:05:00.559 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpHandler] - Upnp device TwonkyMedia [NAS01] invoke upnp action Browse on service ContentDirectory reply {TotalMatches=3, UpdateID=1563, NumberReturned=3, Result=<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:arib="urn:schemas-arib-or-jp:elements-1-0/" xmlns:dtcp="urn:schemas-dtcp-com:metadata-1-0/" xmlns:pv="http://www.pv.com/pvns/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><container id="0$1" parentID="0" restricted="1" childCount="5" searchable="1" pv:persistentID="music"><dc:title>Music</dc:title><pv:childCountContainer>5</pv:childCountContainer><pv:modificationTime>79979</pv:modificationTime><pv:containerContent>object.item.audioItem.musicTrack</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$2" parentID="0" restricted="1" childCount="2" searchable="1" pv:persistentID="picture"><dc:title>Photos</dc:title><pv:childCountContainer>2</pv:childCountContainer><pv:modificationTime>2403237</pv:modificationTime><pv:containerContent>object.item.imageItem.photo</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$3" parentID="0" restricted="1" childCount="3" searchable="1" pv:persistentID="video"><dc:title>Videos</dc:title><pv:childCountContainer>3</pv:childCountContainer><pv:modificationTime>2017121042</pv:modificationTime><pv:containerContent>object.item.videoItem.movie</pv:containerContent><upnp:class>object.container</upnp:class></container></DIDL-Lite>}
2020-08-19 19:05:00.559 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable TotalMatches with value 3 from service ContentDirectory
2020-08-19 19:05:00.559 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable UpdateID with value 1563 from service ContentDirectory
2020-08-19 19:05:00.559 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable NumberReturned with value 3 from service ContentDirectory
2020-08-19 19:05:00.559 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable Result with value <DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:arib="urn:schemas-arib-or-jp:elements-1-0/" xmlns:dtcp="urn:schemas-dtcp-com:metadata-1-0/" xmlns:pv="http://www.pv.com/pvns/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><container id="0$1" parentID="0" restricted="1" childCount="5" searchable="1" pv:persistentID="music"><dc:title>Music</dc:title><pv:childCountContainer>5</pv:childCountContainer><pv:modificationTime>79979</pv:modificationTime><pv:containerContent>object.item.audioItem.musicTrack</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$2" parentID="0" restricted="1" childCount="2" searchable="1" pv:persistentID="picture"><dc:title>Photos</dc:title><pv:childCountContainer>2</pv:childCountContainer><pv:modificationTime>2403237</pv:modificationTime><pv:containerContent>object.item.imageItem.photo</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$3" parentID="0" restricted="1" childCount="3" searchable="1" pv:persistentID="video"><dc:title>Videos</dc:title><pv:childCountContainer>3</pv:childCountContainer><pv:modificationTime>2017121042</pv:modificationTime><pv:containerContent>object.item.videoItem.movie</pv:containerContent><upnp:class>object.container</upnp:class></container></DIDL-Lite> from service ContentDirectory
2020-08-19 19:05:00.561 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Navigating to node 0 on server TwonkyMedia [NAS01]
2020-08-19 19:05:00.561 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Filtering content on server TwonkyMedia [NAS01]: false
2020-08-19 19:05:00.561 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - 3 entries added to selection list on server TwonkyMedia [NAS01]
2020-08-19 19:05:00.561 [DEBUG] [org.openhab.binding.upnpcontrol.internal.UpnpDynamicCommandDescriptionProvider] - Adding command description for channel upnpcontrol:upnpserver:55076f6e-6b79-1d65-a4eb-00089bd0e8f2:browse
2020-08-19 19:05:00.561 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Raw result list [Music, Photos, Videos]
2020-08-19 19:05:00.561 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Filtered result list []
2020-08-19 19:05:00.561 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Nothing to serve from server TwonkyMedia [NAS01] to renderer Family Room
2020-08-19 19:05:00.563 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpHandler] - Upnp device TwonkyMedia [NAS01] invoke upnp action Browse on service ContentDirectory with inputs {SortCriteria=+dc:title, ObjectID=0, Filter=*, BrowseFlag=BrowseDirectChildren, RequestedCount=0, StartingIndex=0}
2020-08-19 19:05:00.563 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpHandler] - Upnp device TwonkyMedia [NAS01] invoke upnp action Browse on service ContentDirectory reply {TotalMatches=3, UpdateID=1563, NumberReturned=3, Result=<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:arib="urn:schemas-arib-or-jp:elements-1-0/" xmlns:dtcp="urn:schemas-dtcp-com:metadata-1-0/" xmlns:pv="http://www.pv.com/pvns/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><container id="0$1" parentID="0" restricted="1" childCount="5" searchable="1" pv:persistentID="music"><dc:title>Music</dc:title><pv:childCountContainer>5</pv:childCountContainer><pv:modificationTime>79979</pv:modificationTime><pv:containerContent>object.item.audioItem.musicTrack</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$2" parentID="0" restricted="1" childCount="2" searchable="1" pv:persistentID="picture"><dc:title>Photos</dc:title><pv:childCountContainer>2</pv:childCountContainer><pv:modificationTime>2403237</pv:modificationTime><pv:containerContent>object.item.imageItem.photo</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$3" parentID="0" restricted="1" childCount="3" searchable="1" pv:persistentID="video"><dc:title>Videos</dc:title><pv:childCountContainer>3</pv:childCountContainer><pv:modificationTime>2017121042</pv:modificationTime><pv:containerContent>object.item.videoItem.movie</pv:containerContent><upnp:class>object.container</upnp:class></container></DIDL-Lite>}
2020-08-19 19:05:00.563 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable TotalMatches with value 3 from service ContentDirectory
2020-08-19 19:05:00.563 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable UpdateID with value 1563 from service ContentDirectory
2020-08-19 19:05:00.563 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable NumberReturned with value 3 from service ContentDirectory
2020-08-19 19:05:00.563 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Upnp device TwonkyMedia [NAS01] received variable Result with value <DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:arib="urn:schemas-arib-or-jp:elements-1-0/" xmlns:dtcp="urn:schemas-dtcp-com:metadata-1-0/" xmlns:pv="http://www.pv.com/pvns/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><container id="0$1" parentID="0" restricted="1" childCount="5" searchable="1" pv:persistentID="music"><dc:title>Music</dc:title><pv:childCountContainer>5</pv:childCountContainer><pv:modificationTime>79979</pv:modificationTime><pv:containerContent>object.item.audioItem.musicTrack</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$2" parentID="0" restricted="1" childCount="2" searchable="1" pv:persistentID="picture"><dc:title>Photos</dc:title><pv:childCountContainer>2</pv:childCountContainer><pv:modificationTime>2403237</pv:modificationTime><pv:containerContent>object.item.imageItem.photo</pv:containerContent><upnp:class>object.container</upnp:class></container><container id="0$3" parentID="0" restricted="1" childCount="3" searchable="1" pv:persistentID="video"><dc:title>Videos</dc:title><pv:childCountContainer>3</pv:childCountContainer><pv:modificationTime>2017121042</pv:modificationTime><pv:containerContent>object.item.videoItem.movie</pv:containerContent><upnp:class>object.container</upnp:class></container></DIDL-Lite> from service ContentDirectory
2020-08-19 19:05:00.564 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Navigating to node 0 on server TwonkyMedia [NAS01]
2020-08-19 19:05:00.564 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Filtering content on server TwonkyMedia [NAS01]: false
2020-08-19 19:05:00.564 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - 3 entries added to selection list on server TwonkyMedia [NAS01]
2020-08-19 19:05:00.564 [DEBUG] [org.openhab.binding.upnpcontrol.internal.UpnpDynamicCommandDescriptionProvider] - Adding command description for channel upnpcontrol:upnpserver:55076f6e-6b79-1d65-a4eb-00089bd0e8f2:browse
2020-08-19 19:05:00.564 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Raw result list [Music, Photos, Videos]
2020-08-19 19:05:00.565 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Filtered result list []
2020-08-19 19:05:00.565 [DEBUG] [org.openhab.binding.upnpcontrol.internal.handler.UpnpServerHandler] - Nothing to serve from server TwonkyMedia [NAS01] to renderer Family Room

I had planned to open GH issues, but you’re fixing so quickly. I’ll report here for now, unless you’d prefer them in GH.

After playing with it some more, sending 0 to currentid is not working. Actually, I had browsing hang up on me a couple times after using it…

stopped browsing.log (32.7 KB)

That’s a problem. The channel definition for stop includes autoupdate=veto, which means it will always have autoupdate=false for the item. That’s what makes most logical sense in a UI, as stop does not have a state, but is a command. Alternatively, I need to build in a lot of logic to maintain a proper state for it. I don’t use Alexa. Is this still a problem? If Alexa just sends commands to an item, it wouldn’t know about this autoupdate policy flag. What makes it different?

Looking at the log, there is a check if the URI has been set before starting to play. The timeout is 2.5s on that. The URI is set after the message it was missing according to the log (but the message was less than 2.5s before setting). I added a log statement to see the exact cause.

I changed some things on that. I hope it works well now.

Another issue, but should be solved.

The state should revert to Play 2.5s after setting pause if no PAUSE_PLAYBACK or STOP is received.

Not sure about this one. I haven’t seen it in PaperUI. This is a command option, so refresh should not do anything to the list. I made a change, so check how it behaves.

I believe I have fixed this.

1 Like

True, but I opted for consistency with the browse channel. When browsing, you may be going up and down the tree, and only start playing when you are at the right level. Otherwise, players would continuously receive new queues. I understand that could be shortcut with search, but I think it is worth keeping things consistent.

Search is not exactly where I want it to be yet. I need some more time refining.

1 Like

Info was starting to get lost here, so I opened an issue to track it better…

You got my speakers to pause! The states seem better, but I am getting a lot of timeouts (see GH issue), so hard to test. Should pressing pause twice pause then unpause, or do you need to press Play to unpause?

No change for Basic UI…

Paper UI displays the options.

Yes, this is working now… thank you!

Looks good, except for the Player, which looks to be UNDEF after changing the renderer.

I would need a log here. It is supposed to refresh the status, and will only put it to UNDEF if it does not receive anything. I have multiple servers, but only on renderer in my test setup, so difficult to test with this setup at the moment.

I believe you should press play to unpause. In PaperUI, the control only shows one button for play/pause that changes image depending on the state.

I am wondering if this has something to do with this: PR #217. Support for command options seems to be early days.

Browse has no state, so it actually should not show anything, except the possibility to select from a list. When selecting, it will browse on that entry. The options list in browse is what is supposed to be played. The CurrentId contains the parent of the first entry in the list.

I did discover a bug with search (error in filtering duplicate entries resulting in an empty list). This should make search work better, but probably not perfect yet.
If you search on a container, the result in browse will be a container. You will still have to go down in the browse on that container to get the content in the option list to be able to play. If you search on individual objects, you should see these directly in the browse option list, and that is also what will play.