Create dynamic urls for TTS

Hi

I have a TTS set up at home where I can send formatted URLs to be spoken out via my Sonos set up (via a Sonos-http engine, with an Amazon Polly speech config).

The URLs that need to be created are like the following

  1. To play across all zones, (sayall) stipulating a person’s voice (Geraint) and the required volume (70) is this - with encoded text

http://192.168.1.134:5005/sayall/John,%20and%20Ben.%20this%20is%20your%204%20minute%20warning/Geraint/70

  1. To play In just one room , (kitchen) stipulating a different person’s voice this time (Kendra) and the required volume (60) it’s this.

http://192.168.1.134:5005/kitchen/say/Testing%20one%20,%20two%20,%20three./Kendra/60

There are subtle differences in the URLs that can be sent but if someone has time - I’d appreciate any help/advice to create a dashboard driven flow that can create any variation of URL to be called

So do you have the UI set up for the required parameters?

  • place
  • text
  • voice
  • volume

If not, that is the place to start. Place presumably a drop-down selector, text would be a textarea, voice another drop-down and volume either a text field, a number field with +/- buttons or a slider.

Send those back to Node-RED. Validate and sanitise the data - especially url-encode the text. Then pass into a template node (not a Dashboard template node) to put together the URL. Then pass to the http request node.

The cookbook has an example that shows how to use URL parameters when configuring your HTTP In node to give more flexibility in what it accepts.

https://cookbook.nodered.org/http/handle-url-parameters