159 | | The functionality is also exposed programmatically via Lua code: |
160 | | {{{ |
161 | | luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", |
162 | | {Text="Welcome Home", Language="en", Volume=50, GroupDevices="667,668"}, |
163 | | 666) |
164 | | }}} |
165 | | |
| 159 | The functionality is also exposed programmatically via Lua code. |
| 160 | |
| 161 | Suppose you have 4 Sonos zones named Bedroom, Bathroom, Living-room and Kitchen. Your bedroom Sonos is linked to device 666 in your Vera. |
| 162 | |
| 163 | To play a message only in the bedroom, use this lua code: |
| 164 | {{{ |
| 165 | luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", |
| 166 | {Text="The sun shines outside", Language="en"}, |
| 167 | 666) |
| 168 | }}} |
167 | | |
168 | | By using the !GroupDevices parameter, it is even possible to activate the Text To Speech on several Sonos zones at the same time. This parameter represents a CSV list of deviceId's of other Sonos units that should be included during the save-say-restore model of the Say command. |
169 | | |
170 | | Notes: |
171 | | * This service may be removed at any time, as can happen with Google services. |
172 | | * Parameters not specified will default internally. (''Language=en'', ''!GroupDevices=""'', ''Volume=nil'') By default, the volume is not set. |
| 170 | Language is a string of 2 characters, like en, fr ... |
| 171 | |
| 172 | To play a message in the bedroom setting the volume for the message at level 60: |
| 173 | {{{ |
| 174 | luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", |
| 175 | {Text="The sun shines outside", Language="en", Volume=50}, |
| 176 | 666) |
| 177 | }}} |
| 178 | The volume will be adjusted to play the message, and finally restored to its previous level. |
| 179 | When the Volume parameter is not used, the volume is not adjusted and the message is played with the current volume. |
| 180 | |
| 181 | To play a synchronized message in the bedroom, the bathroom and the kitchen: |
| 182 | {{{ |
| 183 | luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", |
| 184 | {Text="The sun shines outside", Language="en", GroupZones="Bathroom,Kitchen"}, |
| 185 | 666) |
| 186 | }}} |
| 187 | After the text is said, the playback will be resumed on the 3 zones. |
| 188 | |
| 189 | To play a synchronized message in all rooms setting the volume for the message at level 60 in all rooms: |
| 190 | {{{ |
| 191 | luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", |
| 192 | {Text="The sun shines outside", Language="en", GroupZones="ALL", |
| 193 | Volume=60, SameVolumeForAll="true"}, |
| 194 | 666) |
| 195 | }}} |
| 196 | When the parameter !SameVolumeForAll is set to false or not set, the volume is adjusted only on the main zone, that is the bedroom in our example. |
| 197 | |
| 198 | To play a message in the bedroom using your personal OSX TTS server rather than using Google Internet service: |
| 199 | {{{ |
| 200 | luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", |
| 201 | {Text="The sun shines outside", Language="en", Engine="OSX_TTS_SERVER"}, |
| 202 | 666) |
| 203 | }}} |
| 204 | Two accepted values for the engine: "GOOGLE" for the Google Internet service and "OSX_TTS_SERVER" for a personal OSX TTS server. |
| 205 | |
| 206 | Notes: |
| 207 | * Google service may be removed at any time |
| 208 | * For !GroupZones, you have to use room names (zone names defined with your Sonos application), not the name of your Vera device |
| 209 | * It is possible to use the parameter named !GroupDevices in place of !GroupZones. In this case, you must have a device in the Vera for all the Sonos zones you want to address. The value is a CSV list of device ids. For example, if your living-room and kitchen Sonos are linked respectively to devices 667 and 668 in your Vera, you will use !GroupDevices="667,668". The !GroupDevices has been kept for compatibility reasons with old versions but the use of !GroupZones is now recommended. |
| 210 | * Parameters not specified will default internally. (''Language=en'', ''Engine=GOOGLE'', ''!GroupDevices=""'', ''!GroupZones=""'', ''Volume=nil'', ''!SameVolumeForAll=false'') |