Helper Class Reference  1.1
HomeGenie - Automation Programs' Engine SDK
Public Member Functions | Properties | List of all members
ModulesManager Class Reference

Modules Manager Helper class.
Offers methods for filtering, selecting and operate on a group of modules.
Class instance accessor: Modules More...

Inheritance diagram for ModulesManager:
ModuleHelper

Public Member Functions

ModulesManager InDomain (string domains)
 Select modules belonging to specified domains. More...
 
ModulesManager WithAddress (string addresses)
 Select modules with specified address. More...
 
ModulesManager WithName (string moduleNames)
 Select modules matching specified names. More...
 
ModulesManager OfDeviceType (string deviceTypes)
 Select modules of specified device types. More...
 
ModulesManager InGroup (string groups)
 Select modules included in specified groups. More...
 
ModulesManager WithParameter (string parameters)
 Select all modules having specified parameters. More...
 
ModulesManager WithFeature (string features)
 Select all modules having specified features. More...
 
ModulesManager WithoutFeature (string features)
 Select all modules NOT having specified features. More...
 
ModulesManager Each (Func< ModuleHelper, bool > callback)
 Iterate through each module in the current selection and pass it to the specified <callback>. To break the iteration, the callback must return true, otherwise false. More...
 
ModuleHelper Get ()
 Returns the module in the current selection. If the current selection contains more than one element, the first element will be returned. More...
 
ModulesManager Command (string command)
 Select an API command to be executed for selected modules. To perform the selected command, Execute or Set method must be invoked. More...
 
ModulesManager IterationDelay (double delaySeconds)
 Used before a command (Set, Execute, On, Off, Toggle, ...), it will put a pause after performing the command for each module in the current selection. More...
 
object GetValue (string options="")
 Execute current command on first selected module and return the response value. More...
 
ModulesManager Execute ()
 Execute current command for all selected modules. More...
 
ModulesManager Execute (string options)
 Execute current command with specified options. More...
 
ModulesManager Set ()
 Alias for Execute() More...
 
ModulesManager Set (string options)
 Alias for Execute(options) More...
 
ModulesManager On ()
 Turn on all selected modules. More...
 
ModulesManager Off ()
 Turn off all selected modules. More...
 
ModulesManager Toggle ()
 Toggle all selected modules. More...
 

Properties

Func< ModulesManager, TsList< Module > > ModulesListCallback [get, set]
 Gets or sets the modules set on which this helper class will be working on. More...
 
TsList< ModuleModules [get]
 Gets the complete modules list. More...
 
virtual TsList< ModuleSelectedModules [get]
 Return the list of selected modules. More...
 
List< string > Groups [get]
 Return the list of control groups. More...
 
double Level [get, set]
 Gets or sets "Status.Level" parameter of selected modules. If more than one module is selected, when reading this property the average level value is returned. More...
 
bool IsOn [get]
 Gets "on" status ("Status.Level" > 0). More...
 
bool IsOff [get]
 Gets "off" status ("Status.Level" == 0). More...
 
bool Alarmed [get]
 Gets "alarm" status ("Sensor.Alarm" > 0). More...
 
bool MotionDetected [get]
 Gets "motion detection" status ("Sensor.MotionDetect" > 0). More...
 
double Temperature [get]
 Gets temperature value ("Sensor.Temperature"). More...
 
double Luminance [get]
 Gets luminance value ("Sensor.Luminance"). More...
 
double Humidity [get]
 Gets humidity value ("Sensor.Humidity"). More...
 

Detailed Description

Modules Manager Helper class.
Offers methods for filtering, selecting and operate on a group of modules.
Class instance accessor: Modules

Member Function Documentation

ModulesManager InDomain ( string  domains)

Select modules belonging to specified domains.

Returns
ModulesManager
Parameters
domainsA string containing comma seperated domain names.

Example:

// turn off all z-wave lights
.InDomain("HomeAutomation.ZWave")
.OfDeviceType("Light,Dimmer")
.Off();
ModulesManager WithAddress ( string  addresses)

Select modules with specified address.

Returns
ModulesManager
Parameters
addressesA string containing comma seperated address values.

Example:

// turn on X10 units A2 and B5
Modules.WithAddress("A2,B5").On();
ModulesManager WithName ( string  moduleNames)

Select modules matching specified names.

Returns
ModulesManager
Parameters
moduleNamesA string containing comma seperated module names.

Example:

// turn off ceiling light
Modules.WithName("Ceiling Light").Off();
ModulesManager OfDeviceType ( string  deviceTypes)

Select modules of specified device types.

Returns
ModulesManager
Parameters
deviceTypesA string containing comma seperated type names.

Example:

// turn on all lights and appliances
Modules.OfDeviceType("Light,Dimmer,Switch").On();
ModulesManager InGroup ( string  groups)

Select modules included in specified groups.

Returns
ModulesManager
Parameters
groupsA string containing comma seperated group names.

Example:

Modules.InGroup("Living Room,Kitchen").Off();
ModulesManager WithParameter ( string  parameters)

Select all modules having specified parameters.

Returns
ModulesManager
Parameters
parametersA string containing comma seperated parameter names.

Example:

// select all modules with Sensor.Temperature parameter and get the average temperature value
var averagetemperature = Modules.WithParameter("Sensor.Temperature").Temperature;
Program.Notify("Average Temperature", averagetemperature);
ModulesManager WithFeature ( string  features)

Select all modules having specified features.

Returns
ModulesManager
Parameters
featureA string containing comma seperated feature names.

Example:

// Turn on all Security System sirens
Modules.WithFeature("HomeGenie.SecurityAlarm").On();
ModulesManager WithoutFeature ( string  features)

Select all modules NOT having specified features.

Returns
ModulesManager
Parameters
featureA string containing comma seperated feature names.

Example:

// Turn off all modules not having the "EnergySavingMode" feature
Modules.WithoutFeature("EnergyManagement.EnergySavingMode").Off();
ModulesManager Each ( Func< ModuleHelper, bool >  callback)

Iterate through each module in the current selection and pass it to the specified <callback>. To break the iteration, the callback must return true, otherwise false.

Parameters
callbackCallback function to call for each iteration.
Returns
ModulesManager

Example:

var total_watts_load = 0D;
Modules.WithParameter("Meter.Watts").Each( (module) => {
total_watts_load += module.Parameter("Meter.Watts").DecimalValue;
return false; // continue iterating
});
Program.Notify("Current power load", total_watts_load + " watts");
ModuleHelper Get ( )

Returns the module in the current selection. If the current selection contains more than one element, the first element will be returned.

Returns
ModuleHelper

Example:

var strobeAlarm = Modules.WithName("Strobe Alarm").Get();
ModulesManager Command ( string  command)

Select an API command to be executed for selected modules. To perform the selected command, Execute or Set method must be invoked.

Returns
ModulesManager
Parameters
commandAPI command to be performed.

Example:

// turn on all modues of "Light" type
Modules.OfDeviceType("Light").Command("Control.On").Execute();
// set all dimmers to 50%
Modules.OfDeviceType("Dimmer").Command("Control.Level").Set("50");
ModulesManager IterationDelay ( double  delaySeconds)

Used before a command (Set, Execute, On, Off, Toggle, ...), it will put a pause after performing the command for each module in the current selection.

Returns
ModulesManager
Parameters
delaySecondsDelay seconds.

Example:

// Set the level of all dimmer type modules to 40%,
// putting a 100ms delay between each command
.OfDeviceType("Dimmer")
.Command("Control.Level")
.IterationDelay(0.1)
.Set(40);
object GetValue ( string  options = "")

Execute current command on first selected module and return the response value.

Parameters
optionsOptions.
ModulesManager Execute ( )

Execute current command for all selected modules.

Returns
ModulesManager
ModulesManager Execute ( string  options)

Execute current command with specified options.

Parameters
optionsA string containing options to be passed to the selected command.
Returns
ModulesManager
ModulesManager Set ( )

Alias for Execute()

Returns
ModulesManager
ModulesManager Set ( string  options)

Alias for Execute(options)

Parameters
optionsA string containing options to be passed to the selected command.
Returns
ModulesManager

Turn on all selected modules.

Returns
ModulesManager
ModulesManager Off ( )

Turn off all selected modules.

Returns
ModulesManager
ModulesManager Toggle ( )

Toggle all selected modules.

Returns
ModulesManager

Property Documentation

Func<ModulesManager,TsList<Module> > ModulesListCallback
getset

Gets or sets the modules set on which this helper class will be working on.

The modules list callback.

TsList<Module> Modules
get

Gets the complete modules list.

The modules.

virtual TsList<Module> SelectedModules
get

Return the list of selected modules.

Returns
List<Module>
List<string> Groups
get

Return the list of control groups.

Returns
List<string>
double Level
getset

Gets or sets "Status.Level" parameter of selected modules. If more than one module is selected, when reading this property the average level value is returned.

The level (percentage value 0-100).

Example:

// Set the level of all modules with EnergySavingMode flag enabled to 40%
Modules.WithFeature("EnergyManagement.EnergySavingMode").Level = 40;
bool IsOn
get

Gets "on" status ("Status.Level" > 0).

true if at least one module in the current selection is on; otherwise, false.

bool IsOff
get

Gets "off" status ("Status.Level" == 0).

true if at least one module in the current selection is off; otherwise, false.

bool Alarmed
get

Gets "alarm" status ("Sensor.Alarm" > 0).

true if at least one module in the current is alarmed; otherwise, false.

bool MotionDetected
get

Gets "motion detection" status ("Sensor.MotionDetect" > 0).

true if at least one module in the current detected motion; otherwise, false.

double Temperature
get

Gets temperature value ("Sensor.Temperature").

The temperature parameter of selected module (average value is returned when more than one module is selected).

double Luminance
get

Gets luminance value ("Sensor.Luminance").

The luminance parameter of selected module (average value is returned when more than one module is selected).

double Humidity
get

Gets humidity value ("Sensor.Humidity").

The humidity parameter of selected module (average value is returned when more than one module is selected).


The documentation for this class was generated from the following file: