Need some help with new sonos plus node

I need some help to update my sonos node from version 3 to 4.
I did a node update for sonos plus and my flow was broken.
So i did

cd ~/.node-red   // home directory and then .node-red. In Docker /data/.node-red
npm uninstall node-red-contrib-sonos-plus
npm install node-red-contrib-sonos-plus@3.1.5

Now everything works as before. I like to update my flow so i can use the new v4 sonos plus nodes.
Can someone help to convert this to a v4 usable format ? I tried it myself but cant find the replacements for my old sonos nodes.

I have i a very tiny submodule for sonos plus nodes.

[{"id":"50fbff2a.ae025","type":"subflow","name":"playwave","info":"","category":"","in":[{"x":60,"y":80,"wires":[{"id":"56cef9ae.4f94c8"}]}],"out":[{"x":640,"y":240,"wires":[{"id":"9fd939e8.bd0f08","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"9fcead47.9d3a1","type":"sonos-manage-queue","z":"50fbff2a.ae025","confignode":"beeee955.83a368","name":"sonosaanbouw","x":460,"y":80,"wires":[["7996229f.c0b6ac"]]},{"id":"7996229f.c0b6ac","type":"change","z":"50fbff2a.ae025","name":"insert playlist","rules":[{"t":"set","p":"payload","pt":"msg","to":"insert_sonos_playlist","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":80,"wires":[["fcc96035.26705"]]},{"id":"fcc96035.26705","type":"sonos-manage-queue","z":"50fbff2a.ae025","confignode":"beeee955.83a368","name":"","x":840,"y":80,"wires":[["3154b9a6.546b66"]]},{"id":"973e1825.2af218","type":"change","z":"50fbff2a.ae025","name":"activate queue","rules":[{"t":"set","p":"payload","pt":"msg","to":"activate_queue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":240,"wires":[["9fd939e8.bd0f08"]]},{"id":"9fd939e8.bd0f08","type":"sonos-manage-queue","z":"50fbff2a.ae025","confignode":"beeee955.83a368","name":"","x":460,"y":240,"wires":[[]]},{"id":"b6173774.82b688","type":"sonos-control-player","z":"50fbff2a.ae025","confignode":"beeee955.83a368","name":"","x":460,"y":160,"wires":[["973e1825.2af218"]]},{"id":"3154b9a6.546b66","type":"change","z":"50fbff2a.ae025","name":"zet volume ","rules":[{"t":"set","p":"payload","pt":"msg","to":"90","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":160,"wires":[["b6173774.82b688"]]},{"id":"56cef9ae.4f94c8","type":"change","z":"50fbff2a.ae025","name":"flush playlist","rules":[{"t":"set","p":"payload","pt":"msg","to":"flush_queue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":80,"wires":[["9fcead47.9d3a1"]]},{"id":"e0ddd285.dda2a","type":"comment","z":"50fbff2a.ae025","name":"speelt playlist af die door de aanroep is meegegeven. laat input en output staan!","info":"","x":380,"y":320,"wires":[]},{"id":"beeee955.83a368","type":"sonos-config","name":"sonosaanbouw","serialnum":"00-0E-58-53-B9-FE:F","ipaddress":"192.168.20.29"}]

I call the above submodule from different modules where the payload is defined which playlist to play.
for example with a change node (with msg.topic = doorbell)
or msg.topic = disable_alarm_sound
Can i still use these triggering flows and do i need to change the use of msg.topic in these ?

In the attached main flow, i use the different v3 sonos plus nodes. It is a very simple flow:

a) flush the queue

  • with payload = flush_queue and then
  • v3 node mng_queue node

B) insert the playlistname (see name in part 0) before)

  • with payload = insert_sonos_playlist and then
  • v3 node mng_queue node

c) set volume by

  • payload=90 and then
  • v3 node ctrl player node

d) activate the queue by

  • payload= activate_queue and then
  • v3 node mng_queue node

View:

I haven't used that node, but the readme for the node links to instructions on how to update. It doesn't say anything about changing node types. Can you explain in more detail what issue you are having?

After update, the old node types arent recognized anymore, so they are changed...
and my flow broked...
The wiki and documentation is way to complex (for me). The old v3 was easy

It doesn't say anything about that in the docs, I don't think. You might be best to post an issue on the node's github page and see if you get help there.

Try the enclosed flow and let me know whether it works.

Please replace in your flow everything between input and output by "topic to playload" to "payload to topic". The inject nodes are only for testing.

Explanation: In Version 4 the meaning of the pair payload/topic was reversed. That's why we need the first and last change node. You can omit both if in your calling flow you set the "doorbell" to payload instead of to topic.

mysonos.export.item searches all My Sonos item (and all SONOS playlists are automatically added to the My Sonos favorites by default) and exports the relevant data for group.play.export.

group.play.export does a flush queue by default.

[{"id":"1177a985.5eedb6","type":"sonos-manage-mysonos","z":"b4a8d0e5.240a9","confignode":"beeee955.83a368","compatibilityMode":false,"command":"mysonos.export.item","state":"","stateType":"str","name":"","x":685,"y":1860,"wires":[["c23dd04f.eacf"]]},{"id":"540a3714.ed6c68","type":"inject","z":"b4a8d0e5.240a9","name":"example doorbell","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"doorbell","payloadType":"str","x":300,"y":1900,"wires":[["9e6166b.9c6e798"]]},{"id":"7866f598.d04bec","type":"change","z":"b4a8d0e5.240a9","name":"topic to payload","rules":[{"t":"move","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":303,"y":1860,"wires":[["9e6166b.9c6e798"]]},{"id":"c23dd04f.eacf","type":"sonos-universal","z":"b4a8d0e5.240a9","confignode":"beeee955.83a368","compatibilityMode":false,"command":"group.play.export","state":"","stateType":"str","name":"","x":906,"y":1860,"wires":[["891f0b21.cd63f8"]]},{"id":"9e6166b.9c6e798","type":"change","z":"b4a8d0e5.240a9","name":"set volume","rules":[{"t":"set","p":"volume","pt":"msg","to":"90","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":482,"y":1860,"wires":[["1177a985.5eedb6"]]},{"id":"891f0b21.cd63f8","type":"change","z":"b4a8d0e5.240a9","name":"payload to topic","rules":[{"t":"move","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1107,"y":1860,"wires":[[]]},{"id":"7fc703ad.844f9c","type":"inject","z":"b4a8d0e5.240a9","name":"example doorbell","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"doorbell","x":120,"y":1840,"wires":[["7866f598.d04bec"]]},{"id":"beeee955.83a368","type":"sonos-config","name":"sonosaanbouw","serialnum":"00-0E-58-53-B9-FE:F","ipaddress":"192.168.20.29"}]
1 Like

First , thanks for your help @hklages !!!!!!

i had a lot off problems with errors like:
sonos-manage-queue and control player are not there and that the flow is stopping
Also my dashboards did not work because of these sonos flow erros

so i did:

  1. update sonos from 3.1.5 to 4.5.3
  2. i deleted all usage of sonos manage queue and sonos player nodes
  3. inserted your flow et voila it works!
  4. removed your test injectors

Some questions

  1. i suppose that it is a better way to directly put the content in the payload instead
    of moving it from topic to payload, if yes then i can delete the move commands

  2. in my original config i reset the sonos after playing the playlist with a certain volume by
    a. flush the queue
    b. setting the volume back to the default
    is this still necessary ? and if is, is the next submodule the right way to do it?

[{"id":"f0a14c4f.b8632","type":"subflow","name":"resetsonos","info":"","category":"","in":[{"x":60,"y":80,"wires":[]}],"out":[],"env":[],"color":"#DDAA99"},{"id":"5a5003ba.cd4d7c","type":"change","z":"f0a14c4f.b8632","name":"zet volume ","rules":[{"t":"set","p":"volume","pt":"msg","to":"50","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":170,"y":80,"wires":[["8dd704e7.9beb2"]]},{"id":"f6232259.32298","type":"comment","z":"f0a14c4f.b8632","name":"dit deel van de procedure zet sonos weer op een blanco playlist met een normaal volume","info":"","x":390,"y":140,"wires":[]},{"id":"8dd704e7.9beb2","type":"sonos-universal","z":"f0a14c4f.b8632","confignode":"beeee955.83a368","compatibilityMode":false,"command":"group.play.export","state":"","stateType":"str","name":"","x":370,"y":80,"wires":[["8e428f30.2e4fa"]]},{"id":"8e428f30.2e4fa","type":"sonos-universal","z":"f0a14c4f.b8632","confignode":"beeee955.83a368","compatibilityMode":false,"command":"group.clear.queue","state":"","stateType":"str","name":"","x":630,"y":80,"wires":[[]]},{"id":"beeee955.83a368","type":"sonos-config","name":"sonosaanbouw","serialnum":"00-0E-58-53-B9-FE:F","ipaddress":"192.168.20.29"}]

Hi Peter
Good to hear, that your subflow now works :+1:

regarding 1.) right!

regarding 2 b) setting volume back is easy: Universal node, select group.set.volume and in the state field the new volume. There are multiple options. if the lock down is boring you can spend time to read the documentation here :slight_smile: Wiki - Universal Node
Here the simple solution (you have to replace kitchen with your config node)

regarding 2. a) That depends on your use case. You can add a simple Universal node with group.clear.queue. Are the player only for playing the doorbell, etc and not being used for playing music?

Henning

Hi Henning, thanks again, and yes everything works !!!
I have cleaned-up 5 sonos submodules and have one small module doing everything based on input variables in a input msg

I have to see a working version first before understanding the wiki. :slight_smile:
So it is now time to read the wiki again, and perhaps i expand my flows with extra sonos functionality :slight_smile:

I use sonos for my security system, to play sounds when

  • activating the alarm
  • deactivating the alarm
  • playing doorbell
  • when arming and leaving the house entrance/exit sounds

I use playlists for each of this events with one wave file in a list

Stille have some stuff to examine:

  1. is it possible to play a file/track from sonos library without enclosing it in a playlist (my current solution) ?

Hi Peter @pvklink

For (almost) everything there is a command :slight_smile:

In this case: group.play.notification. You can set property msg.volume before and as state you take the Music Library name like
x-file-cifs://nas2019/Multimedia/Music/MyMusic/Gloria%20Estefan%20%26%20Miami%20Sound%20Machine/Let%20It%20Loose/Gloria%20Estefan%20%26%20Miami%20Sound%20Machine%20-%201-2-3.mp3

It looks more complicated then it is: %20 stands for blank.

If you don't know this name, you can do the following

  1. in the SONOS App, Browse, Music Library, search for your doorbell and use "Add to My Sonos".
  2. Then use My Sonos node with command mysonos.get.items and have a look at the output (debug node). For your doorbell there is a uri - that (without the ") you can use.

thanks !
Sonos mission complete!
Old version upgraded and old flows cleaned-up with the latest functionalitiies...
I will try this and inform you (all).

Works perfect...... case closed :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.