Class TriggerTypeCollection
public class TriggerTypeCollection : BaseTypeCollection<AbstractTriggerType>
Inherited Members
Namespace: HomeSeer.PluginSdk.Events
Assembly: PluginSdk.dll
A collection of AbstractTriggerTypes that can be used by users to create HomeSeer Event Triggers.
An instance of this class is a field on AbstractPlugin initialized in the constructor. In addition, all calls from HomeSeer related to triggers are automatically routed through that instance.
Remarks
Add trigger types supported by your plugin using AddTriggerType(Type)
Due to the fact that HomeSeer saves the index of the trigger type in its internal database, avoid changing the index of any of the types available to the user. Doing so may result in an incorrect AbstractTriggerType being instantiated and producing errors because the configuration parameters and signature of the trigger type do not match.
Constructors
View SourceTriggerTypeCollection(TriggerTypeCollection.ITriggerTypeListener)
Initialize a new instance of an TriggerTypeCollection with the specified listener
Declaration
public TriggerTypeCollection(TriggerTypeCollection.ITriggerTypeListener listener)
Parameters
Type | Name | Description |
---|---|---|
TriggerTypeCollection.ITriggerTypeListener | listener | An TriggerTypeCollection.ITriggerTypeListener that will be passed to trigger types |
Fields
View Source_listener
Declaration
TriggerTypeCollection.ITriggerTypeListener _listener
Field Value
Type | Description |
---|---|
TriggerTypeCollection.ITriggerTypeListener |
Properties
View SourceLogDebug
Used to enable/disable internal logging to the console
When it is TRUE, log messages from the PluginSdk code will be written to the Console
Declaration
public bool LogDebug { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
TriggerTypes
System.Collections.Generic.List<T> of System.Type that are a subclass of AbstractTriggerType
Declaration
public List<Type> TriggerTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Type> |
Remarks
These represent the types of AbstractTriggerType that are available for users
Methods
View SourceAddTriggerType(Type)
Add the specified class type that derives from AbstractTriggerType to the list of triggers
Declaration
public void AddTriggerType(Type triggerType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | triggerType | The System.Type of the class that derives from AbstractTriggerType |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the specified class type will not work as a trigger |
GetName(Int32)
Get the name of the trigger type at the specified index
Declaration
public string GetName(int triggerIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | triggerIndex | The 1 based index of the trigger type to get the name for |
Returns
Type | Description |
---|---|
System.String | The name of the trigger type |
GetObjectFromTrigInfo(TrigActInfo)
Get an instance of an AbstractTriggerType from a TrigActInfo.
Declaration
public AbstractTriggerType GetObjectFromTrigInfo(TrigActInfo trigInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | trigInfo | An instance of TrigActInfo that represents a trigger. |
Returns
Type | Description |
---|---|
AbstractTriggerType | An instance of an AbstractTriggerType. This will be one of the types in the TriggerTypes list. |
Remarks
TANumber is used to identify which of the AbstractTriggerTypes is used.
Exceptions
Type | Condition |
---|---|
System.TypeLoadException | Thrown if the AbstractTriggerType that is referenced by TANumber does not have the proper constructor. |
GetSubTriggerCount(Int32)
Called by HomeSeer to determine the number of available sub-trigger types available under the trigger type at the specified index.
Declaration
public int GetSubTriggerCount(int triggerIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | triggerIndex | The 1 based index of the trigger type to get the sub-trigger count for |
Returns
Type | Description |
---|---|
System.Int32 | The number of sub-trigger types available under the trigger type specified |
GetSubTriggerName(Int32, Int32)
Get the name of the sub-trigger type at the specified index
Declaration
public string GetSubTriggerName(int triggerIndex, int subTriggerIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | triggerIndex | The 1 based index of the trigger type the sub-trigger is a member of |
System.Int32 | subTriggerIndex | The 1 based index of the sub-trigger type to get the name for |
Returns
Type | Description |
---|---|
System.String | The name of the sub-trigger type |
IsTriggerConfigured(TrigActInfo)
Called by HomeSeer when it needs to determine if a specific trigger is completely configured or requires additional configuration before it can be used.
Declaration
public bool IsTriggerConfigured(TrigActInfo trigInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | trigInfo | The trigger to check |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the trigger is completely configured, FALSE if it is not. A call to OnGetTriggerUi(TrigActInfo) will be called following this if FALSE is returned. |
IsTriggerTrue(TrigActInfo, Boolean)
Called by HomeSeer to determine if a trigger's conditions have been met.
Declaration
public bool IsTriggerTrue(TrigActInfo trigInfo, bool isCondition)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | trigInfo | The trigger to check |
System.Boolean | isCondition | TRUE if the trigger is paired with other triggers, FALSE if it is alone. |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the trigger's conditions have been met, FALSE if they haven't |
OnGetTriggerPrettyString(TrigActInfo)
Called by HomeSeer when it needs to get an easy to read, formatted string that communicates what the trigger does to the user.
Declaration
public string OnGetTriggerPrettyString(TrigActInfo trigInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | trigInfo | The trigger that a pretty string is needed for |
Returns
Type | Description |
---|---|
System.String | HTML formatted text communicating what the trigger does |
OnGetTriggerUi(TrigActInfo)
Called by HomeSeer when it needs to display the configuration UI for a trigger type
Declaration
public string OnGetTriggerUi(TrigActInfo trigInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | trigInfo | The trigger to display as defined by TrigActInfo |
Returns
Type | Description |
---|---|
System.String | HTML to display on the event page for the specified trigger |
OnUpdateTriggerConfig(Dictionary<String, String>, TrigActInfo)
Called by HomeSeer when a user updates the configuration of a trigger and those changes are in need of processing.
Declaration
public EventUpdateReturnData OnUpdateTriggerConfig(Dictionary<string, string> postData, TrigActInfo trigInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | postData | A System.Collections.Generic.Dictionary<TKey, TValue> of changes to the trigger configuration |
TrigActInfo | trigInfo | The trigger being configured |
Returns
Type | Description |
---|---|
EventUpdateReturnData | An EventUpdateReturnData describing the new state of the trigger that will be saved by HomeSeer. The trigger configuration will be saved if the result returned is an empty string. |
TriggerCanBeCondition(Int32)
Called by HomeSeer to determine if a particular trigger can be used as a condition or not. A condition is a trigger that operates in conjunction with another trigger in an AND/OR pattern.
Declaration
public bool TriggerCanBeCondition(int triggerIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | triggerIndex | The 1 based index of the trigger type to check |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the trigger can be used as a condition, FALSE if it can not. |
TriggerReferencesDeviceOrFeature(Int32, TrigActInfo)
Called by HomeSeer when it needs to determine if a specific device/feature is referenced by a particular trigger.
Declaration
public bool TriggerReferencesDeviceOrFeature(int devOrFeatRef, TrigActInfo trigInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | devOrFeatRef | The unique Ref of the device/feature |
TrigActInfo | trigInfo | The trigger to check |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the trigger references the specified device/feature, FALSE if it does not. |