Git Product home page Git Product logo

Comments (4)

svrooij avatar svrooij commented on May 29, 2024

The first command tries to execute the SetAVTransportURI command on the sonos device class, which only accepts 1 parameter https://github.com/svrooij/node-sonos-ts/blob/master/src/sonos-device.ts#L410-L413

This isn't the same as the AVTransportService.SetAVTransportURI which accepts your specified parameters

You could call it by using:

{
  "command": "adv-command",
  "input": {
    "cmd": "SetAVTransportURI",
    "val": "x-rincon-mp3radio://http://ice3.somafm.com/groovesalad-64-aac"
  }
}

That results in the same code as with you other command https://github.com/svrooij/sonos2mqtt/blob/master/src/sonos-command-mapping.ts#L70-L71 .

Problem is that the library does some uri encoding, apparently it doesn't do a good job for this url. (the http://... is encoded as http%3a//...), and I just found this is even in the code (the not doing a great job part) https://github.com/svrooij/node-sonos-ts/blob/master/src/helpers/xml-helper.ts#L81-L87

Solution (/workaround)

If you just remove the http:// part from the url the commands start working (if you send the correct payload).

Can you confirm this helps?

from sonos2mqtt.

dgmltn avatar dgmltn commented on May 29, 2024

Yes, this does help! This command appears to work:

{
	"command": "setavtransporturi",
	"input": "x-rincon-mp3radio://ice3.somafm.com/groovesalad-64-aac"
}

Although it seems to choke on the colon again here:

{
	"command": "setavtransporturi",
	"input": "x-rincon-mp3radio://ice3.somafm.com:80/groovesalad-64-aac"
}

Your input to the adv-command works too (after removing the http:// in my stream url). I use the CurrentURIMetaData parameter to set the title of the station. I stuff this ugly chunk of xml into the CurrentURIMetaData parameter in the SetAVTransportURI command:

        <DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
          <item id="R:0/0/49" parentID="R:0/0" restricted="true">
            <dc:title>$title</dc:title>
            <upnp:class>object.item.audioItem.audioBroadcast</upnp:class>
            <desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON65031_</desc>
          </item>
        </DIDL-Lite>

from sonos2mqtt.

svrooij avatar svrooij commented on May 29, 2024

How about (the node-sonos-ts library also has some metadata generation build-in):

{
  "command": "adv-command",
  "input": {
    "cmd": "AVTransportService.SetAVTransportURI",
    "val": {
      "InstanceID": 0,
      "CurrentURI": "x-rincon-mp3radio://ice3.somafm.com/groovesalad-64-aac",
      "CurrentURIMetaData": {
        "Title": "your_title",
        "UpnpClass": "object.item.audioItem.audioBroadcast",
        "ItemId": "R:0/0/49",
        "CdUdn": "SA_RINCON65031_"
    }
  }
}

from sonos2mqtt.

dgmltn avatar dgmltn commented on May 29, 2024

Yes! That worked, and it's so much less ugly too πŸ‘

from sonos2mqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.