Class ActionTypeCollection
public class ActionTypeCollection : BaseTypeCollection<AbstractActionType>
Inherited Members
Namespace: HomeSeer.PluginSdk.Events
Assembly: PluginSdk.dll
A collection of AbstractActionTypes that can be used by users to create HomeSeer Event Actions.
An instance of this class is a field on AbstractPlugin initialized in the constructor. In addition, all calls from HomeSeer related to actions are automatically routed through that instance.
Remarks
Add action types supported by your plugin using AddActionType(Type)
Due to the fact that HomeSeer saves the index of the action 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 AbstractActionType being instantiated and producing errors because the configuration parameters and signature of the action type do not match.
Constructors
View SourceActionTypeCollection(ActionTypeCollection.IActionTypeListener)
Initialize a new instance of an ActionTypeCollection with the specified listener
Declaration
public ActionTypeCollection(ActionTypeCollection.IActionTypeListener listener)
Parameters
Type | Name | Description |
---|---|---|
ActionTypeCollection.IActionTypeListener | listener | An ActionTypeCollection.IActionTypeListener that will be passed to action types |
Fields
View Source_listener
Declaration
ActionTypeCollection.IActionTypeListener _listener
Field Value
Type | Description |
---|---|
ActionTypeCollection.IActionTypeListener |
Properties
View SourceActionTypes
System.Collections.Generic.List<T> of System.Type that are a subclass of AbstractActionType
Declaration
public List<Type> ActionTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Type> |
Remarks
These represent the types of AbstractActionType that are available for users
LogDebug
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 |
Methods
View SourceActionReferencesDeviceOrFeature(Int32, TrigActInfo)
Called by HomeSeer when it needs to determine if a specific device/feature is referenced by a particular action.
Declaration
public bool ActionReferencesDeviceOrFeature(int devOrFeatRef, TrigActInfo actInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | devOrFeatRef | The unique Ref of the device/feature |
TrigActInfo | actInfo | The action to check |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the action references the specified device/feature, FALSE if it does not. |
AddActionType(Type)
Add the specified class type that derives from AbstractActionType to the list of actions
Declaration
public void AddActionType(Type actionType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | actionType | The System.Type of the class that derives from AbstractActionType |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the specified class type will not work as an action |
GetName(Int32)
Get the name of the action type at the specified index
Declaration
public string GetName(int actionIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | actionIndex | The 1 based index of the action type to get the name for |
Returns
Type | Description |
---|---|
System.String | The name of the action type |
GetObjectFromActInfo(TrigActInfo)
Get an instance of an AbstractActionType from a TrigActInfo.
Declaration
public AbstractActionType GetObjectFromActInfo(TrigActInfo actInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | actInfo | An instance of TrigActInfo that represents an action. |
Returns
Type | Description |
---|---|
AbstractActionType | An instance of an AbstractActionType. This will be one of the types in the ActionTypes list. |
Remarks
TANumber is used to identify which of the AbstractActionTypes is used.
Exceptions
Type | Condition |
---|---|
System.TypeLoadException | Thrown if the AbstractActionType that is referenced by TANumber does not have the proper constructor. |
HandleAction(TrigActInfo)
Called by HomeSeer when an event has been triggered and a corresponding action needs to be processed.
Declaration
public bool HandleAction(TrigActInfo actInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | actInfo | The action that is being executed |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the action executed successfully, FALSE if there was an error executing the action. |
IsActionConfigured(TrigActInfo)
Called by HomeSeer when it needs to determine if a specific action is completely configured or requires additional configuration before it can be used.
Declaration
public bool IsActionConfigured(TrigActInfo actInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | actInfo | The action to check |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the action is completely configured, FALSE if it is not. A call to OnGetActionUi(TrigActInfo) will be called following this if FALSE is returned. |
OnGetActionPrettyString(TrigActInfo)
Called by HomeSeer when it needs to get an easy to read, formatted string that communicates what the action does to the user.
Declaration
public string OnGetActionPrettyString(TrigActInfo actInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | actInfo | The action that a pretty string is needed for |
Returns
Type | Description |
---|---|
System.String | HTML formatted text communicating what the action does |
OnGetActionUi(TrigActInfo)
Called by HomeSeer when it needs to display the configuration UI for an action type
Declaration
public string OnGetActionUi(TrigActInfo actInfo)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | actInfo | The action to display as defined by TrigActInfo |
Returns
Type | Description |
---|---|
System.String | HTML to display on the event page for the specified action |
OnUpdateActionConfig(Dictionary<String, String>, TrigActInfo)
Called by HomeSeer when a user updates the configuration of an action and those changes are in need of processing.
Declaration
public EventUpdateReturnData OnUpdateActionConfig(Dictionary<string, string> postData, TrigActInfo actInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | postData | A System.Collections.Generic.Dictionary<TKey, TValue> of changes to the action configuration |
TrigActInfo | actInfo | The action being configured |
Returns
Type | Description |
---|---|
EventUpdateReturnData | An EventUpdateReturnData describing the new state of the action that will be saved by HomeSeer. The action configuration will be saved if the result returned is an empty string. |