I am getting stuck with controlling group volumes from node-red. I was sure I had it working, but when I went to implement it and do some final tests, one part doesn't work.
In the flow below the "coordinator" = "loft av" details exactly in the config and when setup a group I add the loft bed to the loft av always, as I assume this is how the coordinator is defined i.e. the first device in the group.
In terms of changing the volume of each device or of the group of devices everything works from both within node-red and from the Sonos app, except for when I change the volume of the group (coordinator) from within node-red.
The volume jumps up for both the loft av and loft bed way higher than it should.
Can you please tell me what I have done wrong here?
[{"id":"7563affc.00631","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"193128a0.2db8a7","compatibilityMode":false,"command":"player.set.volume","state":"","stateType":"str","name":"","x":2630,"y":2640,"wires":[[]]},{"id":"480783a.980ae7c","type":"ui_slider","z":"bbe5ab3b.d5c698","name":"","label":"Loft.AV","tooltip":"","group":"9e7ae248.62254","order":16,"width":8,"height":2,"passthru":false,"outs":"end","topic":"","min":0,"max":"70","step":1,"x":2160,"y":2640,"wires":[["7563affc.00631"]]},{"id":"6db6eb01.3ef5c4","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"193128a0.2db8a7","compatibilityMode":false,"command":"player.get.volume","state":"","stateType":"str","name":"","x":1550,"y":2640,"wires":[["9d383a63.515938"]]},{"id":"262dbf4a.b4e4","type":"link in","z":"bbe5ab3b.d5c698","name":"","links":["32392cc8.e09924"],"x":1355,"y":2640,"wires":[["6db6eb01.3ef5c4"]]},{"id":"5e15f08f.ca4c6","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"4dcfd112.23351","compatibilityMode":false,"command":"group.adjust.volume","state":"","stateType":"str","name":"coordinator (group:adjust volume)","x":2680,"y":2380,"wires":[[]]},{"id":"53cf3cf5.1244c4","type":"link in","z":"bbe5ab3b.d5c698","name":"","links":["32392cc8.e09924"],"x":1355,"y":2380,"wires":[["175241c1.92370e"]]},{"id":"175241c1.92370e","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"4dcfd112.23351","compatibilityMode":false,"command":"group.get.volume","state":"","stateType":"str","name":"coordinator (group:get volume)","x":1590,"y":2380,"wires":[["838ed139.77746","aca0da93.fab938"]]},{"id":"ace56aad.2584a8","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"7b036aa9.1e0684","compatibilityMode":false,"command":"player.set.volume","state":"","stateType":"str","name":"","x":2630,"y":2800,"wires":[[]]},{"id":"6eac9ce6.ea8314","type":"ui_slider","z":"bbe5ab3b.d5c698","name":"","label":"Loft.Bd","tooltip":"","group":"9e7ae248.62254","order":20,"width":8,"height":2,"passthru":false,"outs":"end","topic":"","min":0,"max":"70","step":1,"x":2160,"y":2800,"wires":[["ace56aad.2584a8"]]},{"id":"606dfb44.e86a64","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"7b036aa9.1e0684","compatibilityMode":false,"command":"player.get.volume","state":"","stateType":"str","name":"","x":1550,"y":2800,"wires":[["6eb974cd.d2407c"]]},{"id":"747e92f6.0b65bc","type":"link in","z":"bbe5ab3b.d5c698","name":"","links":["32392cc8.e09924"],"x":1355,"y":2800,"wires":[["606dfb44.e86a64"]]},{"id":"c62e4ff4.e7d66","type":"ui_text","z":"bbe5ab3b.d5c698","group":"9e7ae248.62254","order":12,"width":4,"height":2,"name":"","label":"Cd Vol","format":"{{msg.payload}}","layout":"row-spread","x":2150,"y":2440,"wires":[]},{"id":"7da9d156.1d0e6","type":"ui_text","z":"bbe5ab3b.d5c698","group":"9e7ae248.62254","order":24,"width":25,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-spread","x":2150,"y":2500,"wires":[]},{"id":"3cfaa4c2.088efc","type":"ui_text","z":"bbe5ab3b.d5c698","group":"9e7ae248.62254","order":21,"width":4,"height":2,"name":"","label":"LB Vol","format":"{{msg.payload}}","layout":"row-spread","x":2150,"y":2860,"wires":[]},{"id":"3ac07dc0.781652","type":"ui_text","z":"bbe5ab3b.d5c698","group":"9e7ae248.62254","order":17,"width":4,"height":2,"name":"","label":"AV Vol","format":"{{msg.payload}}","layout":"row-spread","x":2150,"y":2700,"wires":[]},{"id":"4c37e5ad.48bdfc","type":"ui_slider","z":"bbe5ab3b.d5c698","name":"","label":"Group.","tooltip":"","group":"9e7ae248.62254","order":11,"width":8,"height":2,"passthru":false,"outs":"end","topic":"","min":"-1","max":"70","step":1,"x":2150,"y":2380,"wires":[["60a458c3.902dd8"]]},{"id":"60a458c3.902dd8","type":"function","z":"bbe5ab3b.d5c698","name":"","func":"var prev_vol = flow.get(\"FP_coord_vol\",msg.payload);\n\nmsg.payload = msg.payload - prev_vol;\nnode.warn(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2380,"y":2380,"wires":[["5e15f08f.ca4c6"]]},{"id":"9d383a63.515938","type":"function","z":"bbe5ab3b.d5c698","name":"volume","func":"var vol = flow.get(\"FP_loft_av_vol\");\n\nif (msg.payload == vol) \n {return}\nelse {\n flow.set(\"FP_loft_av_vol\",msg.payload);\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2640,"wires":[["480783a.980ae7c","3ac07dc0.781652"]]},{"id":"838ed139.77746","type":"function","z":"bbe5ab3b.d5c698","name":"volume","func":"var vol = flow.get(\"FP_coord_vol\");\n\nif (msg.payload == vol) \n {return}\nelse {\n flow.set(\"FP_coord_vol\",msg.payload);\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2380,"wires":[["4c37e5ad.48bdfc","c62e4ff4.e7d66"]]},{"id":"aca0da93.fab938","type":"debug","z":"bbe5ab3b.d5c698","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1870,"y":2440,"wires":[]},{"id":"6eb974cd.d2407c","type":"function","z":"bbe5ab3b.d5c698","name":"volume","func":"var vol = flow.get(\"FP_loft_bed_vol\");\n\nif (msg.payload == vol) \n {return}\nelse {\n flow.set(\"FP_loft_bed_vol\",msg.payload);\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2800,"wires":[["6eac9ce6.ea8314","3cfaa4c2.088efc"]]},{"id":"193128a0.2db8a7","type":"sonos-config","z":"","name":"Office AV","serialnum":"00-0E-58-71-3B-8E:B","ipaddress":"192.168.1.80"},{"id":"9e7ae248.62254","type":"ui_group","z":"","name":"","tab":"9b5f3ade.980978","order":6,"disp":false,"width":"26","collapse":false},{"id":"4dcfd112.23351","type":"sonos-config","z":"","name":"coordinator","serialnum":"00-0E-58-71-3B-8E:B","ipaddress":"192.168.1.80"},{"id":"7b036aa9.1e0684","type":"sonos-config","z":"","name":"Loft Bed","serialnum":"B8-E9-37-DF-FD-EC:2","ipaddress":"192.168.1.83"},{"id":"9b5f3ade.980978","type":"ui_tab","z":"","name":"SONOS PANEL","icon":"dashboard","order":4,"disabled":false,"hidden":false}]
EDIT: It seems to jump around. When I increase the group volume (from within node-red) by a little either the loft AV or the loft bed jumps way to much, so that it's over the group volume.
I can't figure out what I'm doing to make it swap over. And then sometimes it looks like they both jump a lot.
The group always looks like this in Sonos:
EDIT2: ok, it's working again. For the nth time, I removed the loft bed from the group and then added it again and it's now just working as you would expect.
It looks to me like a group joining issue.
Could it have something to do with how I am joining the loft bed to the loft av?
[{"id":"915965d.3766498","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"4dcfd112.23351","compatibilityMode":false,"command":"player.leave.group","state":"Loft Bed","stateType":"str","name":"","x":2370,"y":2100,"wires":[["d73a9d29.f9c97"]]},{"id":"f38d8582.133018","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"4dcfd112.23351","compatibilityMode":false,"command":"player.join.group","state":"Loft Bed","stateType":"str","name":"","x":2360,"y":2040,"wires":[["d73a9d29.f9c97"]]},{"id":"c8110206.208bd","type":"ui_button","z":"bbe5ab3b.d5c698","name":"","group":"9e7ae248.62254","order":38,"width":4,"height":1,"passthru":false,"label":"Loft Bed JOIN Loft AV","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":2100,"y":2040,"wires":[["f38d8582.133018"]]},{"id":"42789162.13229","type":"ui_button","z":"bbe5ab3b.d5c698","name":"","group":"9e7ae248.62254","order":39,"width":4,"height":1,"passthru":false,"label":"Loft Bed LEAVE Loft AV","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":2110,"y":2100,"wires":[["915965d.3766498"]]},{"id":"f74bce26.4567f","type":"sonos-universal","z":"bbe5ab3b.d5c698","confignode":"7b036aa9.1e0684","compatibilityMode":false,"command":"player.get.role","state":"","stateType":"str","name":"","x":2760,"y":2040,"wires":[["72125569.f85cdc"]]},{"id":"72125569.f85cdc","type":"ui_text","z":"bbe5ab3b.d5c698","group":"9e7ae248.62254","order":40,"width":6,"height":1,"name":"","label":"Group Status","format":"{{msg.payload}}","layout":"row-spread","x":2970,"y":2040,"wires":[]},{"id":"d73a9d29.f9c97","type":"function","z":"bbe5ab3b.d5c698","name":"","func":"\nsetTimeout(function() {\n node.send(msg);\n},1000)\nreturn","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2580,"y":2040,"wires":[["f74bce26.4567f"]]},{"id":"4dcfd112.23351","type":"sonos-config","z":"","name":"coordinator","serialnum":"00-0E-58-71-3B-8E:B","ipaddress":"192.168.1.80"},{"id":"9e7ae248.62254","type":"ui_group","z":"","name":"","tab":"9b5f3ade.980978","order":6,"disp":false,"width":"26","collapse":false},{"id":"7b036aa9.1e0684","type":"sonos-config","z":"","name":"Loft Bed","serialnum":"B8-E9-37-DF-FD-EC:2","ipaddress":"192.168.1.83"},{"id":"9b5f3ade.980978","type":"ui_tab","z":"","name":"SONOS PANEL","icon":"dashboard","order":4,"disabled":false,"hidden":false}]