Halloween Sonos NR flow

Just fooling around seeing what my new doorbell sensor can do for me. In the Halloween sprite, I setup a NR sequence to remove my front porch Sonos from the group, unmute/set volume 75, queue up scary laugh mp3, play queue, clear queue and rejoin group.

Summary
[{"id":"d83f2ae8.a37338","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"group.play","state":"","stateType":"str","name":"","x":770,"y":800,"wires":[["ba148ba0.efe01"]]},{"id":"76e7def6.f07b5","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"group.clear.queue","state":"","stateType":"str","name":"","x":210,"y":860,"wires":[["68296f52.71f1d8"]]},{"id":"d882b686.8950b","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.set.volume","state":"5","stateType":"str","name":"","x":410,"y":800,"wires":[["13fbd3a0.048c24"]]},{"id":"13fbd3a0.048c24","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"group.queue.uri","state":"http://techmedx.com/scarylaugh.mp3","stateType":"str","name":"","x":600,"y":800,"wires":[["d83f2ae8.a37338"]]},{"id":"ba148ba0.efe01","type":"delay","z":"9f8de26a.adc83","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":800,"wires":[["76e7def6.f07b5"]]},{"id":"769f5a64.d17edc","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.join.group","state":"Kitchen Sonos","stateType":"str","name":"","x":1260,"y":860,"wires":[[]]},{"id":"8f3b9d.ff3ebc6","type":"hubitat device","z":"9f8de26a.adc83","name":"Doorbell sensor","server":"e56053d2.c7d11","deviceId":"3047","attribute":"pushed","sendEvent":true,"x":120,"y":680,"wires":[["d4b62d04.07d86"]]},{"id":"78332c73.fcc2ec","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.get.volume","state":"","stateType":"str","name":"","x":710,"y":680,"wires":[["b1fca1e0.677788"]]},{"id":"b1fca1e0.677788","type":"change","z":"9f8de26a.adc83","name":"set porchVolume","rules":[{"t":"set","p":"porchVolume","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":680,"wires":[["2446d954.c09296"]]},{"id":"d4b62d04.07d86","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.get.mutestate","state":"","stateType":"str","name":"","x":320,"y":680,"wires":[["d429d013.2a401"]]},{"id":"d429d013.2a401","type":"change","z":"9f8de26a.adc83","name":"set porchMute","rules":[{"t":"set","p":"porchMute","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":680,"wires":[["78332c73.fcc2ec"]]},{"id":"7666a7ad.18cf48","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.set.mutestate","state":"","stateType":"str","name":"","x":640,"y":860,"wires":[["8d6b038d.fbd82"]]},{"id":"28bd6ed6.2f110a","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.set.mutestate","state":"off","stateType":"str","name":"","x":200,"y":800,"wires":[["d882b686.8950b"]]},{"id":"68296f52.71f1d8","type":"function","z":"9f8de26a.adc83","name":"Get porchMute setting","func":"var msg = {};\n\nvar porchMute = flow.get(\"porchMute\")\n\n\nif (porchMute) {\n    msg.payload = porchMute ;\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":860,"wires":[["7666a7ad.18cf48"]]},{"id":"8d6b038d.fbd82","type":"function","z":"9f8de26a.adc83","name":"Get porchMute setting","func":"var msg = {};\n\nvar porchVolume = flow.get(\"porchVolume\")\n\n\nif (porchVolume) {\n    msg.payload = porchVolume ;\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":860,"wires":[["51c29904.4dd698"]]},{"id":"51c29904.4dd698","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.set.volume","state":"","stateType":"str","name":"","x":1070,"y":860,"wires":[["769f5a64.d17edc"]]},{"id":"f8cd400e.12303","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"group.clear.queue","state":"","stateType":"str","name":"","x":630,"y":740,"wires":[["28bd6ed6.2f110a"]]},{"id":"2446d954.c09296","type":"sonos-universal","z":"9f8de26a.adc83","confignode":"af3b497a.045a38","compatibilityMode":false,"command":"player.leave.group","state":"","stateType":"str","name":"","x":430,"y":740,"wires":[["f8cd400e.12303"]]},{"id":"af3b497a.045a38","type":"sonos-config","z":"","name":"Porch","serialnum":"","ipaddress":"10.13.9.37"},{"id":"e56053d2.c7d11","type":"hubitat config","z":"","name":"Devices Hub","usetls":false,"host":"10.13.9.11","port":"80","appId":"2532","nodeRedServer":"http://10.13.9.28:1880","webhookPath":"/hubitat/webhook__","autoRefresh":true,"useWebsocket":false}]

after Halloween I gotta think of a good track for solicitors, ideas?

EDIT: updated to include get/store the mute/volume settings before making changes, and setting them back to what they were before adding the unit back to the group). I'm using a function node to this, but only because I know no other way. If there is a better way to save/inject a value into the sequence please feel free to enlighten me.

2 Likes

How about the sound of a shotgun loading followed by (from Dirty Harry) "Go ahead. Make my day!"

2 Likes