Here is the final flow code, with the instructions in the Comment labels, for the CastV2 integration.
Flow Code you can Import:
[{"id":"2c1c608.171caa","type":"tab","label":"Google-Home-TTS-CastV2","disabled":false,"info":""},{"id":"bf3403b3.7926","type":"function","z":"2c1c608.171caa","name":"function for MIOS device status","func":"let sensors={\n \"Kitchen:Patio Door:Tripped\":{\n \"ips\":\"192.168.0.16|192.168.0.19\",\n \"message\":[\"Patio Door Closed\",\"Patio Door Opened\"],\n },\n \"Porch:Front Door:Tripped\":{\n \"ips\":\"192.168.0.16|192.168.0.19\",\n \"message\":[\"Front Door Closed\",\"Front Door Opened\"],\n },\n \"Porch:Letterbox:Tripped\":{\n \"ips\":\"192.168.0.16|192.168.0.19\",\n \"message\":[\"null\",\"Letter box Opened\"],\n },\n \"Back Garden:Garden Gate:Tripped\":{\n \"ips\":\"192.168.0.16|192.168.0.21\",\n \"message\":[\"Garden Gate Closed\",\"Garden Gate Opened\"],\n },\n \"Lounge:Fireplace:Status\":{\n \"ips\":\"192.168.0.16\",\n \"message\":[\"Turning Off Fireplace\",\"Turning On Fireplace\"],\n }\n}\nif(sensors[msg.topic]){\nlet sensor = sensors[msg.topic];\nmsg.payload = (msg.payload === true || msg.payload === 1) ? 1 : 0;\nif(sensor[\"message\"][msg.payload] !== \"null\"){\nmsg.payload = {\n \"message\": sensor[\"message\"][msg.payload],\n \"ip\": sensor[\"ips\"],\n \"volume\": sensor[\"volume\"]\n }\nmsg.sensor = true;\nreturn msg;\n}else{\n return;\n}\n}else{\n return;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":360,"wires":[["de79989a.a52818"]]},{"id":"de79989a.a52818","type":"function","z":"2c1c608.171caa","name":"function for TTS","func":"var IPS = msg.payload.ip.split(\"|\");\nvar message = msg.payload.message;\nvar ttsVolume = msg.payload.volume || global.get(\"ttsVolumeDefault\") || 60;\nfor (var i in IPS) { \n //msg.ttsVolume = true;\n msg.payload = {\"type\":\"VOLUME\",\"volume\":ttsVolume,\"ip\":IPS[i]};\n node.send([null,msg]);\nmsg.payload = {\n type: \"TTS\",\n text: message,\n language: \"En-gb\",\n ip: IPS[i],\n }\nmsg.iptts = IPS[i];\nnode.send([null, [msg]]);\n}\nif(!msg.sensor){\nmsg.payload = \"ok\"; // the response message\nreturn [msg];\n}else{\n return;\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":240,"y":240,"wires":[["3be8a007.b440f"],["961c039f.d9511"]]},{"id":"624339ce.70a148","type":"http in","z":"2c1c608.171caa","name":"http request from Vera scene","url":"sceneTrigger","method":"get","upload":false,"swaggerDoc":"","x":160,"y":140,"wires":[["de79989a.a52818"]]},{"id":"3be8a007.b440f","type":"http response","z":"2c1c608.171caa","name":"http response","statusCode":"200","headers":{},"x":400,"y":40,"wires":[]},{"id":"961c039f.d9511","type":"switch","z":"2c1c608.171caa","name":"IP Switch","property":"payload.ip","propertyType":"msg","rules":[{"t":"eq","v":"192.168.0.16","vt":"str"},{"t":"eq","v":"192.168.0.19","vt":"str"},{"t":"eq","v":"192.168.0.20","vt":"str"},{"t":"eq","v":"192.168.0.21","vt":"str"},{"t":"eq","v":"192.168.0.24","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":440,"y":200,"wires":[["bcb2ede6.8e6be"],["ae3e1796.60de38"],["f0ddf7c4.b12bb8"],["3b8e7ccb.9fd924"],["f8a77c67.f07e1"]]},{"id":"bcb2ede6.8e6be","type":"castv2-sender","z":"2c1c608.171caa","name":"Lounge Mini .16","connection":"6f8783fb.3dd50c","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":740,"y":160,"wires":[["fe70ae7a.b52e4","bf3a7cec.7b0c2"]],"icon":"node-red-contrib-cast/google-home-mini2.svg"},{"id":"ae3e1796.60de38","type":"castv2-sender","z":"2c1c608.171caa","name":"Kitchen Home .19","connection":"84b64104.c6bd5","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":750,"y":260,"wires":[["b9e34b7e.af5118","d781600d.1fe4e"]],"icon":"node-red-contrib-cast/google-home1.svg"},{"id":"f0ddf7c4.b12bb8","type":"castv2-sender","z":"2c1c608.171caa","name":"Bathroom Mini .20","connection":"eefe01fb.d0bec","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":750,"y":360,"wires":[["4cdb0217.44aedc","686877d7.4b8df8"]],"icon":"node-red-contrib-cast/google-home-mini2.svg"},{"id":"3b8e7ccb.9fd924","type":"castv2-sender","z":"2c1c608.171caa","name":"Masterbed Mini .21","connection":"7f5d6c3c.415914","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":750,"y":460,"wires":[["bc00f492.b58de8","7231cd7f.49e0b4"]],"icon":"node-red-contrib-cast/google-home-mini2.svg"},{"id":"f8a77c67.f07e1","type":"castv2-sender","z":"2c1c608.171caa","name":"Bedroom 2 Home .24","connection":"292a4ac3.634916","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":760,"y":560,"wires":[["de3f625d.eb99d","5b5dc80a.94bce8"]],"icon":"node-red-contrib-cast/google-home1.svg"},{"id":"fe70ae7a.b52e4","type":"debug","z":"2c1c608.171caa","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":" (payload.idleReason = \"FINISHED\" ? \"Done\" : \"\")\t & \" | \" & $moment().format(\"ddd HH:mm:ss\")\t","statusType":"jsonata","x":910,"y":60,"wires":[]},{"id":"b9e34b7e.af5118","type":"debug","z":"2c1c608.171caa","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":" (payload.idleReason = \"FINISHED\" ? \"Done\" : \"\")\t & \" | \" & $moment().format(\"ddd HH:mm:ss\")\t","statusType":"jsonata","x":910,"y":200,"wires":[]},{"id":"4cdb0217.44aedc","type":"debug","z":"2c1c608.171caa","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":" (payload.idleReason = \"FINISHED\" ? \"Done\" : \"\")\t & \" | \" & $moment().format(\"ddd HH:mm:ss\")\t","statusType":"jsonata","x":910,"y":300,"wires":[]},{"id":"bc00f492.b58de8","type":"debug","z":"2c1c608.171caa","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":" (payload.idleReason = \"FINISHED\" ? \"Done\" : \"\")\t & \" | \" & $moment().format(\"ddd HH:mm:ss\")\t","statusType":"jsonata","x":910,"y":400,"wires":[]},{"id":"de3f625d.eb99d","type":"debug","z":"2c1c608.171caa","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":" (payload.idleReason = \"FINISHED\" ? \"Done\" : \"\")\t & \" | \" & $moment().format(\"ddd HH:mm:ss\")\t","statusType":"jsonata","x":910,"y":500,"wires":[]},{"id":"8ecba8b2.49f138","type":"mios-in","z":"2c1c608.171caa","name":"MIOS IN","server":"db098590.052cd8","item":"","exact":false,"x":100,"y":360,"wires":[["bf3403b3.7926","41377e30.60137"]]},{"id":"de0f2132.c86fc","type":"comment","z":"2c1c608.171caa","name":"MIOS IN Debug Info Only","info":"This debug output can be used to monitor your Vera devices for their state / status changes, so you can work out what is the correct \"Item\" to be used in the \"function for MIOS device Status\" function node.\n\nSee \"MIOS IN device status\" comment for more information.","x":150,"y":420,"wires":[]},{"id":"d1a19516.6a44b8","type":"comment","z":"2c1c608.171caa","name":"HTTP Requests in from Vera","info":"Example 1:\n\nhttp://192.168.0.4:1880/sceneTrigger?message=Alarm%20Carbon%20Monoxide%20Detected&ip=192.168.0.16\n\nSays \"Alarm Carbon Monoxide Detected\" and sends it to one Google Home speaker for TTS announcement, with the IP address ending in .16\n\nExample 2:\n\nhttp://192.168.0.4:1880/sceneTrigger?message=Alarm%20Carbon%20Monoxide%20Detected&ip=192.168.0.16|192.168.0.19\n\nSends the same TTS message but to two Google Home speakers with the IP's ending in .16 and .19\n\n192.168.0.4 is the IP address of the node red instance.","x":160,"y":100,"wires":[]},{"id":"6b0de92b.8c47b8","type":"comment","z":"2c1c608.171caa","name":"MIOS IN device status","info":"In the \"function for MIOS device status\" this is where you specify the Vera devices you want to have monitored and linked to Google Home TTS. \n\nFor example when a door contact sensor is opened or closed.\n\nIn the function, under the \"let sensors\" section is where you specify them. \n\nHere is an example for my kitchen door.\n\n\"Kitchen:Patio Door:Tripped\" is the Item used to monitor this particular Vera device, to see if it is Tripped (1) or not tripped (0).\n\nYou can use the \"MIOS IN Debug Info Only\" output, to monitor your Vera devices whilst changing their state, to see what is the correct Item to use.\n\nThis is the code used for my kitchen door in the \"let sensors\" section of the function.\n\nThe TTS message spoken is either \"Patio Door Closed\" or \"Patio Door Opened\" and I am sending it to one Google Home speaker with the LAN IP ending in .16\n\n \"Kitchen:Patio Door:Tripped\":{\n \"ips\":\"192.168.0.16\",\n \"message\":[\"Patio Door Closed\",\"Patio Door Opened\"],\n\nTo send the TTS announcement to more than one Google Home speaker simply add its IP address like this:\n\n \"Kitchen:Patio Door:Tripped\":{\n \"ips\":\"192.168.0.16|192.168.0.19\",\n \"message\":[\"Patio Door Closed\",\"Patio Door Opened\"],\n\nHere is another example for my Fireplace turning on and off which is just an appliance plug. You can see the item is slightly different and using \"Lounge:Fireplace:Status\"\n\n\"Lounge:Fireplace:Status\":{\n \"ips\":\"192.168.0.16\",\n \"message\":[\"Turning Off Fireplace\",\"Turning On Fireplace\"],\n\nAgain the \"MIOS IN Debug Info Only\" output can be used to monitor your Vera devices state changing, so you can work out the correct Item to use in the function. \n\nIn this example I only wanted a TTS announcement when my Letterbox is opened NOT closed. So a \"null\" is added in to the message portion.\n\n\"Porch:Letterbox:Tripped\":{\n \"ips\":\"192.168.0.16|192.168.0.19\",\n \"message\":[\"null\",\"Letter box Opened\"],\n\nTo change the default volume levels see the \"Specify & Change Volume Levels\" comment.","x":200,"y":320,"wires":[]},{"id":"1c00911c.dbcccf","type":"comment","z":"2c1c608.171caa","name":"Home Speakers LAN IP's","info":"In the Switch specify each IP address of your Google Home speakers in the correct order.","x":450,"y":140,"wires":[]},{"id":"fb0d4947.9be478","type":"comment","z":"2c1c608.171caa","name":"CastV2 for each Home Speaker","info":"Create two CastV2 nodes for each of your Google Home speakers specifying their LAN IP address, the port number for each is the same, which is 8009. \n\nThe links from the \"IP Switch\" node must be in the correct order, so the IP address specified in the \"IP Switch\" node output, matches up to the correct CastV2 node with the same IP address etc. ","x":730,"y":120,"wires":[]},{"id":"bf3a7cec.7b0c2","type":"function","z":"2c1c608.171caa","name":"After TTS lower Volume","func":"if(msg.payload && msg.payload.idleReason && msg.payload.idleReason === \"FINISHED\"){\n msg.payload={\"type\":\"VOLUME\",\"volume\":(global.get(\"ttsVolumeReset\") || 35)};\n return msg;\n}\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":160,"wires":[["331cc661.d1453a"]]},{"id":"331cc661.d1453a","type":"castv2-sender","z":"2c1c608.171caa","name":"Lounge Mini .16","connection":"6f8783fb.3dd50c","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":1220,"y":160,"wires":[[]],"icon":"node-red-contrib-cast/google-home-mini2.svg"},{"id":"46266f73.79e6a","type":"comment","z":"2c1c608.171caa","name":"function for HTTP Commands","info":"On line 11, you can specifty the language e.g. English - Great Britian.\n\nlanguage: \"En-gb\",\n\nTo change the default volume levels see the \"Specify & Change Volume Levels\" comment.","x":200,"y":200,"wires":[]},{"id":"d781600d.1fe4e","type":"function","z":"2c1c608.171caa","name":"After TTS lower Volume","func":"if(msg.payload && msg.payload.idleReason && msg.payload.idleReason === \"FINISHED\"){\n msg.payload={\"type\":\"VOLUME\",\"volume\":(global.get(\"ttsVolumeReset\") || 35)};\n return msg;\n}\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":260,"wires":[["98993b95.546b58"]]},{"id":"98993b95.546b58","type":"castv2-sender","z":"2c1c608.171caa","name":"Kitchen Home .19","connection":"84b64104.c6bd5","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":1230,"y":260,"wires":[[]],"icon":"node-red-contrib-cast/google-home1.svg"},{"id":"e6ba51a7.28a89","type":"comment","z":"2c1c608.171caa","name":"Lowers Volume after TTS","info":"These functions are used to lower the volume level on the Google Home speakers afer the TTS announcement has finished.\n\nTo change the volume levels see the \"Specify & Change Volume Levels\" comment.","x":990,"y":120,"wires":[]},{"id":"ae9a4e19.f7c77","type":"inject","z":"2c1c608.171caa","name":"Click to Change Volume Levels","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":540,"wires":[["8cecb82b.e479c8"]]},{"id":"8cecb82b.e479c8","type":"change","z":"2c1c608.171caa","name":"Specify Volume Levels","rules":[{"t":"set","p":"ttsVolumeDefault","pt":"global","to":"60","tot":"num"},{"t":"set","p":"ttsVolumeReset","pt":"global","to":"35","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":540,"wires":[[]]},{"id":"79c350db.2b8c1","type":"comment","z":"2c1c608.171caa","name":"Specify & Change Volume Levels","info":"Use the \"Specify Volume Levels\" Change node, to set the global volume level the TTS announcement will play at, this is \"ttsVolumeDefault\" the default level is 60%\n\nAnd specify the volume level to return to after the TTS announcement has finished, this is \"ttsVolumeReset\" the default level is 35%\n\nThen click the Inject node named \"Click to Change Volume Levels\" to action the change.","x":170,"y":500,"wires":[]},{"id":"686877d7.4b8df8","type":"function","z":"2c1c608.171caa","name":"After TTS lower Volume","func":"if(msg.payload && msg.payload.idleReason && msg.payload.idleReason === \"FINISHED\"){\n msg.payload={\"type\":\"VOLUME\",\"volume\":(global.get(\"ttsVolumeReset\") || 35)};\n return msg;\n}\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":360,"wires":[["a507d574.4d0478"]]},{"id":"a507d574.4d0478","type":"castv2-sender","z":"2c1c608.171caa","name":"Bathroom Mini .20","connection":"eefe01fb.d0bec","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":1230,"y":360,"wires":[[]],"icon":"node-red-contrib-cast/google-home-mini2.svg"},{"id":"7231cd7f.49e0b4","type":"function","z":"2c1c608.171caa","name":"After TTS lower Volume","func":"if(msg.payload && msg.payload.idleReason && msg.payload.idleReason === \"FINISHED\"){\n msg.payload={\"type\":\"VOLUME\",\"volume\":(global.get(\"ttsVolumeReset\") || 35)};\n return msg;\n}\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":460,"wires":[["2d9427f6.1714c8"]]},{"id":"2d9427f6.1714c8","type":"castv2-sender","z":"2c1c608.171caa","name":"Masterbed Mini .21","connection":"7f5d6c3c.415914","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":1230,"y":460,"wires":[[]],"icon":"node-red-contrib-cast/google-home-mini2.svg"},{"id":"5b5dc80a.94bce8","type":"function","z":"2c1c608.171caa","name":"After TTS lower Volume","func":"if(msg.payload && msg.payload.idleReason && msg.payload.idleReason === \"FINISHED\"){\n msg.payload={\"type\":\"VOLUME\",\"volume\":(global.get(\"ttsVolumeReset\") || 35)};\n return msg;\n}\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":560,"wires":[["f23ad709.f3cc28"]]},{"id":"f23ad709.f3cc28","type":"castv2-sender","z":"2c1c608.171caa","name":"Bedroom 2 Home .24","connection":"292a4ac3.634916","spotifyAccessToken":"","spotifyAccessTokenExpiration":"","spotifyDeviceName":"","x":1240,"y":560,"wires":[[]],"icon":"node-red-contrib-cast/google-home1.svg"},{"id":"acbe0a8d.7e7578","type":"debug","z":"2c1c608.171caa","name":"Vera Debug","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":510,"y":420,"wires":[]},{"id":"41377e30.60137","type":"delay","z":"2c1c608.171caa","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":350,"y":420,"wires":[["acbe0a8d.7e7578"]]},{"id":"6f8783fb.3dd50c","type":"castv2-connection","z":"","name":"Lounge Mini","target":"","host":"192.168.0.16","port":"8009"},{"id":"84b64104.c6bd5","type":"castv2-connection","z":"","name":"Kitchen Home","target":"","host":"192.168.0.19","port":"8009"},{"id":"eefe01fb.d0bec","type":"castv2-connection","z":"","name":"Bathroom Mini","target":"","host":"192.168.0.20","port":"8009"},{"id":"7f5d6c3c.415914","type":"castv2-connection","z":"","name":"Masterbed Mini","target":"","host":"192.168.0.21","port":"8009"},{"id":"292a4ac3.634916","type":"castv2-connection","z":"","name":"Bedroom 2 Home","target":"","host":"192.168.0.24","port":"8009"},{"id":"db098590.052cd8","type":"mios-server","z":"","name":"Vera-Plus","host":"192.168.0.12","port":"3480"}]
Or you can import the attached .json file.
flows-Google-TTS.zip (4.1 KB)
Thank you once again to @ElCid for his expertise. 