Skip to end of metadata
Go to start of metadata

Information on scripting with functions


Purpose

System functions are used when a function must interface with either the HomeSeer application or the HomeSeer Phone application.  Since voice recognition and text-to-speech will use different output and input devices, these functions handle routing the sound information to and from the devices.

When a script calls hs.Speak, the sound is normally sent directly to the sound card on the PC.  However, if the script is run in response to a voice command over the phone, it is normally desired to send the sound over the phone's handset.  By calling system.Speak, HomeSeer knows where the request originated, and therefore routes the sound out through the proper device.

The system functions listed here are merely wrappers for the real functions in either the hs (HomeSeer object) or hsp (HomeSeer Phone object).  

When using the system functions, note that they only work from within the script that was initially launched. If you call a second script (using 
hs.Run or hs.RunEx), any system functions used in these scripts will not work on the desired audio channel. This is due to the way HomeSeer creates the system object when the initial script is launched. It has no information about sub scripts as to where the script was launched from. It therefore creates a default system object that assumes the script is dealing with the default audio channel.

Due to .NET using "system" as a NameSpace, VB.NET scripts must use "
hssystem" in place of "system".



Example

Speak a phrase

system.speak text as string, optional wait as boolean

Add a voice command

system.AddVoiceCommand command as string

Get the last recognized voice command

system.LastVoiceCommand as string

Clear all voice commands that were set using AddVoiceCommand

If the script is used over the phone and the "AddVoiceCommand" was used, then this must be called when the script exists so that the standard voice commands can be re-enabled.

system.ClearAllVoiceCommands

Stop voice recognition

system.StopListen

Start voice recognition

system.StartListen

Get the phone line that triggered the event (0=triggered by HomeSeer, and not the phone)

system.LastLine or system.SpeakSource

Start voice recognition

system.StartListen


  • No labels