hklages / node-red-contrib-sonos-plus Goto Github PK
View Code? Open in Web Editor NEWA set of Node-RED nodes to control SONOS player in your local network.
License: MIT License
A set of Node-RED nodes to control SONOS player in your local network.
License: MIT License
Hi,
as discussed in the other thread I have checked Sonos-Notify to get notified on state changes of my Sonos devices.
Unfortunately the Sonos-Notify informs only on track changes and does not provide information on volume,play-state, progress, or album. At this time I use it as a trigger only and request the state update via Universal-Node.
Would it be possible (I don't know if the Sonos core node does support) to have an Event node notification on
The simplest solution would be an event-trigger with the payload of the Event-Name... than we can use the Universal-Node to get the state information required.
thanks for considering
Hi there!
Great Job implementing this Sonos node.
I started playing with it and crashed into a Problem:
I wanted to insert Playlists in the queue from my local NAS. Some Playlists worked without Problems, other would not work. I took me some time to figure it out, but I think i now know the Problem.
You import only the first 100 Playlists.
I took a look into your Code i think the Problem is here:
function getMusicLibraryPlaylists (node, msg, sonosPlayer) {
const sonosFunction = 'get music library playlists';
sonosPlayer.getMusicLibrary('playlists', { start: 0, total: 100 })
in the file sonos-manage-queue.js.
I there a reason you import only 100 Playlists?
Is it possible to make the Array of Playlists longer?
I am not that good at Javascript, but maybe you should use a different Datatype? Not a static type like an Array, more a List or something?
All the Best!
I'm using your latest code and all works fine besides the My_Sonos_Node getting the following error
get My Sonos items: Cannot read property 'length' of undefined :: Details: {"stack":"TypeError: Cannot read property 'length' of undefined\n at Object.parseSonosPlaylistsResult (/home/pi/.node-red/node_modules/node-red-contrib-sonos-plus/src/Sonos-Commands.js:942:35)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at async Object.getAllSonosPlaylists (/home/pi/.node-red/node_modules/node-red-contrib-sonos-plus/src/Sonos-Commands.js:644:32)\n at async getAllMySonosItemsV2 (/home/pi/.node-red/node_modules/node-red-contrib-sonos-plus/src/Sonos-Commands.js:625:32)","message":"Cannot read property 'length' of undefined"}
thanks for any advise
I'm looking for an oportiunity to pair two players to form a stereo pair, not only a group playing the same mono channel. Is there already a feature in the contrib package available, like the pairing from the sonos app?
Thank you in advance for your assistance...
Hi,
just discovered this node and I am playing around.
How would you achieve this?
I want to use my speakers as doorbell, but after playing the notification the music doesn't resume.
Regards
Markus
Hey,
i know this was raised several times in the issues but i could not figure out my problem.
I try to start playing a playlist from "My Sonos" randomly. I used the demo code from the "My Sonos" Node wiki but it fails with get my sonos: Cannot read property 'length' of undefined ::
This is the flow, basically taken from the example:
[{"id":"833ef74d.ef1e88","type":"inject","z":"f57f2ef2.84554","name":"","topic":"Songs","payload":"export","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":2932,"y":2449,"wires":[["712aabb.c92c354"]]},{"id":"712aabb.c92c354","type":"sonos-manage-mysonos","z":"f57f2ef2.84554","confignode":"89956c78.ba78d","name":"","x":3143,"y":2451,"wires":[["a1e031d.5a1bed"]]},{"id":"a1e031d.5a1bed","type":"sonos-universal","z":"f57f2ef2.84554","confignode":"89956c78.ba78d","name":"any","x":3303,"y":2451,"wires":[["25562451.8fc0bc"]]},{"id":"25562451.8fc0bc","type":"debug","z":"f57f2ef2.84554","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3303,"y":2413,"wires":[]},{"id":"89956c78.ba78d","type":"sonos-config","z":"","name":"coordinator","serialnum":"xxx","ipaddress":"yyy"}]
The playlist "Songs" is added to MySonos.
but basically everything fails with the same error of the example page.
I also added the universal node examples, there when i click the "TuneIn" example, it starts playing swr3 with no problem. (the tunein example of the My-Sonos node fails)
What am i doing wrong? Is there a way to start a my-sonos (or spotify) playlist using the universal node?
Thanks !
Sonos playlists are shown in SONOS app, tab "My Sonos" but the "Universal node" command get.item
does not show the playlist. Also the other commands do not work with Sonos playlists.
Work around: For Sonos playlists please use "Manage Queue" node and commands get_sonos_playlists
and insert_sonos_playlist
i play my audio (via spotify) to my sonos "office" group, but i wanna switch it to the "bedroom" group seamlessly. is there a way to do that?
If you want to be sure: Add the TuneIn Station to My Sonos and use in get_mysonos in node "Manage Radio". The output will show the exact link and the item includes also the Radio ID.
As advised by you I used the Manage Radio node to get an AlbumURL link and the current RadioID... as Manage Radio is deprecated I do miss that feature in Universal-Node
Pls advise
Hello, I have read through all you documentation, but cannot seem to get a spotify playlist to play using the URI. When i deliver the msg to the node I receive this error:
insert spotify uri - Request failed with status code 500 :: Details: {"stack":"Error: Request failed with status code 500\n at createError (/config/node-red/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/config/node-red/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/config/node-red/node_modules/axios/lib/adapters/http.js:236:11)\n at IncomingMessage.emit (events.js:215:7)\n at endReadableNT (_stream_readable.js:1184:12)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)","message":"Request failed with status code 500","config":{}}
Any help would be great.
Thank you.
I really like what you have have achieved node and I have replace almost all Sonos functions with your node.
Would you be able to implement TTS functionality (like notification) with cache functionality similar to what is possible in https://flows.nodered.org/node/node-red-contrib-sonospollytts ==> this is avoiding unnecessary TTS request for repeated statements!
thanks for considering
Many thanks for your efforts in making these nodes.
Any chance you would consider exposing the setLEDState getLEDState commands?
The use case is being able to turn off the sonos LED so as not to disturb people sleeping.
But still show the sonos is on during the day.
Many thanks
Mark
Hi,
i want to play every morning my favourite radiostation in the kitchen (Sonos Play1, master) and the living room (Sonos Play 5, slave). The event is triggered by a schedule node.
I tried to design a flow that first advises the living room in the kitchen group and then after a delay starts the radio in the kitchen: Flow.txt
I'm not able to join living room into the kitchen group, although the contoller node replies: ok: join_group.
Where ist the missing link?
Thanks for help, Sascha
Hi,
i get an error when i simply want to send a play command to control the player. Is there anything i can do? I'm sure the ip adress is correct, i've selected one player from the dropdown when i click on search in the configuration node.
Error-Message: "play - can not connect to player - refused :: Details: Validate ip address of player"
Hi,
I'm using your Sonos-Nodes for all my audio messages and notifications via Sonos devices. As I want to address all my Sonos-devices individually I need an "IF" statement to select the correct Universal-Node.
Would it be possible to provide "msg.playerName" to the Universal-Node (and maybe all the others) to select the correct Sonos device?
Thanks for considering
This simple toggle flow worked before upgrading to 3.0.1:
[{"id":"1b7b193.1c86be7","type":"sonos-control-player","z":"c5ae02e1.ce9bb","confignode":"75950d78.804364","name":"","x":700,"y":780,"wires":[[]]},{"id":"858249ad.58e508","type":"inject","z":"c5ae02e1.ce9bb","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":780,"wires":[["525ae267.9fd96c"]]},{"id":"525ae267.9fd96c","type":"change","z":"c5ae02e1.ce9bb","name":"toggleplayback","rules":[{"t":"set","p":"payload","pt":"msg","to":"toggleplayback","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":780,"wires":[["1b7b193.1c86be7"]]},{"id":"75950d78.804364","type":"sonos-config","z":"","name":"Play 1","ipaddress":"192.168.3.13"}]
Now I get this error:
TypeError: Cannot read property 'split' of undefined
Hi,
wow great work. I'am only missing one function.
I want to set Playlist, Radiostations etc. without start to play them.
(eg. @04:00 i want to reset Volume, Radiostation, etc. to an defined state, so no heavy Metal in the morning when i press Play on the Sonos)
Is there a Way to do that ?
(in the moment i'am using node-sonos-http-api, but i dont see any need for this as your node provides almost anything i need)
Thank you.
greets
Hello,
great Work. It was really easy to get started with node-red and Sonos :)
I want to use the sonos module for playing notifications and the Node Sonos lib has a command for this.
Would it be possible to support that ?
Cheers
Carsten
What is the best way to us topic/payload. Currently payload is used for command and topic for some paramenter if needed.
Any ideas to improve?
Hello, :)
Is it possible to play a song starting at a given position ? Or to jump to a given position of a playing song ?
Thank you
I love your work with the SONOS, really well done!
I have the soundbar as well a few Play5 with Line-In capability which I was using so far. At moment I'm not able to switch-back to Line-In with your node!... How can I achieve this ??
I'm also using the node SonosPollyTTS successfully .. it would be great if your two modules could merge
Keep going with the great work!
I'm trying to add a Spotify element (track, album, playlist etc) to the queue using the examples provided in the wiki.
element used: [{"id":"8d0b193b.cc2258","type":"inject","z":"99e6906e.c69df","name":"spotify track","topic":"spotify:track:5AdoS3gS47x40nBNlNmPQ8","payload":"insert_spotify_uri","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1167,"y":1149,"wires":[["c02b5a3d.f2fbb8"]]}]
Output
"TypeError: Cannot read property 'EU' of undefined"
Is this a misconfiguration on my end or part of your improvements to the notification system?
Hello,
is it possible to integrate a "TEST Sonos Online" as "Input"?
The function "test_connected" with "Get Status" is not reliable.
The function "TEST Sonos Online" could first perform a PING test. Important would be, that if the PING fails, an OFFLINE comes immediately.
Gruß
Thank you very much for this great Sonos nodes!
Is there a way to hide this warning message from the debug output?
Just a warning: get current song - invalid combination artist title received :: Details: received-> {"id":null,"parentID":null,"title":"aacp?aw_0_1st.playerid=tunein.com","artist":null,"album":null,"albumArtURI":null,"position":0,"duration":0,"albumArtURL":null,"uri":"aac://https://s7-webradio.rockantenne.de/rockantenne/stream/aacp?aw_0_1st.playerid=tunein.com","queuePosition":1}
Hi,
Thank you for this tool!
It is more a question than an issue... Is there a way to use imported playlists in these nodes?
I don't use sonos playlist but I have many playlists that are called "imported" in sonos.
Is there a way to load those? Is there an URI for that that I could use?
The playlists are on my NAS an example : //192.168.1.32/Music/playlists/party.m3u
Is there a way to load it?
Thanks.
Is there a possibility to add CROSSFADE and SLEEP as queue or player functions ?
More of a feature request than an issue but it'd be great if get_mysonos and play_mysonos could access all of My Sonos favourite's rather than just TuneIn stations.
Specifically, I have a local Icecast server which streams audio and I have added it to My Sonos favourite's via Manage > Add Radio Station in the Windows Sonos Controller App. The stations is shown as though it is a TuneIn station within the Windows Controller once it is added but obviously isn't actually coming from TuneIn as it is local to my LAN only. I'd love to be able to access the station via the get_mysonos and play_mysonos command but it isn't currently returned as part of the array.
Also, I have playlists and individual songs from Spotify, Google Music, Mixcloud etc included in My Sonos favourites that do not get returned as part of the get_mysonos command. Having them included would be appreciated too.
Hi,
In my unchanged flow, setting Nightmode och DialogLevel on my Sonos Beam has stopped working and is giving me this error:
set EQ - Cannot read property 'includes' of undefined :: Details: {"stack":"TypeError: Cannot read property 'includes' of undefined\n at sonosPlayer.deviceDescription.then (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-control-player.js:908:29)\n at process._tickCallback (internal/process/next_tick.js:68:7)","message":"Cannot read property 'includes' of undefined"}
The input is {"_msgid":"42c86f33.8f036","topic":"NightMode","payload":"set_eq","eqvalue":"On"} This worked fine before, but I'm not sure when it stopped working.
Get status for NightMode and DialogLevel still works.
Regards
Fredrik
As I am not a Spotify subscriber please let me know how you would like to use Spotify service in Node-RED.
You can add your feedback as a comment to this issue. That will help me to prioritize the tasks.
Hi,
as said in the other issue I still have some problems. I just updated to 2.1.4 but I think there is an issue with sending a notification to multiple players at once.
I tried to find separate the issue with the following flow:
[ { "id": "104f125d.150b5e", "type": "tab", "label": "Debug Sonos", "disabled": false, "info": "" }, { "id": "8b973d5b.5bae7", "type": "inject", "z": "104f125d.150b5e", "name": "BOTH", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 130, "y": 120, "wires": [ [ "84ca48ce.a5a2b8" ] ] }, { "id": "84ca48ce.a5a2b8", "type": "change", "z": "104f125d.150b5e", "name": "BOTH Doorbell @ Volume15", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "play_notification", "tot": "str" }, { "t": "set", "p": "topic-old", "pt": "msg", "to": "http://10.20.0.2/addons/red/media/doorbell.mp3", "tot": "str" }, { "t": "set", "p": "volume", "pt": "msg", "to": "15", "tot": "str" }, { "t": "set", "p": "topic", "pt": "msg", "to": "http://soundbible.com/mp3/foghorn-daniel_simon.mp3", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 360, "y": 120, "wires": [ [ "d7e8bf34.c2886", "c96fe98c.9bc738" ] ] }, { "id": "c96fe98c.9bc738", "type": "sonos-control-player", "z": "104f125d.150b5e", "confignode": "588a41a4.76a3d", "name": "SONOS-AZM", "x": 640, "y": 120, "wires": [ [ "834d1f76.59df2" ] ] }, { "id": "d7e8bf34.c2886", "type": "sonos-control-player", "z": "104f125d.150b5e", "confignode": "a8e8ea1b.3d38d8", "name": "SONOS-FI", "x": 630, "y": 180, "wires": [ [ "834d1f76.59df2" ] ] }, { "id": "4bccc5d2.d41e2c", "type": "inject", "z": "104f125d.150b5e", "name": "activate_queue AZ", "topic": "", "payload": "activate_queue", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 170, "y": 340, "wires": [ [ "726f5050.2dcb8" ] ] }, { "id": "726f5050.2dcb8", "type": "sonos-manage-queue", "z": "104f125d.150b5e", "confignode": "588a41a4.76a3d", "name": "", "x": 640, "y": 300, "wires": [ [ "834d1f76.59df2" ] ] }, { "id": "834d1f76.59df2", "type": "debug", "z": "104f125d.150b5e", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "x": 930, "y": 220, "wires": [] }, { "id": "114a3dc1.beca52", "type": "sonos-manage-queue", "z": "104f125d.150b5e", "confignode": "a8e8ea1b.3d38d8", "name": "", "x": 640, "y": 360, "wires": [ [ "834d1f76.59df2" ] ] }, { "id": "ac7203fc.8b529", "type": "change", "z": "104f125d.150b5e", "name": "FITNESS Doorbell @ Volume15", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "play_notification", "tot": "str" }, { "t": "set", "p": "topic-old", "pt": "msg", "to": "http://10.20.0.2/addons/red/media/doorbell.mp3", "tot": "str" }, { "t": "set", "p": "volume", "pt": "msg", "to": "15", "tot": "str" }, { "t": "set", "p": "topic", "pt": "msg", "to": "http://soundbible.com/mp3/foghorn-daniel_simon.mp3", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 370, "y": 200, "wires": [ [ "d7e8bf34.c2886" ] ] }, { "id": "e5bff98e.3a7d58", "type": "change", "z": "104f125d.150b5e", "name": "AZ Doorbell @ Volume15", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "play_notification", "tot": "str" }, { "t": "set", "p": "topic-old", "pt": "msg", "to": "http://10.20.0.2/addons/red/media/doorbell.mp3", "tot": "str" }, { "t": "set", "p": "volume", "pt": "msg", "to": "15", "tot": "str" }, { "t": "set", "p": "topic", "pt": "msg", "to": "http://soundbible.com/mp3/foghorn-daniel_simon.mp3", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 350, "y": 160, "wires": [ [ "c96fe98c.9bc738" ] ] }, { "id": "45310ece.6c5c6", "type": "inject", "z": "104f125d.150b5e", "name": "AZ", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 130, "y": 160, "wires": [ [ "e5bff98e.3a7d58" ] ] }, { "id": "41239dd9.d056c4", "type": "inject", "z": "104f125d.150b5e", "name": "FITNESS", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 140, "y": 200, "wires": [ [ "ac7203fc.8b529" ] ] }, { "id": "9490bd6e.06a2c", "type": "inject", "z": "104f125d.150b5e", "name": "activate_queue FITNESS", "topic": "", "payload": "activate_queue", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 190, "y": 380, "wires": [ [ "114a3dc1.beca52" ] ] }, { "id": "4cc2f901.f56c38", "type": "inject", "z": "104f125d.150b5e", "name": "activate_queue BOTH", "topic": "", "payload": "activate_queue", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 180, "y": 300, "wires": [ [ "726f5050.2dcb8", "114a3dc1.beca52" ] ] }, { "id": "7c27fba2.d8f8e4", "type": "inject", "z": "104f125d.150b5e", "name": "", "topic": "", "payload": "stop", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 570, "y": 240, "wires": [ [ "d7e8bf34.c2886", "c96fe98c.9bc738" ] ] }, { "id": "588a41a4.76a3d", "type": "sonos-config", "z": "", "name": "SONOS AZM", "serialnum": "", "ipaddress": "10.10.0.7" }, { "id": "a8e8ea1b.3d38d8", "type": "sonos-config", "z": "", "name": "SONOS-FI", "serialnum": "", "ipaddress": "10.10.0.18" } ]
So:
activating the queue on AZ OR FITNESS and sending a notification to it results in: Playing Music -> Playing Notification -> Playing Music (resuming queue) - DEBUG msgs as expected.
activating the queue on BOTH and sending the notification to BOTH results in: Playing Music on Both players -> Playing Notification on Both players -> Resuming Queue on Fitness - Debug msg for FITNESS.
Again my strange network or does the flow works for you?
Thanks
Markus
The error message at "play notification" is:
play notification - Request failed with status code 412 :: Details: {"stack":"Error: Request failed with status code 412\n at createError (/data/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/data/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/data/node_modules/axios/lib/adapters/http.js:236:11)\n at IncomingMessage.emit (events.js:203:15)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)","message":"Request failed with status code 412","config":{}}
The version of "node-red-contrib-sonos-plus" is 2.1.7
The version of "node-red" is 1.0.3
The insert_spotify_uri
function of the Manage Queue
node is not working for me.
I always receive statusCode 500 & upnpError 800
, and If i add a region (as string or int) I get no output, at all.
[{"id":"e6f6a47e.7c47e8","type":"sonos-manage-queue","z":"c0a5d9cc.64ffa","confignode":"46c85ed3.238c3","name":"","x":580,"y":320,"wires":[["927fe29c.7ecfc8","e94515fe.af9c7"]]},{"id":"927fe29c.7ecfc8","type":"debug","z":"c0a5d9cc.64ffa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":300,"wires":[]},{"id":"24094cc6.396af4","type":"inject","z":"c0a5d9cc.64ffa","name":"Spotify playlist","topic":"spotify:user:spotify:playlist:MYPLAYLIST","payload":"insert_spotify_uri","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":280,"wires":[["e6f6a47e.7c47e8"]]},{"id":"4c1cc045.327878","type":"inject","z":"c0a5d9cc.64ffa","name":"Spotify track","topic":"spotify:track:6yIHGmQLJxWAUZ1ZkENemN","payload":"insert_spotify_uri","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":320,"wires":[["e6f6a47e.7c47e8"]]},{"id":"e493c721.c1bf2","type":"inject","z":"c0a5d9cc.64ffa","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":360,"wires":[["ba49a4fe.d3142"]]},{"id":"ba49a4fe.d3142","type":"function","z":"c0a5d9cc.64ffa","name":"Spotify track with region","func":"\nreturn {\n payload: \"insert_spotify_uri\",\n topic: \"spotify:track:6yIHGmQLJxWAUZ1ZkENemN\",\n region: 3079\n};","outputs":1,"noerr":0,"x":290,"y":360,"wires":[["e6f6a47e.7c47e8"]]},{"id":"e94515fe.af9c7","type":"function","z":"c0a5d9cc.64ffa","name":"console log","func":"node.log(JSON.stringify(msg))","outputs":0,"noerr":0,"x":910,"y":340,"wires":[]},{"id":"a75cf24e.5b0c48","type":"catch","z":"c0a5d9cc.64ffa","name":"","scope":null,"uncaught":false,"x":600,"y":280,"wires":[["e94515fe.af9c7","927fe29c.7ecfc8"]]},{"id":"46c85ed3.238c3","type":"sonos-config","z":"","name":"Sonos","serialnum":"XX:XX:XX:XX:XX","ipaddress":"127.0.0.1"}]
(Config blanked and private playlist ID changed to MYPLAYLIST
)
Debug logs from injecting commands for playlist, track, and playlist with region
, respectively:
[debug] [sonos-manage-queue:cc953fc3.411ee] node - msg received
[debug] [sonos-manage-queue:cc953fc3.411ee] using IP address of config node
[debug] [sonos-manage-queue:cc953fc3.411ee] Entering error handling from insert spotify uri.
[debug] [sonos-manage-queue:cc953fc3.411ee] node - msg received
[debug] [sonos-manage-queue:cc953fc3.411ee] using IP address of config node
[debug] [sonos-manage-queue:cc953fc3.411ee] Entering error handling from insert spotify uri.
[debug] [sonos-manage-queue:cc953fc3.411ee] node - msg received
[debug] [sonos-manage-queue:cc953fc3.411ee] using IP address of config node
Console log from Catch → console log function
from injecting commands for playlist, track, and track with region, respectively:
[info] [function:console log] {"_msgid":"5febc6c4.6dd1a8","topic":"spotify:user:spotify:playlist:3Su4eYCErApmz6D4ReRlLz","payload":"insert_spotify_uri","error":{"message":"insert spotify uri - statusCode 500 & upnpError 800 :: Details: Lookup upnpError 800","source":{"id":"e6f6a47e.7c47e8","type":"sonos-manage-queue","count":1}}}
[info] [function:console log] {"_msgid":"be840a7c.1ad088","topic":"spotify:track:6yIHGmQLJxWAUZ1ZkENemN","payload":"insert_spotify_uri","error":{"message":"insert spotify uri - statusCode 500 & upnpError 800 :: Details: Lookup upnpError 800","source":{"id":"e6f6a47e.7c47e8","type":"sonos-manage-queue","count":1}}}
[info] [function:console log] {"payload":"insert_spotify_uri","topic":"spotify:track:6yIHGmQLJxWAUZ1ZkENemN","region":3079,"_msgid":"43833c58.76c654","error":{"message":"TypeError: msg.region.match is not a function","source":{"id":"e6f6a47e.7c47e8","type":"sonos-manage-queue","count":1},"stack":"TypeError: msg.region.match is not a function\n at insertSpotifyUri (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:227:22)\n at processInputMsg (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:112:7)\n at SonosManageQueueNode._inputCallback (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:49:9)\n at SonosManageQueueNode.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:200:18)\n at Immediate._onImmediate (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:33)\n at runCallback (timers.js:705:18)\n at tryOnImmediate (timers.js:676:5)\n at processImmediate (timers.js:658:5)"}}
Last log formatted for convenience:
{
"payload":"insert_spotify_uri",
"topic":"spotify:track:6yIHGmQLJxWAUZ1ZkENemN",
"region":3079,
"_msgid":"43833c58.76c654",
"error":{
"message":"TypeError: msg.region.match is not a function",
"source":{
"id":"e6f6a47e.7c47e8",
"type":"sonos-manage-queue",
"count":1
},
"stack":"TypeError: msg.region.match is not a function\n at insertSpotifyUri (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:227:22)\n at processInputMsg (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:112:7)\n at SonosManageQueueNode._inputCallback (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:49:9)\n at SonosManageQueueNode.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:200:18)\n at Immediate._onImmediate (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:33)\n at runCallback (timers.js:705:18)\n at tryOnImmediate (timers.js:676:5)\n at processImmediate (timers.js:658:5)"
}
}
Stack when region
is passed as a number:
TypeError: msg.region.match is not a function
at insertSpotifyUri (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:227:22)
at processInputMsg (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:112:7)
at SonosManageQueueNode._inputCallback (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:49:9)
at SonosManageQueueNode.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:200:18)
at Immediate._onImmediate (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:33)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
Stack when region
is passed as a string:
TypeError: sonosPlayer.setSpotifiyRegion is not a function
at insertSpotifyUri (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:228:21)
at processInputMsg (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:112:7)
at SonosManageQueueNode._inputCallback (/data/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-queue.js:49:9)
at SonosManageQueueNode.Node._emitInput (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:200:18)
at Immediate._onImmediate (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:33)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
I have tried many things in order to change the state of my Sonos while troubleshooting this, primarily leave_group
, but many iterations of control and state (playing, flush_queue, stop, and others)
The issue arises, when there are empty categories in My Sonos. After I added items there, the node worked as expected.
"get My Sonos items: Cannot read property 'length' of undefined :: Details:
{"stack":"TypeError: Cannot read property 'length' of undefined\n at Object.parseSonosPlaylistsResult (/data/node_modules/node-red-contrib-sonos-plus/src/Sonos-Commands.js:942:35)\n at
<anonymous>\n at
process._tickCallback (internal/process/next_tick.js:189:7)",
"message":"Cannot read property 'length' of undefined"}"
Hi,
great work on the flow!
When making a TTS announcement, is it possible to pause, save the current queue, start the announcement with pollyTTS, and go back to the previous queue? I figured out how to restore the volume, but not the queue.
Thx!
Hello,
Thanks again for your support.
My sonos beam can either be used to listen to music or radio using wifi but also as a sound bar for the TV.
To switch between the two, anynet+ usually works. It may not though. So switching through node-red (included in home assistant) to "TV" source would be good. Is that possible?
RG
Several nodes function, including "Get Status" get_basics
, "Universal" play
, and "Manage Queue" get_queue
, but I receive an empty array using "My Sonos" get.items
, and attempting "Manage Queue" insert_spotify_uri
with a playlist in my My Sonos collection results in statusCode 500 & upnpError 800
(possibly related to not being able to enumerate My Sonos items).
I am new to Node Red and do not yet know how to output more error information (my "catch" node isn't triggering and I haven't looked up how to increase log verbosity). I can update this issue with more information as I find time to troubleshoot, but I wanted to start it in case there's something simple I am missing.
Since last update 2.1.7 (I don't know wich software-version I used before) I can't add Spotify Playlists to Queue.
I use an IKEA symfonisk with newest Software.
"Manage Queue" does not show an error. But the Anwering of this is every time: "Kein Antwortobjekt" (german for "no answering object")
"Flush Queue" is working fine. So I think the connection to my IKEA symfonisk is working.
I tryed also the example of the wiki with "Manage my sonos" and Spotify. There the node is showing an error: "error: queue my sonos item - cannot read property 'length' of undefined."
Could you Check please?
Maybe a niche request but is it possible to implement a 'Play one song and then stop' function?
More specifically, I'd like to be able to pass a playlist in, shuffle it, then play just the top song in the newly shuffled queue. Passing a playlist in is now easy enough, as is setting the play mode to shuffle, however I had hoped that the 'play_song' (described as 'Plays a specific song in queue') would play the specific song position in the queue and stop once the song is complete rather than continue to play the remainder of the playlist.
My particular use case is that I'd like a selection of Christmas songs to play when I turn on my tree lights (using a smart plug to allow automation) but having a single song playlist would find the same song getting boring quickly while I've no need to hear every Christmas song ever written each time I turn my lights on!
It may be possible to achieve using a loop to remove all but one items from the queue once playing has started but coupling Sonos Plus with other nodes within Node Red but I'm struggling to think where to begin with that at the moment so it'd be great if the option was added to Sonos Plus natively if it isn't too difficult to do?
Thanks
Hi,
I want to be able to create a Subflow where I put in the playername and do the "calculation" inside the subflow. By doing so I can reduce the complexity a lot.
I think there are missing some features in the Universal node.
I check the state and do different stuff if the state is playing / paused / others. Do you plan to extend the Universal node or do I miss some features of any other node which could help me to implement the logic independent of the control node?
Regards
Markus
My Flow looks like this:
[
{
"id": "cf17fc4b.2395f",
"type": "change",
"z": "f5499d80.2f698",
"name": "Get STATE",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "get_state",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 900,
"wires": [
[
"8a31dd7d.6e43f"
]
]
},
{
"id": "8a31dd7d.6e43f",
"type": "sonos-get-status",
"z": "f5499d80.2f698",
"confignode": "a8e8ea1b.3d38d8",
"name": "",
"x": 510,
"y": 900,
"wires": [
[
"bbf615a5.d52218"
]
]
},
{
"id": "aa85f5df.9d66b8",
"type": "inject",
"z": "f5499d80.2f698",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 220,
"y": 960,
"wires": [
[
"cf17fc4b.2395f"
]
]
},
{
"id": "bbf615a5.d52218",
"type": "switch",
"z": "f5499d80.2f698",
"name": "Playing / Paused / Other",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "playing",
"vt": "str"
},
{
"t": "eq",
"v": "paused",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 710,
"y": 900,
"wires": [
[
"bb8d777b.96df38"
],
[
"fe26418e.54b86"
],
[
"c5ad50ca.62436"
]
]
},
{
"id": "bb8d777b.96df38",
"type": "change",
"z": "f5499d80.2f698",
"name": "Pause",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "pause",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1070,
"y": 880,
"wires": [
[
"43f99d64.09ecf4"
]
]
},
{
"id": "fe26418e.54b86",
"type": "change",
"z": "f5499d80.2f698",
"name": "Play@15",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "play",
"tot": "str"
},
{
"t": "set",
"p": "volume",
"pt": "msg",
"to": "15",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1080,
"y": 920,
"wires": [
[
"43f99d64.09ecf4"
]
]
},
{
"id": "c5ad50ca.62436",
"type": "change",
"z": "f5499d80.2f698",
"name": "GET MEDIAINFO",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "get_mediainfo",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 730,
"y": 960,
"wires": [
[
"e049a7b6.5539e8"
]
]
},
{
"id": "43f99d64.09ecf4",
"type": "sonos-control-player",
"z": "f5499d80.2f698",
"confignode": "a8e8ea1b.3d38d8",
"name": "SONOS-FI",
"x": 1350,
"y": 860,
"wires": [
[
"95c51677.3d2b98"
]
]
},
{
"id": "df9999f5.1b5ef8",
"type": "switch",
"z": "f5499d80.2f698",
"name": "Queue Activated?",
"property": "queueActivated",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 910,
"y": 1000,
"wires": [
[
"fe26418e.54b86"
],
[
"ca7d257d.0cd968"
]
]
},
{
"id": "e049a7b6.5539e8",
"type": "sonos-get-status",
"z": "f5499d80.2f698",
"confignode": "a8e8ea1b.3d38d8",
"name": "",
"x": 730,
"y": 1000,
"wires": [
[
"df9999f5.1b5ef8"
]
]
},
{
"id": "95c51677.3d2b98",
"type": "debug",
"z": "f5499d80.2f698",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 1550,
"y": 860,
"wires": []
},
{
"id": "ca7d257d.0cd968",
"type": "change",
"z": "f5499d80.2f698",
"name": "Activate Queue@15",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "activate_queue",
"tot": "str"
},
{
"t": "set",
"p": "volume",
"pt": "msg",
"to": "15",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1110,
"y": 1000,
"wires": [
[
"82824506.6fcd48"
]
]
},
{
"id": "82824506.6fcd48",
"type": "sonos-manage-queue",
"z": "f5499d80.2f698",
"confignode": "a8e8ea1b.3d38d8",
"name": "Mg. Queue SONOS-FI",
"x": 1380,
"y": 920,
"wires": [
[
"95c51677.3d2b98"
]
]
},
{
"id": "a8e8ea1b.3d38d8",
"type": "sonos-config",
"z": "",
"name": "SONOS-FI",
"serialnum": "",
"ipaddress": "10.10.0.18"
}
]
Hello,
if I send Pause to a Player who is a Slave I get
pause - Request failed with status code 500 :: Details: {"stack":"Error: Request failed with status code 500\n at createError (/opt/iobroker/iobroker-data/node-red/node_modules/sonos/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/opt/iobroker/iobroker-data/node-red/node_modules/sonos/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/opt/iobroker/iobroker-data/node-red/node_modules/sonos/node_modules/axios/lib/adapters/http.js:236:11)\n at IncomingMessage.emit (events.js:203:15)\n at endReadableNT (_stream_readable.js:1143:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)","message":"Request failed with status code 500","config":{}}
On a Play-Value I get the message OK:play , but nothing happens.
On a stop-Value I get the message OK:stop , but only the slave stopped.
My Pi is used for iot purposes and as such accessible from the Internet. I use a certificate generated through Letsencrypt to secure the connection. I can fetch the mp3 files from the Pi using a HTTP request but I need to enable "Use authentication". I cannot manage the Sonos to fetch the mp3 using authentication. Is there a work around available?
"play mysonos - error caught from response Details: {"stack":"TypeError: Cannot read property 'startsWith' of undefined\n at sonosPlayer.getFavorites.then.response (/usr/local/addons/redmatic/var/node_modules/node-red-contrib-sonos-plus/src/sonos-manage-radio.js:160:37)\n at process._tickCallback (internal/process/next_tick.js:68:7)","message":"Cannot read property 'startsWith' of undefined"}"
When sending the request, the volume goes to 60, plays the file and goes back to 10, so far so good
The issue:
The file which I'm playing is already playing before the volume is set correctly to 60 so I can't hear the first 2 seconds (because it plays at volume 10)
Is there a way to wait until the volume has been set before the file starts playing ?
Hi,
Is it possible to control level for sub?
Is it possible to toogle nightmode and speech enhancement on playbar and sonos beam?
Would love to see these features so I can eliminate those steps in sonos official app.
Great work!
Hi,
for TuneIN Radiostation i have the Problem that there is the most time no Url for the Album/Cover Url.
To Use this in a vis it is necessary to have the url to show the Logo of the RadioStation.
Thanks
Hallo,
ich würde gerne eine bestehende Wiedergabe einer Gruppe stoppen, dann etwas anderes wiedergeben und danach wieder die ursprüngliche Wiedergabe fortsetzen. Kann mir hierbei jemand helfen? Was ich nicht hinbekomme, ist die aktuelle Wiedergabe zwischenzuspeichern und dann wieder an die Gruppe zum fortsetzen zu übergeben. Geht so etwas überhaupt?
Play_Notification ist leider keine Lösung, da die Wiedergabe sich immer wieder ändert.
Gruß
Niwre
Hi,
Can you Add or is it possible to have an ID for the Status if the Player in a Group as Master or Slave.
In the GroupInformation in get_Basic I have the value CurrentZonePlayerUUIDsInGroup.
here I only see the Sonos UUID but not the real text. is it here possible to write the name like Kitchen,.... who is in the Group?
I use Napster for the source of my music - what is needed to get support for it in this node?
Is there a list of things you need for an implementation?
Regards
Markus
I'm missing some configuration. Getting the following error using your universal node example. I did configure it for my Sonos.
processing msg: URL is not defined :: Details: {"stack":"ReferenceError: URL is not defined\n at getGroupMemberDataV2 (/data/node_modules/node-red-contrib-sonos-plus/src/Sonos-Commands.js:530:11)\n at \n at process._tickDomainCallback (internal/process/next_tick.js:229:7)","message":"URL is not defined"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.