Charmed Quark Systems, Ltd. - Support Forums and Community

Full Version: Whole house announcements with Nuvo & TTS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to figure out the most effective way to do this. I'd love to be able to write a function that takes in text to say and then:

1 - For each Nuvo Zone, save its settings to 3 Local vars - ExistingPowerState, ExistingVolumeLevel, ExistingSource. (All prefixed with Z1, Z2, etc).
2 - Change every zone to be powered on, volume level -5, and source6 selected
3 - use CQC Speech SayText to make whatever announcement (this text would be a param to the function)
4 - Using the variables saved in step #1, reset all zones back to their previous settings.

Is there a good way to do this so that I don't have to duplicate code across a number of events/triggers? Is there a way to know when the SayText has completed? I noticed a slight lag between when I make the call and when its actually spoken over the speakers.
Yeh, the Speech II driver directly supports this functionality. You can configure it with three CML macros which it will call. It's all described on the driver docs page, but basically it will call one before any speech is about to start. It will call another for each new speech event. Then it will call another when all currently queued up speech is done.

Those three insertion points (and often you only need two, the first and last) provide you with the means to store current state and switch to announcement states, then put back the stored state at the end.

For the middle macro (called for each new speech event), there's a backdoor command for the driver that lets you queue up text to speak, but also to provide some custom data, and that custom data is passed to the per-event macro. You may not have a use for it, but it could be used to set up something specifically for particular types of announcements. So, in that case it would be:

1. On the start macro, save state
2. On each new event macro, look at the custom data and set up for that type of announcement
3. Restore state at the end.

Otherwise it's just:

1. On start, save state and set up for announcments
2. Don't use it
3. Restore state at the end
For me and my Russound system, I didn't want announcements at 6am when the garbage truck comes so my event checks the power state of each zone. If it's currently on, then it will change the source to announcements, adjust the volume, then restore everything after the announcement. The only announcements I want are alarm, fire alarm, driveway alert and doorbell. Only driveway alert polls, the rest will turn on all or specific zones.
I'm a newb to writing macros. Any pointers on creating one that will read/write Device fields? Or standon, mind sharing yours?
It would be a little tricky to do anything extensive if aren't comfortable writing CML. There are error conditions to deal with and that sort of thing. But, given a basic example, mostly it would be more of the same. I don't have a working code base for the moment, but later when I can do it I will try to give an example.
I've written CML a long while ago, definitely rusty on it. I did a quick look and didn't see how to read a device driver's values from CML. Any examples of that?
Use the SimpleFldClient class. It has methods for reading and writing fields.