![]() |
Helper Class Reference 1.4
HomeGenie - Automation Programs API
|
Program Helper class.
Class instance accessor: Program
More...
Public Member Functions | |
void | Setup (Action functionBlock) |
Execute a setup function when the program is enabled. It is meant to be used in the "Setup Code" to execute only once the instructions contained in the passed function. It is mainly used for setting program configuration fields, parameters and features. | |
void | Run (bool willRun) |
Run the program as soon as the "Setup Code" exits. This command is meant to be used in the "Setup Code". | |
ProgramHelper | UseWidget (string widget) |
Set the widget that will be used for displaying this program data in the UI Control page. | |
ProgramHelper | Implements (string interfaceId, string apiUrl, object options=null) |
Register this program as implementation of the specified interface. | |
ProgramHelper | AddOption (string field, string defaultValue, string description, string type) |
Adds a configuration option for the program. The option field will be displayed in the program options dialog using the UI widget specified by the "type" field. | |
ModuleParameter | Option (string field) |
Gets the value of a program option field. | |
ProgramHelper | AddFeature (string forDomains, string forModuleTypes, string parameterName, string description, string type) |
Adds a "feature" field to modules matching the specified domain/type. Feature fields are used by automation programs to create own handled module parameters. This command should only appear inside a Program.Setup delegate. | |
ProgramFeature | Feature (string parameterName) |
Return the feature field associated to the specified module parameter. | |
ProgramHelper | AddModule (string domain, string address, string type, string widget="", string[] implementedFeatures=null) |
Adds a new module to the system. | |
ProgramHelper | AddModules (string domain, int startAddress, int endAddress, string type, string widget="", string[] implementedFeatures=null) |
Adds a new set of modules to the system. | |
ProgramHelper | RemoveModule (string domain, string address) |
Remove a module from the system. | |
ProgramHelper | Notify (string message) |
Display UI notification message using the name of the program as default title for the notification. | |
ProgramHelper | Notify (string message, params object[] paramList) |
Display UI notification message using the name of the program as default title for the notification. | |
ProgramHelper | Notify (string title, string message) |
Display UI notification message from current program. | |
ProgramHelper | Notify (string title, string message, params object[] paramList) |
Display UI notification message from current program. | |
ProgramHelper | Emit (string parameter, object value, string description="") |
Emits a new parameter value. | |
void | GoBackground () |
This command is usually put at the end of the "Program Code". It is the equivalent of an infinite noop loop. | |
ModuleParameter | Parameter (string parameterName) |
Gets or sets a program parameter. | |
StoreHelper | Store (string storeName) |
Gets or creates a persistent data Store for this program. | |
bool | UpdateModuleDatabase () |
Force update module database with current data. | |
![]() | |
ProgramHelperBase | Say (string sentence, string locale=null, bool goAsync=false) |
Playbacks a synthesized voice message from speaker. | |
ProgramHelperBase | Play (string waveUrl) |
Playbacks a wave file. | |
Thread | RunAsyncTask (Utility.AsyncFunction functionBlock) |
Executes a function asynchronously. | |
void | Run (string programId, string options=null) |
Executes the specified Automation Program. | |
ProgramHelperBase | WaitFor (string programId) |
Waits for the given program to complete execution. | |
ProgramHelper | WithAddress (int programAddress) |
Returns a reference to the ProgramHelper of a program. | |
ProgramHelper | WithName (string programName) |
Returns a reference to the ProgramHelper of a program. | |
void | UpdateCheck () |
Checks for system updates. If an update is available it will be notified in the UI. | |
Properties | |
bool | IsRunning [get] |
Gets a value indicating whether the program is running. | |
bool | IsEnabled [get] |
Gets a value indicating whether the program is enabled. | |
Module | Module [get] |
Get a reference to the Module associated to the program. | |
String | SystemId [get] |
Get the UID of this HomeGenie instance. | |
![]() | |
NLog.Logger | Log [get] |
Gets the logger object. | |
Program Helper class.
Class instance accessor: Program
void Setup | ( | Action | functionBlock | ) |
Execute a setup function when the program is enabled. It is meant to be used in the "Setup Code" to execute only once the instructions contained in the passed function. It is mainly used for setting program configuration fields, parameters and features.
functionBlock | Function name or inline delegate. |
Example:
void Run | ( | bool | willRun | ) |
Run the program as soon as the "Setup Code" exits. This command is meant to be used in the "Setup Code".
willRun | If set to true will run. |
ProgramHelper UseWidget | ( | string | widget | ) |
Set the widget that will be used for displaying this program data in the UI Control page.
widget | The widget path. |
ProgramHelper Implements | ( | string | interfaceId, |
string | apiUrl, | ||
object | options = null |
||
) |
Register this program as implementation of the specified interface.
interfaceId | The string identifier of the implemented interface. (e.g. "@Statistics:Provider") |
apiUrl | Mandatory URL of API to call to get implementation details/config |
options | Optional custom object |
ProgramHelper AddOption | ( | string | field, |
string | defaultValue, | ||
string | description, | ||
string | type | ||
) |
Adds a configuration option for the program. The option field will be displayed in the program options dialog using the UI widget specified by the "type" field.
field | Name of this input field |
defaultValue | Default value for this input field |
description | Description for this input field |
type | The type of this option (eg. "text", "password", "cron.text", ...). Each type can have different initialization options that are specified as ":" separated items. See html/ui/widgets folder for a list of possible types/options. |
ModuleParameter Option | ( | string | field | ) |
Gets the value of a program option field.
field | Name of the option field to get. |
Example:
ProgramHelper AddFeature | ( | string | forDomains, |
string | forModuleTypes, | ||
string | parameterName, | ||
string | description, | ||
string | type | ||
) |
Adds a "feature" field to modules matching the specified domain/type. Feature fields are used by automation programs to create own handled module parameters. This command should only appear inside a Program.Setup delegate.
forDomains | Expression based on module domain names, used to select what modules will be showing this feature field. This can be either a valid Regular Expression enclosed by '/' and '/' delimiters or a simple comma (or '|') separated list of domain names (prepend '!' to a name to exclude it). |
forModuleTypes | Expression based on module types and parameters names, used to select what modules will be showing this feature field. This must be in the format <types_expr>[:<parameters_expr>] . <types_expr> and <parameters_expr> can be either a valid Regular Expression enclosed by '/' and '/' delimiters or a simple comma (or '|') separated list of names (prepend '!' to a name to exclude it). |
parameterName | Name of the module parameter bound to this feature field. |
description | Description for this input field. |
type | The type of this feature field (eg. "text", "password", "cron.text", ...). Each type can have different initialization options that are specified as ":" separated items. See html/ui/widgets folder for a list of possible types/options. |
ProgramFeature Feature | ( | string | parameterName | ) |
Return the feature field associated to the specified module parameter.
parameterName | Parameter name. |
ProgramHelper AddModule | ( | string | domain, |
string | address, | ||
string | type, | ||
string | widget = "" , |
||
string[] | implementedFeatures = null |
||
) |
Adds a new module to the system.
domain | Domain. |
address | Address. |
type | Type (Generic, Program, Switch, Light, Dimmer, Sensor, Temperature, Siren, Fan, Thermostat, Shutter, DoorWindow, MediaTransmitter, MediaReceiver). |
widget | Widget to display this modules with. |
implementedFeatures | Allow only features explicitly declared in this list |
ProgramHelper AddModules | ( | string | domain, |
int | startAddress, | ||
int | endAddress, | ||
string | type, | ||
string | widget = "" , |
||
string[] | implementedFeatures = null |
||
) |
Adds a new set of modules to the system.
domain | Domain. |
startAddress | Start address (numeric). |
endAddress | End address (numeric). |
type | Type (Generic, Program, Switch, Light, Dimmer, Sensor, Temperature, Siren, Fan, Thermostat, Shutter, DoorWindow, MediaTransmitter, MediaReceiver). |
widget | Widget to display these modules with. |
implementedFeatures | Allow only features explicitly declared in this list |
ProgramHelper RemoveModule | ( | string | domain, |
string | address | ||
) |
Remove a module from the system.
domain | Domain. |
address | Address. |
ProgramHelper Notify | ( | string | message | ) |
Display UI notification message using the name of the program as default title for the notification.
message | Message. |
Example:
ProgramHelper Notify | ( | string | message, |
params object[] | paramList | ||
) |
Display UI notification message using the name of the program as default title for the notification.
message | Formatted message. |
paramList | Format parameter list. |
Example:
ProgramHelper Notify | ( | string | title, |
string | message | ||
) |
Display UI notification message from current program.
title | Title. |
message | Message. |
Example:
ProgramHelper Notify | ( | string | title, |
string | message, | ||
params object[] | paramList | ||
) |
Display UI notification message from current program.
title | Title. |
message | Formatted message. |
paramList | Format parameter list. |
ProgramHelper Emit | ( | string | parameter, |
object | value, | ||
string | description = "" |
||
) |
Emits a new parameter value.
parameter | Parameter name. |
value | The new parameter value to set. |
description | Event description. (optional) |
ModuleParameter Parameter | ( | string | parameterName | ) |
Gets or sets a program parameter.
parameterName | Parameter name. |
Example:
StoreHelper Store | ( | string | storeName | ) |
Gets or creates a persistent data Store for this program.
storeName | Store name. |
|
get |
Gets a value indicating whether the program is running.
true
if this program is running; otherwise, false
.
|
get |
Gets a value indicating whether the program is enabled.
true
if this program is enabled; otherwise, false
.
Get a reference to the Module associated to the program.
Module object associated to the program.
|
get |
Get the UID of this HomeGenie instance.
The unique identifier string of this system.