Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    JDogg016
    @JDogg016
    First off... awesome app as this provides a really easy way to automate speaker groupings. I had a question though: is there a way for the API to notify me when speakers become ungrouped? More specifically, I have two Sonos speakers in my kitchen and from time to time they become ungrouped. Now I don't care whether I add 10 other speakers to that group, but I want to know when the two kitchen speakers become ungrouped.
    Jimmy Shimizu
    @jishi
    @JDogg016 it might be feasible either with some custom code, but it sort of depends how your grouping looks like. I guess you could always check if kitchen one is grouped with kitchen two, or vice versa, or both kitchen one and kitchen two is grouped to any other speaker, but still the same speaker.
    PaulRBoon
    @PaulRBoon

    Hi...first Can i say excellent app got it all up and running straight away for my smart home/automation setup... i am now in the process of utilizing the live backend server on my pc setup by linking it up with my elgato stream decks that are connected to my windows PC and raspberry PI. on my PC i have a Sonos Beam as my main PC speaker via its digital Spdif output. for controlling the music (favorites/playlists) everything works great) however is there away to get the server to change the source input of a zone to the TV .. As in the actual default source for a playbar or Beam. when i bring the zones and look at the returned json results the currentTrack is listed as follows

    "currentTrack": {
    "duration": 0,
    "uri": "x-sonos-htastream:RINCON_949F3ED240B801400:spdif",
    "trackUri": "x-sonos-htastream:RINCON_949F3ED240B801400:spdif",
    "type": "line_in",
    "stationName": ""}

    I did notice that the linein option is only the analog linein found on the play:5 connectAmp etc and know your probably busy doing other stuff so was wondering if there was a way i could help in getting this feature added in etc

    PaulRBoon
    @PaulRBoon

    HI.. an update to above comment on the optical input of the playbar/beam i have solved the issue for my own server by editing the code in the linein.js action and if the player name happens to match any of the three sourcePlayerName in my house that have either playbars or sonos beams then to change const uri to match that particular players default stream uri.

    it seams for the optical/TV input the uri starts 'x-sonos-htastream:' and ends with ':spdif'

    PaulRBoon
    @PaulRBoon
    second update i have added an new 'tv' action to my own setup that works the same way as the linein action but works with the digital optical or hdmi inputs from a Playbar or Beam controller.. i used tv as the action name as that is the audio source name that sonos themselves use within their own apps/software.
    Jimmy Shimizu
    @jishi
    @PaulRBoon yeah, I wanted the line-in to be device agnostic, and sense what kind of connection it has. The players event the state of the line in, which does tell you what kind of line in it is. I just haven't gotten around to fix it, because there is a way around it by just using the setavtransport action and give it that x-sonos-htastream uri.
    Martin
    @martin072
    Hi Jimmy, First of all many thanks for this briljant API. I just received my sonos stuff and having a play with it now. What I was wondering is if it would be possible to send a HTTP request to play a uri? Lets say the status message gives me this uri that is playing.
    "trackUri": "x-sonos-spotify:spotify%3atrack%3a6716bTJI7qiHJFFSR0Ethe?sid=9&flags=8224&sn=1", would it be possible tell sonos to play this from a http get request?
    Jimmy Shimizu
    @jishi
    @martin072 You need both the uri and the metadata to successfully queue a url, but there is no "generic" queueing function for arbitrary URL and metadata available, because it was easier to make specialized actions for music services (since I didn't anticipate you would restore playback like that).
    In your case, you can always use /room/spotify/now/spotify:track:6716bTJI7qiHJFFSR0Ethe because it will figure out what to put as metadata and URI from that (for example, if you used spotify web api or copied a link from the spotify client)
    Martin
    @martin072
    Ok. Thanks. What I was looking for is to save whatever is playing (Spotify, radio etc) and save it, then play something else and after that return to whatever was playing. That is why the uri would be the easiest to use ;)
    Martin
    @martin072
    your example is fine if Spotify is the only music source to use, but I use multiple like tunein, stingray etc. I know tunein and spotify are supported in the api, but I was just wondering if there was a way to send back the uri from the status message so it can resume playing again.
    Jimmy Shimizu
    @jishi
    @martin072 Not at the moment. Preferably it would help to have like a "preset snapshot" that you can feed back into the preset action. Then you can take the snapshot, do whatever you want for as long as you want, then just restore the snapshot. I already use it like that internally for the TTS, but it isn't built to be exposed as an http call, so it requires some re-engineering.
    Sean Phelan
    @Nerdvana2
    Hi Jimmy - let me start by adding my thanks to the long list above :) I've just installed and configured (on a Pi 2); most features are fine but I can't get 'clip' working.... I consistently get the following errors:
    2019-02-02T13:32:11.433Z ERROR
    TypeError: Buffer.alloc is not a function
    at FileTokenizer.AbstractTokenizer (/home/sean/node-sonos-http-api-master/node_modules/strtok3/lib/AbstractTokenizer.js:7:33)
    at new FileTokenizer (/home/sean/node-sonos-http-api-master/node_modules/strtok3/lib/FileTokenizer.js:23:28)
    at /home/sean/node-sonos-http-api-master/node_modules/strtok3/lib/index.js:38:24
    at tryCatch (/home/sean/node-sonos-http-api-master/node_modules/es6-promise/dist/es6-promise.js:409:12)
    at invokeCallback (/home/sean/node-sonos-http-api-master/node_modules/es6-promise/dist/es6-promise.js:424:13)
    at publish (/home/sean/node-sonos-http-api-master/node_modules/es6-promise/dist/es6-promise.js:398:7)
    at flush (/home/sean/node-sonos-http-api-master/node_modules/es6-promise/dist/es6-promise.js:128:5)
    at nextTickCallbackWith0Args (node.js:419:9)
    at process._tickDomainCallback (node.js:389:13)
    Any suggestions as to how to debug/fix/avoid? Thanks; Sean
    Sean Phelan
    @Nerdvana2
    Ah.... apparently Buffer.alloc was added in Node 4.5.0 and I was running v4.2.6 :( Trying the upgrade now.....
    Sean Phelan
    @Nerdvana2
    OK; upgrading node.js from the old "legacy" version fixed my problem. And, for anybody following the same path: "Use n module from npm in order to upgrade node". See https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version for more background.
    Lee Collings
    @leecollings
    Hey @jishi, it's been a while. I stopped using Domoticz and your tool, but now I've come back to it, but I'm having some issues trying to install, wonder if you wouldn't mind giving your two cents?
    Jimmy Shimizu
    @jishi
    @leecollings sure, what issues are you facing?
    @Nerdvana2 thanks for reporting, I'll see if I can fix it or update the documentation. Might make sense to start targeting a never version of node, 4 starts to be quite old now.
    JDogg016
    @JDogg016
    So different way of asking the same question. Is there a command to ungroup all speakers regardless of how they have been previously joined.
    Jimmy Shimizu
    @jishi
    @JDogg016 why can't you just send ungroup to every player?
    JDogg016
    @JDogg016
    I am running a home automation system that allows the ability to send an GET command upon the occurrence of a trigger. However, I am limited to one single command. I thought something like https://localhost:5005/ungroup would do the trick, but it does not seem to do so. Also, this could come in handy in the reverse. Imagine a single command to group all speakers in a home and a single command to ungroup all speakers.
    Jimmy Shimizu
    @jishi
    You can add your own actions that internally loop through the players if you know some Javascript
    freeyland
    @freeyland
    Would also like the in group all as it happens that speakers stay grouped when using Spotify connect. After message is played, speaker stays connected. When you want to continue playing with spotify onnect you need toungroup in Sonos app
    JDogg016
    @JDogg016
    Agreed. Throughout the day people will group/ungroup speakers. A perfect automation would have the goups reset themselves to their defaults each day by unpairing everything and then regrouping everything.
    Jimmy Shimizu
    @jishi
    A single ommand to group is already achievable with presets. I'm still not convinced that an ungroupall is as useful as you claim, because once thst exist there is always gonna be someone who want to ungroup everything except 1 player, and so on. If you want me to whip up a custom action that ungroups all players, I can do that and then you can customize it as much as you like.
    JDogg016
    @JDogg016
    I see your point about users warning a custom feature. However, while I too want to custom feature the idea that I can simply ungroup everything and then start over is almost as good a solution as a customer future without having to go through the headache of developing a custom feature.
    Sorry for the typos. Let’s try again, I understand about users wanting a custom feature to u group all except 1. It was simply the idea of being able to group all and ungroup all would be simpler than multiple commands. In other words, a user with multiple Sonos speakers can create many grouping possibilities. The ability to ungroup all relieves the user of trying to go in and figure out the complexity of groups created by other users.
    TheMegamind
    @TheMegamind
    I'm new to this and probably missing something obvious, but is there a way for a activate a Preset so that it either pauses or does not start the music for the group? I initially thought "state": "stopped", would do this but apparently I misunderstand its function.
    Jimmy Shimizu
    @jishi
    @TheMegamind I just checked the code, and it will just not start playback, but if its playing it will just leave it as is. Why can't you follow up with a pause call?
    Not really sure why you would group players if the intention isn't to play anything though?
    TheMegamind
    @TheMegamind
    We use a particular grouping at night when we go to bed. We then want to return to a different, default grouping overnight so that when my wife listens to her stations (invoking them via Alexa) early in the morning the various bedroom speakers are already excluded. The problem is that when we change to the AM default preset , the speakers that were paused by the PM default preset DO start resume playing whatever they were playing the night before. I've been testing it this morning and have been able to replicate the behavior. A pause command is impractical as my home automation system requires a 20 second delay between web requests.
    TheMegamind
    @TheMegamind
    Still unable to resolve the issue with presets resuming play on speakers excluded from the preset. Any thoughts?
    JDogg016
    @JDogg016
    Here's one that would be neat (if possible). I have a Beam connected to my Apple TV (4th gen). I also have an Gen 1 Amplify that I group with the Beam. When I use my apple tv remote, the volume of the Beam adjusts up and down without issue. Is there a way through the API I could simultaneously adjust the volume of the amplify? Even better, to adjust the volume of the amplify so that for every +2 on the Beam the increase is +1 on the amplify? For instance, if I increase the volume from 10 to 20 on the Beam (assuming the Amplify is at 5) the Amplify would go from 5 to 10?
    Jimmy Shimizu
    @jishi
    @JDogg016 You can add it with custom code, or if you write something own that listens to the web-hooks. It's an interesting idea though.
    It is similar to the lock-volumes function, but instead of setting the volume of the current player, you just set it on a different player, https://github.com/jishi/node-sonos-http-api/blob/master/lib/actions/lockvolumes.js
    JDogg016
    @JDogg016
    Oh I should have been a programmer instead of a lawyer (at least for this project)
    OscarAssael
    @OscarAssael
    Hello, i want to play a favorites song or playlist, but i don't know how the API SONOS do that.
    Jimmy Shimizu
    @jishi
    @OscarAssael just invoke /player name/favorite/name of favorite
    You might need to replace spaces with %20 depending on how you are invoking the url.
    In a browser the spaces are fine, but you should use %20 as escape sequence for a space in urls
    OscarAssael
    @OscarAssael
    If it's a specific song, can i play it?
    Jimmy Shimizu
    @jishi
    Favorites only trigger predefined favorites that you have created in the Sonos app.
    Not sure what you are asking
    OscarAssael
    @OscarAssael
    @jishi Thanks, right now i can to play my favorites songs.
    OscarAssael
    @OscarAssael
    i have other question, can i play a song from my hard disc?
    Jonathan Taaffe
    @jrtaaffe
    I see options to access and clear the queue. However, I'm wondering adding individual songs to the queue. Does the API have options that allow for browsing of my library and adding, re-ordering and removing from the queue without a predefined playlist?
    Manuel
    @epsmae

    Hi to all Sonos Fans,

    I have a question regarding album and track thumbnail for spotify playlists.

    I get the url for the album or playlist image over the "AbsoluteAlbumArtUri", which works fine.
    The track image is available on the "albumArtUri", however the ip address is missing on the current track.

    For the current track it looks like:

    albumArtURI":"/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a4U93TIa0X6jGQrTBGTkChH%3fsid%3d9%26f

    And for the next track:
    albumArtURI":"http://<PlayerIP>:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a4U93TIa0X6jGQrTBGTkChH%3fsid%3d9%26f

    I can prefix the player IP and port on the current track "AlbumArtUri" however I don't get the ip adress directly from the api. I can only extract it from the next track if one is available.

    Do I miss something? Thanks in advance for your support.