Search Results for

    Show / Hide Table of Contents

    Class AbstractPlugin

    • C#
    • Visual Basic
    public abstract class AbstractPlugin : IPlugin, ActionTypeCollection.IActionTypeListener, TriggerTypeCollection.ITriggerTypeListener
    Public MustInherit Class AbstractPlugin
        Implements IPlugin, ActionTypeCollection.IActionTypeListener, TriggerTypeCollection.ITriggerTypeListener
    Inheritance
    System.Object
    AbstractPlugin
    Implements
    IPlugin
    ActionTypeCollection.IActionTypeListener
    TriggerTypeCollection.ITriggerTypeListener
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: HomeSeer.PluginSdk
    Assembly: PluginSdk.dll


    The base implementation of the IPlugin interface.

    It includes default implementations for most of the IPlugin members and wraps others with convenience methods and objects that make it simpler to interface with the HomeSeer system.

    Once the containing plugin application is started, initiate a connection to the HomeSeer system by calling Connect(String[]).

    All plugins (the HSPI class) should derive from this class.

    Basic Usage

    Define a class in your plugin called HSPI that inherits from AbstractPlugin and implement the required members:

    • AbstractPlugin.Id
    • AbstractPlugin.Name
    • AbstractPlugin.Initialize()
    • AbstractPlugin.OnSettingChange(string, AbstractView, AbstractView)
    • AbstractPlugin.BeforeReturnStatus()
    • AbstractPlugin.PostBackProc(string, string, string, int)
    public class HSPI : AbstractPlugin {
        
    	public override string Id { get; } = "PLUGINID";
    	public override string Name { get; } = "PLUGINNAME"
    	
    	public HSPI() {	}
    	
    	protected override void Initialize() {
    		//Initialize the starting state of the plugin
    		Status = PluginStatus.Ok();
    	}
    	
    	protected override bool OnSettingChange(string pageId, AbstractView currentView, AbstractView changedView) {
    		//React to changes to your plugin settings
    	}
    	
    	protected override void BeforeReturnStatus() {
    		//Update the status of your plugin before it is returned to HomeSeer
    	}
    	
    	public override string PostBackProc(string page, string data, string user, int userRights) {
    		//React to HTTP POST methods sent to feature pages owned by this plugin
    	}
    }
    

    Constructors

    View Source

    AbstractPlugin()

    Default constructor that initializes the Action and Trigger type collections

    Declaration
    • C#
    • Visual Basic
    protected AbstractPlugin()
    Protected Sub New

    Fields

    View Source

    _client

    Declaration
    • C#
    • Visual Basic
    static IScsServiceClient<IHsController> _client
    Shared _client As IScsServiceClient(Of IHsController)
    Field Value
    Type Description
    HSCF.Communication.ScsServices.Client.IScsServiceClient<IHsController>
    View Source

    _isShutdown

    Declaration
    • C#
    • Visual Basic
    bool _isShutdown
    _isShutdown As Boolean
    Field Value
    Type Description
    System.Boolean
    View Source

    _logDebug

    Declaration
    • C#
    • Visual Basic
    bool _logDebug
    _logDebug As Boolean
    Field Value
    Type Description
    System.Boolean
    View Source

    HomeSeerPort

    Declaration
    • C#
    • Visual Basic
    const int HomeSeerPort = 10400
    Const HomeSeerPort As Integer = 10400
    Field Value
    Type Description
    System.Int32
    View Source

    SettingsSectionName

    Default section name for storing settings in an INI file

    Declaration
    • C#
    • Visual Basic
    protected const string SettingsSectionName = "Settings"
    Protected Const SettingsSectionName As String = "Settings"
    Field Value
    Type Description
    System.String

    Properties

    View Source

    AccessLevel

    Return the access level of this plug-in. Access level is the licensing mode. Use the integer value corresponding to the EAccessLevel for your plugin

    Declaration
    • C#
    • Visual Basic
    public virtual int AccessLevel { get; }
    Public Overridable ReadOnly Property AccessLevel As Integer
    Property Value
    Type Description
    System.Int32
    View Source

    ActionCount

    The number of unique event actions the plugin supports

    Declaration
    • C#
    • Visual Basic
    public int ActionCount { get; }
    Public ReadOnly Property ActionCount As Integer
    Property Value
    Type Description
    System.Int32
    View Source

    ActionTypes

    The collection of action types that this plugin hosts for HomeSeer

    Declaration
    • C#
    • Visual Basic
    protected ActionTypeCollection ActionTypes { get; set; }
    Protected Property ActionTypes As ActionTypeCollection
    Property Value
    Type Description
    ActionTypeCollection
    View Source

    HasSettings

    Whether the plugin has settings pages or not.

    If this is TRUE, you must return valid JUI data in GetJuiSettingsPages()

    Declaration
    • C#
    • Visual Basic
    public virtual bool HasSettings { get; }
    Public Overridable ReadOnly Property HasSettings As Boolean
    Property Value
    Type Description
    System.Boolean
    Remarks

    The default implementation should be sufficient for all purposes; returning TRUE if the Settings property contains pages or FALSE if it doesn't.

    Override this and always return TRUE if you plan on adding settings pages to the collection later

    View Source

    HomeSeerSystem

    An instance of the HomeSeer system

    Declaration
    • C#
    • Visual Basic
    protected IHsController HomeSeerSystem { get; }
    Protected ReadOnly Property HomeSeerSystem As IHsController
    Property Value
    Type Description
    IHsController
    View Source

    Id

    Unique ID for this plugin, needs to be unique for all plugins.

    Do NOT use special characters or spaces in your plugin ID

    Declaration
    • C#
    • Visual Basic
    public abstract string Id { get; }
    Public MustOverride ReadOnly Property Id As String
    Property Value
    Type Description
    System.String
    Remarks

    The ID is used throughout the HomeSeer platform to target this plugin specifically via URL or internal code. It is recommended to use the name of your plugin, removing special characters and spaces, as the ID to make it easy to match them with one-another.

    View Source

    IpAddress

    The IP Address that the HomeSeer system is located at

    Declaration
    • C#
    • Visual Basic
    protected string IpAddress { get; set; }
    Protected Property IpAddress As String
    Property Value
    Type Description
    System.String
    View Source

    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
    • C#
    • Visual Basic
    protected bool LogDebug { get; set; }
    Protected Property LogDebug As Boolean
    Property Value
    Type Description
    System.Boolean
    View Source

    Name

    The name of the plugin

    Do NOT use special characters in your plugin name with the exception of "-", ".", and " " (space).

    This is used to identify your plug-in to HomeSeer and your users. Keep the name to 16 characters or less.

    Declaration
    • C#
    • Visual Basic
    public abstract string Name { get; }
    Public MustOverride ReadOnly Property Name As String
    Property Value
    Type Description
    System.String
    View Source

    Settings

    The collection of settings pages for the plugin. See SettingsCollection for more information.

    Declaration
    • C#
    • Visual Basic
    protected SettingsCollection Settings { get; set; }
    Protected Property Settings As SettingsCollection
    Property Value
    Type Description
    SettingsCollection
    View Source

    SettingsFileName

    The name of the settings INI file for the plugin.

    It is recommended to use [PLUGIN-ID].ini where [PLUGIN-ID] is the ID of this plugin

    Declaration
    • C#
    • Visual Basic
    protected virtual string SettingsFileName { get; }
    Protected Overridable ReadOnly Property SettingsFileName As String
    Property Value
    Type Description
    System.String
    View Source

    Status

    The current status of the plugin.

    Default state is OK

    Declaration
    • C#
    • Visual Basic
    protected virtual PluginStatus Status { get; set; }
    Protected Overridable Property Status As PluginStatus
    Property Value
    Type Description
    PluginStatus
    Remarks

    This property is often queried by HomeSeer before interfacing with the plugin during normal operation of the system to determine if it should continue making calls or report to the user that the plugin may be inoperable. This is also queried when users navigate to the plugin management page.

    See Also
    PluginStatus
    View Source

    SupportsConfigDevice

    Whether this plugin supports a device configuration page for devices created/managed by it

    TRUE will cause HomeSeer to call GetJuiDeviceConfigPage() for devices this plugin manages. FALSE means HomeSeer will not call GetJuiDeviceConfigPage() for any devices

    Declaration
    • C#
    • Visual Basic
    public virtual bool SupportsConfigDevice { get; }
    Public Overridable ReadOnly Property SupportsConfigDevice As Boolean
    Property Value
    Type Description
    System.Boolean
    View Source

    SupportsConfigDeviceAll

    Whether this plugin supports a device configuration page for all devices

    TRUE will cause HomeSeer to call GetJuiDeviceConfigPage() for every device. FALSE means HomeSeer will not call GetJuiDeviceConfigPage() for all devices

    Declaration
    • C#
    • Visual Basic
    public virtual bool SupportsConfigDeviceAll { get; }
    Public Overridable ReadOnly Property SupportsConfigDeviceAll As Boolean
    Property Value
    Type Description
    System.Boolean
    View Source

    SupportsConfigFeature

    Whether this plugin supports a feature configuration page for features created/managed by it

    TRUE will cause HomeSeer to call GetJuiDeviceConfigPage() for features this plugin manages. FALSE means HomeSeer will not call GetJuiDeviceConfigPage() for any features

    Declaration
    • C#
    • Visual Basic
    public virtual bool SupportsConfigFeature { get; }
    Public Overridable ReadOnly Property SupportsConfigFeature As Boolean
    Property Value
    Type Description
    System.Boolean
    Remarks

    Setting this to TRUE allows you to display a unique page for each feature instead of using a single page for the device and all of its features.

    View Source

    TriggerCount

    The number of unique event triggers the plugin supports

    Declaration
    • C#
    • Visual Basic
    public int TriggerCount { get; }
    Public ReadOnly Property TriggerCount As Integer
    Property Value
    Type Description
    System.Int32
    View Source

    TriggerTypes

    The collection of trigger types that this plugin hosts for HomeSeer

    Declaration
    • C#
    • Visual Basic
    protected TriggerTypeCollection TriggerTypes { get; set; }
    Protected Property TriggerTypes As TriggerTypeCollection
    Property Value
    Type Description
    TriggerTypeCollection

    Methods

    View Source

    ActionBuildUI(TrigActInfo)

    Called by the HomeSeer system when an event is in edit mode and in need of HTML controls for the user.

    Declaration
    • C#
    • Visual Basic
    public string ActionBuildUI(TrigActInfo actInfo)
    Public Function ActionBuildUI(actInfo As TrigActInfo) As String
    Parameters
    Type Name Description
    TrigActInfo actInfo

    Object that contains information about the action like current selections.

    Returns
    Type Description
    System.String

    HTML controls that need to be displayed so the user can select the action parameters.

    View Source

    ActionConfigured(TrigActInfo)

    Called by the HomeSeer system to verify that the configuration is valid and can be saved

    Declaration
    • C#
    • Visual Basic
    public bool ActionConfigured(TrigActInfo actInfo)
    Public Function ActionConfigured(actInfo As TrigActInfo) As Boolean
    Parameters
    Type Name Description
    TrigActInfo actInfo

    Object describing the action.

    Returns
    Type Description
    System.Boolean

    TRUE if the given action is configured properly; FALSE if the action shouldn't be saved

    View Source

    ActionFormatUI(TrigActInfo)

    Called by the HomeSeer system when an event action is finished being configured and needs to be displayed in an easy to read format.

    Declaration
    • C#
    • Visual Basic
    public string ActionFormatUI(TrigActInfo actInfo)
    Public Function ActionFormatUI(actInfo As TrigActInfo) As String
    Parameters
    Type Name Description
    TrigActInfo actInfo

    Object that contains information about the current configuration of the trigger.

    Returns
    Type Description
    System.String

    HTML representing easy to read text describing the action

    View Source

    ActionProcessPostUI(Dictionary<String, String>, TrigActInfo)

    Called by the HomeSeer system to process selections when a user edits your event actions.

    Declaration
    • C#
    • Visual Basic
    public EventUpdateReturnData ActionProcessPostUI(Dictionary<string, string> postData, TrigActInfo actInfo)
    Public Function ActionProcessPostUI(postData As Dictionary(Of String, String), actInfo As TrigActInfo) As EventUpdateReturnData
    Parameters
    Type Name Description
    System.Collections.Generic.Dictionary<System.String, System.String> postData

    A collection of name value pairs that include the user's selections.

    TrigActInfo actInfo
    Returns
    Type Description
    EventUpdateReturnData

    Object the holds the parsed information for the action. HomeSeer will save this information for you in the database.

    View Source

    ActionReferencesDevice(TrigActInfo, Int32)

    Called by the HomeSeer system to determine if a specified device is referenced by a certain action.

    Declaration
    • C#
    • Visual Basic
    public bool ActionReferencesDevice(TrigActInfo actInfo, int dvRef)
    Public Function ActionReferencesDevice(actInfo As TrigActInfo, dvRef As Integer) As Boolean
    Parameters
    Type Name Description
    TrigActInfo actInfo

    Object describing the action.

    System.Int32 dvRef
    Returns
    Type Description
    System.Boolean

    TRUE if the action references the device; FALSE if it does not

    View Source

    BeforeReturnStatus()

    Called immediately before the plugin returns its Status to HomeSeer.

    Use this to analyze the current state of the plugin and update the Status accordingly.

    Declaration
    • C#
    • Visual Basic
    protected abstract void BeforeReturnStatus()
    Protected MustOverride Sub BeforeReturnStatus
    See Also
    PluginStatus
    View Source

    Connect(Int32)

    Declaration
    • C#
    • Visual Basic
    void Connect(int attempts)
    Sub Connect(attempts As Integer)
    Parameters
    Type Name Description
    System.Int32 attempts
    View Source

    Connect(String[])

    Attempt to establish a connection to the HomeSeer system

    This connection will be maintained as long as the program is running or until ShutdownIO() is called.

    Declaration
    • C#
    • Visual Basic
    public void Connect(string[] args)
    Public Sub Connect(args As String())
    Parameters
    Type Name Description
    System.String[] args

    Command line arguments included in the execution of the program

    View Source

    GetActionNameByNumber(Int32)

    Return the name of the action given an action number

    The name of the action will be displayed in the HomeSeer events actions list.

    Declaration
    • C#
    • Visual Basic
    public string GetActionNameByNumber(int actionNum)
    Public Function GetActionNameByNumber(actionNum As Integer) As String
    Parameters
    Type Name Description
    System.Int32 actionNum

    The number of the action to get the name for

    Returns
    Type Description
    System.String

    The name of the action associated with the action number

    View Source

    GetJuiDeviceConfigPage(Int32)

    Called by the HomeSeer software to obtain a HS-JUI device or feature configuration page for a specific device or feature

    Declaration
    • C#
    • Visual Basic
    public virtual string GetJuiDeviceConfigPage(int devOrFeatRef)
    Public Overridable Function GetJuiDeviceConfigPage(devOrFeatRef As Integer) As String
    Parameters
    Type Name Description
    System.Int32 devOrFeatRef

    The device or feature reference to get the page for

    Returns
    Type Description
    System.String

    A JSON serialized Jui.Page

    View Source

    GetJuiSettingsPages()

    Called by the HomeSeer software to obtain a list of settings pages

    Declaration
    • C#
    • Visual Basic
    public string GetJuiSettingsPages()
    Public Function GetJuiSettingsPages As String
    Returns
    Type Description
    System.String

    A SettingsCollection serialized to a JSON string

    View Source

    GetSubTriggerCount(Int32)

    Returns the number of sub triggers the plugin supports for the specified trigger number

    Declaration
    • C#
    • Visual Basic
    public int GetSubTriggerCount(int triggerNum)
    Public Function GetSubTriggerCount(triggerNum As Integer) As Integer
    Parameters
    Type Name Description
    System.Int32 triggerNum

    The number of the trigger to check

    Returns
    Type Description
    System.Int32

    The number of sub triggers the specified trigger number supports

    View Source

    GetSubTriggerNameByNumber(Int32, Int32)

    The name of the sub trigger with the specified number of the trigger with the specified number

    Declaration
    • C#
    • Visual Basic
    public string GetSubTriggerNameByNumber(int triggerNum, int subTriggerNum)
    Public Function GetSubTriggerNameByNumber(triggerNum As Integer, subTriggerNum As Integer) As String
    Parameters
    Type Name Description
    System.Int32 triggerNum

    The number of the trigger to check

    System.Int32 subTriggerNum

    The number of the sub trigger to check

    Returns
    Type Description
    System.String

    The name of the sub trigger

    View Source

    GetTriggerNameByNumber(Int32)

    Return the name of the given trigger based on the specified trigger number

    Declaration
    • C#
    • Visual Basic
    public string GetTriggerNameByNumber(int triggerNum)
    Public Function GetTriggerNameByNumber(triggerNum As Integer) As String
    Parameters
    Type Name Description
    System.Int32 triggerNum

    The trigger number to get the name for

    Returns
    Type Description
    System.String

    The name of the trigger

    View Source

    HandleAction(TrigActInfo)

    Called by the HomeSeer system when an event is triggered and the plugin needs to carry out a specific action.

    Declaration
    • C#
    • Visual Basic
    public bool HandleAction(TrigActInfo actInfo)
    Public Function HandleAction(actInfo As TrigActInfo) As Boolean
    Parameters
    Type Name Description
    TrigActInfo actInfo

    Object describing the trigger and action.

    Returns
    Type Description
    System.Boolean

    TRUE if the action was executed successfully; FALSE if there was an error

    View Source

    HasJuiDeviceConfigPage(Int32)

    Called by HomeSeer Core to determine if a device or feature configuration page is available for a particular device or feature. Only called if SupportsConfigDevice or SupportsConfigFeature or SupportsConfigDeviceAll is set to TRUE.

    Declaration
    • C#
    • Visual Basic
    public virtual bool HasJuiDeviceConfigPage(int devOrFeatRef)
    Public Overridable Function HasJuiDeviceConfigPage(devOrFeatRef As Integer) As Boolean
    Parameters
    Type Name Description
    System.Int32 devOrFeatRef

    The Ref of the device

    Returns
    Type Description
    System.Boolean

    True if there is a page available, false if not. Returning True will cause HomeSeer Core to call GetJuiDeviceConfigPage(Int32) for the device or feature

    Remarks

    Default behavior is to show a configuration page for every device when SupportsConfigDevice or SupportsConfigFeature or SupportsConfigDeviceAll is set to true. Adjust this behavior if the plugin only shows a configuration page for some, but not all, devices.

    View Source

    HsEvent(Constants.HSEvent, Object[])

    When you wish to have HomeSeer call back in to your plug-in or application when certain events happen in the system, call the RegisterEventCB procedure and provide it with event you wish to monitor.
    See RegisterEventCB for more information and an example and event types.

    The parameters are passed in an array of objects. Each entry in the array is a parameter. The number of entries depends on the type of event and are described below. The event type is always present in the first entry or params(0).

    Declaration
    • C#
    • Visual Basic
    public virtual void HsEvent(Constants.HSEvent eventType, object[] params)
    Public Overridable Sub HsEvent(eventType As Constants.HSEvent, params As Object())
    Parameters
    Type Name Description
    Constants.HSEvent eventType

    The type of event that has occurred

    System.Object[] params

    The data associated with the event

    View Source

    Initialize()

    Called by the HomeSeer system to initialize the plugin.

    This is the primary entry point for all plugins. Start the plugin and get it ready for use.

    Declaration
    • C#
    • Visual Basic
    protected abstract void Initialize()
    Protected MustOverride Sub Initialize
    View Source

    InitIO()

    Called by HomeSeer to initialize the plugin.

    Perform all initialization logic in Initialize()

    Declaration
    • C#
    • Visual Basic
    public bool InitIO()
    Public Function InitIO As Boolean
    Returns
    Type Description
    System.Boolean

    TRUE if the plugin started successfully; FALSE if it did not

    You should opt for throwing an exception that contains a detailed messaged over returning FALSE whenever possible.

    View Source

    IsTriggerConfigValid(TrigActInfo)

    Given a TrigActInfo object, detect if this trigger is configured properly

    Declaration
    • C#
    • Visual Basic
    public bool IsTriggerConfigValid(TrigActInfo trigInfo)
    Public Function IsTriggerConfigValid(trigInfo As TrigActInfo) As Boolean
    Parameters
    Type Name Description
    TrigActInfo trigInfo

    The trigger info to validate

    Returns
    Type Description
    System.Boolean

    TRUE if the trigger is configured properly, FALSE otherwise

    View Source

    LoadSettingsFromIni()

    Loads the plugin settings saved to INI to Settings and saves default values if none exist.

    Declaration
    • C#
    • Visual Basic
    protected void LoadSettingsFromIni()
    Protected Sub LoadSettingsFromIni
    View Source

    OnDeviceConfigChange(Page, Int32)

    Called when there are changes to the device or feature config page that need to be processed and saved

    Declaration
    • C#
    • Visual Basic
    protected virtual bool OnDeviceConfigChange(Page deviceConfigPage, int devOrFeatRef)
    Protected Overridable Function OnDeviceConfigChange(deviceConfigPage As Page, devOrFeatRef As Integer) As Boolean
    Parameters
    Type Name Description
    Page deviceConfigPage

    A JUI page containing only the new state of any changed views

    System.Int32 devOrFeatRef

    The reference of the device or feature the config page is for

    Returns
    Type Description
    System.Boolean

    TRUE if the save was successful; FALSE if it was not

    You should throw an exception including a detailed message whenever possible over returning FALSE

    View Source

    OnSettingChange(String, AbstractView, AbstractView)

    Called when there is a change to a setting that needs to be processed

    Declaration
    • C#
    • Visual Basic
    protected abstract bool OnSettingChange(string pageId, AbstractView currentView, AbstractView changedView)
    Protected MustOverride Function OnSettingChange(pageId As String, currentView As AbstractView, changedView As AbstractView) As Boolean
    Parameters
    Type Name Description
    System.String pageId

    The ID of the page the view is on

    AbstractView currentView

    The state of the setting before the change

    AbstractView changedView

    The state of the settings after the change

    Returns
    Type Description
    System.Boolean

    TRUE if the change should be saved, FALSE if it should not

    You should throw an exception including a detailed message whenever possible over returning FALSE

    View Source

    OnSettingPageSave(Page)

    Called when there are changes to settings that need to be processed for a specific page.

    Declaration
    • C#
    • Visual Basic
    protected virtual void OnSettingPageSave(Page pageDelta)
    Protected Overridable Sub OnSettingPageSave(pageDelta As Page)
    Parameters
    Type Name Description
    Page pageDelta

    The page with view changes to be processed

    Exceptions
    Type Condition
    System.Collections.Generic.KeyNotFoundException

    Thrown when a view change targets a view that doesn't exist on the page

    View Source

    OnSettingsLoad()

    Called right before the data held in Settings is serialized and sent to HomeSeer.

    Use this if you need to process anything when the plugin settings are loaded. Otherwise, it is typically unnecessary to override this. The SettingsCollection class automatically takes care of the JSON serialization/deserialization process.

    Declaration
    • C#
    • Visual Basic
    protected virtual void OnSettingsLoad()
    Protected Overridable Sub OnSettingsLoad
    View Source

    OnShutdown()

    Called right before the plugin shuts down.

    Declaration
    • C#
    • Visual Basic
    protected virtual void OnShutdown()
    Protected Overridable Sub OnShutdown
    View Source

    OnStatusCheck()

    Called by the HomeSeer system to determine the status of the plugin.

    Declaration
    • C#
    • Visual Basic
    public PluginStatus OnStatusCheck()
    Public Function OnStatusCheck As PluginStatus
    Returns
    Type Description
    PluginStatus

    A PluginStatus object describing the state of the plugin

    See Also
    PluginStatus
    View Source

    PluginFunction(String, Object[])

    Called by the HomeSeer system to run a plugin function by name using reflection

    Declaration
    • C#
    • Visual Basic
    public virtual object PluginFunction(string procName, object[] params)
    Public Overridable Function PluginFunction(procName As String, params As Object()) As Object
    Parameters
    Type Name Description
    System.String procName

    The name of the method to execute

    System.Object[] params

    The parameters to execute the method with

    Returns
    Type Description
    System.Object

    The result of the method execution

    View Source

    PluginPropertyGet(String)

    Called by the HomeSeer system to get the value of a property by name using reflection

    Declaration
    • C#
    • Visual Basic
    public virtual object PluginPropertyGet(string propName)
    Public Overridable Function PluginPropertyGet(propName As String) As Object
    Parameters
    Type Name Description
    System.String propName

    The name of the property

    Returns
    Type Description
    System.Object

    The value of the property

    View Source

    PluginPropertySet(String, Object)

    Called by the HomeSeer system to set the value of a property by name using reflection

    Declaration
    • C#
    • Visual Basic
    public virtual void PluginPropertySet(string propName, object value)
    Public Overridable Sub PluginPropertySet(propName As String, value As Object)
    Parameters
    Type Name Description
    System.String propName

    The name of the property

    System.Object value

    The new value of the property

    View Source

    PostBackProc(String, String, String, Int32)

    Called by the HomeSeer system when a page owned by this plugin receives an HTTP POST request

    Declaration
    • C#
    • Visual Basic
    public virtual string PostBackProc(string page, string data, string user, int userRights)
    Public Overridable Function PostBackProc(page As String, data As String, user As String, userRights As Integer) As String
    Parameters
    Type Name Description
    System.String page

    The page that received the POST request

    System.String data

    The data included in the request

    System.String user

    The user responsible for initiating the request

    System.Int32 userRights

    The user's rights

    Returns
    Type Description
    System.String

    A string of data that is returned to the requester

    View Source

    SaveJuiDeviceConfigPage(String, Int32)

    Save updated values for a HS-JUI formatted device or feature config page

    Declaration
    • C#
    • Visual Basic
    public bool SaveJuiDeviceConfigPage(string pageContent, int devOrFeatRef)
    Public Function SaveJuiDeviceConfigPage(pageContent As String, devOrFeatRef As Integer) As Boolean
    Parameters
    Type Name Description
    System.String pageContent

    A JSON serialized Jui.Page describing what has changed about the page

    System.Int32 devOrFeatRef

    The reference of the device or feature the config page is for

    Returns
    Type Description
    System.Boolean

    TRUE if the save was successful; FALSE if it was unsuccessful.

    An exception should be thrown with details about the error if it was unsuccessful

    View Source

    SaveJuiSettingsPages(String)

    Called by the HomeSeer system when settings changes need to be saved

    Declaration
    • C#
    • Visual Basic
    public bool SaveJuiSettingsPages(string jsonString)
    Public Function SaveJuiSettingsPages(jsonString As String) As Boolean
    Parameters
    Type Name Description
    System.String jsonString

    A List of Jui.Pages containing views that have changed, serialized as JSON

    Returns
    Type Description
    System.Boolean

    TRUE if the save was successful; FALSE if it was unsuccessful.

    An exception should be thrown with details about the error if it was unsuccessful

    View Source

    SetIOMulti(List<ControlEvent>)

    Called by the HomeSeer system when a device that this plugin owns is controlled.

    A plugin owns a device when its Interface property is set to the plugin ID.

    Declaration
    • C#
    • Visual Basic
    public virtual void SetIOMulti(List<ControlEvent> colSend)
    Public Overridable Sub SetIOMulti(colSend As List(Of ControlEvent))
    Parameters
    Type Name Description
    System.Collections.Generic.List<ControlEvent> colSend
    Remarks

    The default behavior is to clear the current status text and set the value on the target feature and then let HomeSeer assign the status text based on the configured StatusControls and StatusGraphics

    View Source

    ShutdownIO()

    Called by the HomeSeer system to shutdown the plugin and its operations

    Declaration
    • C#
    • Visual Basic
    public void ShutdownIO()
    Public Sub ShutdownIO
    View Source

    SpeakIn(Int32, String, Boolean, String)

    If your plug-in is registered as a Speak proxy plug-in, then when HomeSeer is asked to speak something. It will pass the speak information to your plug-in using this procedure. When your plug-in is ready to do the actual speaking, it should call SpeakProxy, and pass the information that it got from this procedure to SpeakProxy. It may be necessary or a feature of your plug-in to modify the text being spoken or the host/instance list provided in the host parameter - this is acceptable.

    Declaration
    • C#
    • Visual Basic
    public virtual void SpeakIn(int speechDevice, string spokenText, bool wait, string host)
    Public Overridable Sub SpeakIn(speechDevice As Integer, spokenText As String, wait As Boolean, host As String)
    Parameters
    Type Name Description
    System.Int32 speechDevice

    This is the device that is to be used for the speaking. In older versions of HomeSeer, this value was used to indicate the sound card to use, and if it was over 100, then it indicated that it was speaking for HomeSeer Phone (device - 100 = phone line), or the WAV audio device to use. Although this is still used for HomeSeer Phone, speaks for HomeSeer phone are never proxied and so values >= 100 should never been seen in the device parameter. Pass the device parameter unchanged to SpeakProxy.

    System.String spokenText

    This is the text to be spoken, or if it is a WAV file to be played, then the characters ":&quot; will be found starting at position 2 of the string as playing a WAV file with the speak command in HomeSeer REQUIRES a fully qualified path and filename of the WAV file to play.

    System.Boolean wait

    This parameter tells HomeSeer whether to continue processing commands immediately or to wait until the speak command is finished - pass this parameter unchanged to SpeakProxy.

    System.String host

    This is a list of host:instances to speak or play the WAV file on. An empty string or a single asterisk (*) indicates all connected speaker clients on all hosts. Normally this parameter is passed to SpeakProxy unchanged.

    Remarks

    PLEASE NOTE: Code related to the Speech components in HomeSeer were ported from the HS3 plugin API and have not been fully tested to verify full functionality from the new SDK. The Speech API may undergo significant changes in the near future. Please use with caution.

    View Source

    TriggerBuildUI(TrigActInfo)

    Called by the HomeSeer system when an event is in edit mode and in need of HTML controls for the user.

    Declaration
    • C#
    • Visual Basic
    public string TriggerBuildUI(TrigActInfo trigInfo)
    Public Function TriggerBuildUI(trigInfo As TrigActInfo) As String
    Parameters
    Type Name Description
    TrigActInfo trigInfo

    Object that contains information about the current configuration of the trigger.

    Returns
    Type Description
    System.String

    HTML controls that need to be displayed so the user can select the trigger parameters.

    View Source

    TriggerCanBeCondition(Int32)

    Called by HomeSeer to determine if a given trigger can also be used as a condition

    Declaration
    • C#
    • Visual Basic
    public bool TriggerCanBeCondition(int triggerNum)
    Public Function TriggerCanBeCondition(triggerNum As Integer) As Boolean
    Parameters
    Type Name Description
    System.Int32 triggerNum

    The number of the trigger to check

    Returns
    Type Description
    System.Boolean

    TRUE if the given trigger can also be used as a condition, for the given trigger number.

    View Source

    TriggerFormatUI(TrigActInfo)

    Called by the HomeSeer system when an event trigger is finished being configured and needs to be displayed in an easy to read format.

    Declaration
    • C#
    • Visual Basic
    public string TriggerFormatUI(TrigActInfo trigInfo)
    Public Function TriggerFormatUI(trigInfo As TrigActInfo) As String
    Parameters
    Type Name Description
    TrigActInfo trigInfo

    Object that contains information about the current configuration of the trigger.

    Returns
    Type Description
    System.String

    HTML representing easy to read text describing the trigger

    View Source

    TriggerProcessPostUI(Dictionary<String, String>, TrigActInfo)

    Called by the HomeSeer system to process selections when a user edits your event triggers.

    Declaration
    • C#
    • Visual Basic
    public EventUpdateReturnData TriggerProcessPostUI(Dictionary<string, string> postData, TrigActInfo trigInfoIn)
    Public Function TriggerProcessPostUI(postData As Dictionary(Of String, String), trigInfoIn As TrigActInfo) As EventUpdateReturnData
    Parameters
    Type Name Description
    System.Collections.Generic.Dictionary<System.String, System.String> postData

    A collection of name value pairs that include the user's selections.

    TrigActInfo trigInfoIn

    Object that contains information about the trigger.

    Returns
    Type Description
    EventUpdateReturnData

    Object the holds the parsed information for the trigger. HomeSeer will save this information for you in the database.

    View Source

    TriggerReferencesDeviceOrFeature(TrigActInfo, Int32)

    Called by the HomeSeer system to determine if a specified device is referenced by a certain trigger.

    Declaration
    • C#
    • Visual Basic
    public bool TriggerReferencesDeviceOrFeature(TrigActInfo trigInfo, int devOrFeatRef)
    Public Function TriggerReferencesDeviceOrFeature(trigInfo As TrigActInfo, devOrFeatRef As Integer) As Boolean
    Parameters
    Type Name Description
    TrigActInfo trigInfo

    Object describing the trigger.

    System.Int32 devOrFeatRef

    The reference ID of the device or feature to check

    Returns
    Type Description
    System.Boolean

    TRUE if the trigger references the device; FALSE if it does not

    View Source

    TriggerTrue(TrigActInfo, Boolean)

    Called by HomeSeer when a trigger needs to be evaluated as a condition

    Declaration
    • C#
    • Visual Basic
    public bool TriggerTrue(TrigActInfo trigInfo, bool isCondition = false)
    Public Function TriggerTrue(trigInfo As TrigActInfo, isCondition As Boolean = False) As Boolean
    Parameters
    Type Name Description
    TrigActInfo trigInfo

    Object describing the trigger

    System.Boolean isCondition

    TRUE if the trigger represents a condition, FALSE if it is a trigger

    Returns
    Type Description
    System.Boolean

    TRUE if the conditions are met; FALSE if they are not

    View Source

    UpdateStatusNow(Int32)

    Called by the HomeSeer system when it needs the current status for a device/feature owned by the plugin.

    This should force the device/feature to update its current status on HomeSeer.

    Declaration
    • C#
    • Visual Basic
    public virtual EPollResponse UpdateStatusNow(int devOrFeatRef)
    Public Overridable Function UpdateStatusNow(devOrFeatRef As Integer) As EPollResponse
    Parameters
    Type Name Description
    System.Int32 devOrFeatRef

    The reference ID of the device/feature to poll

    Returns
    Type Description
    EPollResponse

    An EPollResponse describing the result of the request

    Implements

    IPlugin
    ActionTypeCollection.IActionTypeListener
    TriggerTypeCollection.ITriggerTypeListener
    • View Source
    In This Article
    Back to top HomeSeer Technologies