Search Results for

    Show / Hide Table of Contents

    Class AbstractHsDevice

    • C#
    • Visual Basic
    [Obfuscation(Exclude = true, ApplyToMembers = true)]
    [Serializable]
    public abstract class AbstractHsDevice
    <Obfuscation(Exclude:=True, ApplyToMembers:=True)>
    <Serializable>
    Public MustInherit Class AbstractHsDevice
    Inheritance
    System.Object
    AbstractHsDevice
    HsDevice
    HsFeature
    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.Devices
    Assembly: PluginSdk.dll


    The base implementation of a HomeSeer device.

    Used to represent devices and features as either a HsDevice or HsFeature


    Remarks

    Due to the fact that both HsDevices and HsFeatures derive from this class some documentation may refer to either as a device. Be careful to ensure you know which one you are working with at all times to avoid unexpected InvalidOperationExceptions.

    Constructors

    View Source

    AbstractHsDevice()

    Create a new AbstractHsDevice with default properties

    Declaration
    • C#
    • Visual Basic
    protected AbstractHsDevice()
    Protected Sub New
    View Source

    AbstractHsDevice(Int32)

    Create a new AbstractHsDevice with a specific uniqueRef

    Declaration
    • C#
    • Visual Basic
    protected AbstractHsDevice(int uniqueRef)
    Protected Sub New(uniqueRef As Integer)
    Parameters
    Type Name Description
    System.Int32 uniqueRef

    The unique ID as an integer

    Fields

    View Source

    _address

    Declaration
    • C#
    • Visual Basic
    protected string _address
    Protected _address As String
    Field Value
    Type Description
    System.String
    View Source

    _assDevices

    Declaration
    • C#
    • Visual Basic
    protected HashSet<int> _assDevices
    Protected _assDevices As HashSet(Of Integer)
    Field Value
    Type Description
    System.Collections.Generic.HashSet<System.Int32>
    View Source

    _cacheChanges

    Flag used to indicate whether to cache changes in Changes when setting properties and not adjust the underlying value or to cache changes in Changes and adjust the underlying value.

    Declaration
    • C#
    • Visual Basic
    protected bool _cacheChanges
    Protected _cacheChanges As Boolean
    Field Value
    Type Description
    System.Boolean
    Remarks

    Setting this to TRUE allows you to quickly revert changes made by discarding Changes

    View Source

    _displayedStatus

    Declaration
    • C#
    • Visual Basic
    protected string _displayedStatus
    Protected _displayedStatus As String
    Field Value
    Type Description
    System.String
    View Source

    _image

    Declaration
    • C#
    • Visual Basic
    protected string _image
    Protected _image As String
    Field Value
    Type Description
    System.String
    View Source

    _interface

    Declaration
    • C#
    • Visual Basic
    protected string _interface
    Protected _interface As String
    Field Value
    Type Description
    System.String
    View Source

    _invalidValue

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

    _lastChange

    Declaration
    • C#
    • Visual Basic
    protected DateTime _lastChange
    Protected _lastChange As Date
    Field Value
    Type Description
    System.DateTime
    View Source

    _location

    Declaration
    • C#
    • Visual Basic
    protected string _location
    Protected _location As String
    Field Value
    Type Description
    System.String
    View Source

    _location2

    Declaration
    • C#
    • Visual Basic
    protected string _location2
    Protected _location2 As String
    Field Value
    Type Description
    System.String
    View Source

    _misc

    Declaration
    • C#
    • Visual Basic
    protected uint _misc
    Protected _misc As UInteger
    Field Value
    Type Description
    System.UInt32
    View Source

    _name

    Declaration
    • C#
    • Visual Basic
    protected string _name
    Protected _name As String
    Field Value
    Type Description
    System.String
    View Source

    _plugExtraData

    Declaration
    • C#
    • Visual Basic
    protected PlugExtraData _plugExtraData
    Protected _plugExtraData As PlugExtraData
    Field Value
    Type Description
    PlugExtraData
    View Source

    _relationship

    Declaration
    • C#
    • Visual Basic
    protected ERelationship _relationship
    Protected _relationship As ERelationship
    Field Value
    Type Description
    ERelationship
    View Source

    _status

    Declaration
    • C#
    • Visual Basic
    protected string _status
    Protected _status As String
    Field Value
    Type Description
    System.String
    View Source

    _statusString

    Declaration
    • C#
    • Visual Basic
    protected string _statusString
    Protected _statusString As String
    Field Value
    Type Description
    System.String
    View Source

    _typeInfo

    Declaration
    • C#
    • Visual Basic
    protected TypeInfo _typeInfo
    Protected _typeInfo As TypeInfo
    Field Value
    Type Description
    TypeInfo
    View Source

    _userAccess

    Declaration
    • C#
    • Visual Basic
    protected string _userAccess
    Protected _userAccess As String
    Field Value
    Type Description
    System.String
    View Source

    _userNote

    Declaration
    • C#
    • Visual Basic
    protected string _userNote
    Protected _userNote As String
    Field Value
    Type Description
    System.String
    View Source

    _value

    Declaration
    • C#
    • Visual Basic
    protected double _value
    Protected _value As Double
    Field Value
    Type Description
    System.Double
    View Source

    _version

    Declaration
    • C#
    • Visual Basic
    protected double _version
    Protected _version As Double
    Field Value
    Type Description
    System.Double
    View Source

    _voiceCommand

    Declaration
    • C#
    • Visual Basic
    protected string _voiceCommand
    Protected _voiceCommand As String
    Field Value
    Type Description
    System.String

    Properties

    View Source

    Address

    A physical address for the device/feature.

    Use this to store a unique identifier for the physical device this device/feature is associated with.

    Declaration
    • C#
    • Visual Basic
    public string Address { get; set; }
    Public Property Address As String
    Property Value
    Type Description
    System.String
    Remarks

    Since v1.2.5.0, this field is overloaded with the legacy Code field for backwards compatibility. If you are accessing a device/feature that was created using this API then you can safely ignore this remark. If you are accessing a device/feature that was created using the HS3 legacy API you may note that this field now includes the Code value if it exists. You can get the Code directly by using the Code field.

    This table shows the return value of Address based on the value stored in the HS database.

    Address ValueReturns
    Address OnlyAddress
    Code OnlyCode
    Address and CodeAddress-Code

    You can use GetAddressFromAddressString(String) and GetCodeFromAddressString(String) to pull the address and code, respectively, from this value.

    View Source

    AssociatedDevices

    A set of unique IDs that represent the devices/features that are associated with this device/feature

    Declaration
    • C#
    • Visual Basic
    public HashSet<int> AssociatedDevices { get; set; }
    Public Property AssociatedDevices As HashSet(Of Integer)
    Property Value
    Type Description
    System.Collections.Generic.HashSet<System.Int32>
    View Source

    Changes

    A collection of changes to the device/feature since its initialization

    Declaration
    • C#
    • Visual Basic
    public Dictionary<EProperty, object> Changes { get; }
    Public ReadOnly Property Changes As Dictionary(Of EProperty, Object)
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<EProperty, System.Object>
    Remarks

    This acts as a local cache and makes it easier to change multiple things about a device/feature and then send all of the changes to HomeSeer as a bundle via UpdateDeviceByRef(Int32, Dictionary<EProperty, Object>) or UpdateFeatureByRef(Int32, Dictionary<EProperty, Object>)

    View Source

    Code

    Get the code stored in the Address string.

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

    This field is only used for legacy support and grabs a value from the Address field directly. The code is grabbed from the Address field by using GetCodeFromAddressString(String)

    View Source

    DisplayedStatus

    The current status of the device/feature

    This is the exact string that users see in the UI

    Declaration
    • C#
    • Visual Basic
    public string DisplayedStatus { get; set; }
    Public Property DisplayedStatus As String
    Property Value
    Type Description
    System.String
    See Also
    StatusString
    View Source

    Image

    The address of an image that represents the current status of the device/feature

    Declaration
    • C#
    • Visual Basic
    public string Image { get; set; }
    Public Property Image As String
    Property Value
    Type Description
    System.String
    View Source

    Interface

    The ID of the interface that is responsible for processing interactions with this device/feature

    Declaration
    • C#
    • Visual Basic
    public string Interface { get; set; }
    Public Property Interface As String
    Property Value
    Type Description
    System.String
    View Source

    IsValueInvalid

    Whether the device/feature is in an invalid state and should display as such to users.

    Declaration
    • C#
    • Visual Basic
    public bool IsValueInvalid { get; set; }
    Public Property IsValueInvalid As Boolean
    Property Value
    Type Description
    System.Boolean
    Remarks

    Use this as a manual way to flag the device/feature as invalid when the automatic check through IsValueValid() will not produce the desired result. Setting this to TRUE will force the device/feature's state to invalid.

    View Source

    LastChange

    The date and time that this device/feature was last updated or changed

    Declaration
    • C#
    • Visual Basic
    public DateTime LastChange { get; set; }
    Public Property LastChange As Date
    Property Value
    Type Description
    System.DateTime
    View Source

    Location

    The primary location of the device/feature according to the locations configured on the user's system

    Declaration
    • C#
    • Visual Basic
    public string Location { get; set; }
    Public Property Location As String
    Property Value
    Type Description
    System.String
    Remarks

    Do not set this directly on features. It will be ignored/overwritten in favor of the location set on the owning device.

    To optimize the user experience, it is recommended to ask the user which location they wish to assign to a device before finishing the inclusion process.

    View Source

    Location2

    The secondary location of the device/feature according to the locations configured on the user's system

    Declaration
    • C#
    • Visual Basic
    public string Location2 { get; set; }
    Public Property Location2 As String
    Property Value
    Type Description
    System.String
    Remarks

    Do not set this directly on features. It will be ignored/overwritten in favor of the location2 set on the owning device.

    To optimize the user experience, it is recommended to ask the user which location they wish to assign to a device before finishing the inclusion process.

    View Source

    Misc

    A collection of bit flags used to represent various configuration options for a device/feature.

    It is not recommended to set this directly. Instead, use AddMiscFlag(EMiscFlag), RemoveMiscFlag(EMiscFlag), and ContainsMiscFlag(EMiscFlag) to interface with this property

    Declaration
    • C#
    • Visual Basic
    public uint Misc { get; set; }
    Public Property Misc As UInteger
    Property Value
    Type Description
    System.UInt32
    See Also
    EMiscFlag
    View Source

    Name

    The name of the device/feature

    Declaration
    • C#
    • Visual Basic
    public string Name { get; set; }
    Public Property Name As String
    Property Value
    Type Description
    System.String
    Remarks

    To optimize the user experience, it is recommended to ask the user what name they wish to assign to the device before finishing the inclusion process.

    View Source

    PlugExtraData

    A memory space available for plugins to store keyed and non-keyed data associated with the device/feature

    Declaration
    • C#
    • Visual Basic
    public PlugExtraData PlugExtraData { get; set; }
    Public Property PlugExtraData As PlugExtraData
    Property Value
    Type Description
    PlugExtraData
    Remarks

    Use this to store device/feature specific configuration options accessed via the DeviceConfig page

    See Also
    PlugExtraData
    View Source

    Ref

    The unique identifier for this device/feature. This is the primary key for devices and features in HomeSeer.

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

    Relationship

    The type of relationship this device/feature has with other devices/features. See ERelationship for valid types and more details.

    Declaration
    • C#
    • Visual Basic
    public ERelationship Relationship { get; set; }
    Public Property Relationship As ERelationship
    Property Value
    Type Description
    ERelationship
    Exceptions
    Type Condition
    DeviceRelationshipException

    Thrown when setting the relationship while there are listed devices/features still associated with this device/feature

    View Source

    Status

    The current status of the device/feature. (incorrect - the raw, unformatted status string)

    WARNING - This property is being replaced by StatusString and DisplayedStatus

    Declaration
    • C#
    • Visual Basic
    [Obsolete("This property is being replaced by StatusString and DisplayedStatus", false)]
    public string Status { get; set; }
    <Obsolete("This property is being replaced by StatusString and DisplayedStatus", False)>
    Public Property Status As String
    Property Value
    Type Description
    System.String
    View Source

    StatusString

    The raw, unformatted status of the device/feature.

    This is combined with a string returned from a StatusGraphic or StatusControl that matches the current Value to produce the DisplayedStatus

    Declaration
    • C#
    • Visual Basic
    public string StatusString { get; set; }
    Public Property StatusString As String
    Property Value
    Type Description
    System.String
    View Source

    TypeInfo

    Type info for this device/feature

    Declaration
    • C#
    • Visual Basic
    public TypeInfo TypeInfo { get; set; }
    Public Property TypeInfo As TypeInfo
    Property Value
    Type Description
    TypeInfo
    Remarks

    This is used to describe this device/feature in a manner that is easily understood by UI generation engines and other smart home platforms. When these systems can understand what this device/feature is, they are better able to tailor the experience of the user to their expectations.

    See Also
    TypeInfo
    View Source

    UserAccess

    A string representation of the HomeSeer user access rights for this device/feature

    Declaration
    • C#
    • Visual Basic
    public string UserAccess { get; set; }
    Public Property UserAccess As String
    Property Value
    Type Description
    System.String
    Remarks

    This is typically configured by users and can be safely ignored when creating a HsDevice or HsFeature

    View Source

    UserNote

    Notes attached to this device/feature by users

    Declaration
    • C#
    • Visual Basic
    public string UserNote { get; set; }
    Public Property UserNote As String
    Property Value
    Type Description
    System.String
    Remarks

    This is typically configured by users and can be safely ignored when creating a HsDevice or HsFeature

    View Source

    Value

    A numeric value representing the current state of the device/feature.

    Declaration
    • C#
    • Visual Basic
    public double Value { get; set; }
    Public Property Value As Double
    Property Value
    Type Description
    System.Double
    Remarks

    Although this is available on devices it should not be set directly. This should only be set on features; as the information of the identified primary feature will be automatically pushed to the device to better adhere to user experience expectations.

    This value relates to the TargetValue and TargetRange properties on the StatusControl and StatusGraphic classes.

    View Source

    Version

    The version of the internal structure used in HomeSeer Core to represent this device/feature

    Declaration
    • C#
    • Visual Basic
    public double Version { get; set; }
    Public Property Version As Double
    Property Value
    Type Description
    System.Double
    Remarks

    When loading a device/feature created by a legacy plugin this property is less than or equal to 3.2. When loading a device/feature created by a plugin using this SDK, this property is equal to 4.0

    To migrate a device/feature created by a legacy plugin, first clear all its attached StatusControl and StatusGraphic using ClearStatusControlsByRef(Int32) and ClearStatusGraphicsByRef(Int32), for features only recreate some new StatusControl and StatusGraphic using methods such as AddStatusControlToFeature(Int32, StatusControl) and AddStatusGraphicToFeature(Int32, StatusGraphic), then set the Version property to 4.0.

    View Source

    VoiceCommand

    A voice friendly command string used to identify this device/feature

    Declaration
    • C#
    • Visual Basic
    public string VoiceCommand { get; set; }
    Public Property VoiceCommand As String
    Property Value
    Type Description
    System.String

    Methods

    View Source

    AddMiscFlag(EMiscFlag)

    Add the specified EMiscFlag to the device/feature

    Declaration
    • C#
    • Visual Basic
    public void AddMiscFlag(EMiscFlag misc)
    Public Sub AddMiscFlag(misc As EMiscFlag)
    Parameters
    Type Name Description
    EMiscFlag misc

    The EMiscFlag to add

    View Source

    ClearMiscFlags()

    Clear all EMiscFlags on the device/feature.

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

    ContainsMiscFlag(EMiscFlag)

    Determine if the device/feature contains the specified EMiscFlag

    Declaration
    • C#
    • Visual Basic
    public bool ContainsMiscFlag(EMiscFlag misc)
    Public Function ContainsMiscFlag(misc As EMiscFlag) As Boolean
    Parameters
    Type Name Description
    EMiscFlag misc

    The EMiscFlag to look for

    Returns
    Type Description
    System.Boolean

    TRUE if the device/feature contains the EMiscFlag, FALSE if it does not.

    View Source

    GetAddressFromAddressString(String)

    Get the address from an address-code string.

    Declaration
    • C#
    • Visual Basic
    public static string GetAddressFromAddressString(string addressString)
    Public Shared Function GetAddressFromAddressString(addressString As String) As String
    Parameters
    Type Name Description
    System.String addressString

    The Address-Code value string to parse

    Returns
    Type Description
    System.String

    The Address value from the string

    Remarks

    HS3 supported an Address and Code field, but the Code field has been deprecated. The Address and Code fields used to also be combined into a single string with the format of ${ADDRESS}-${CODE}. The pseudocode for this is "${ADDRESS}-${CODE}".Trim('-'); To maintain backwards compatibility support, the Address field will be overloaded with the Code for devices created using HS3. Use this method to get the address from the returned address-code string.

    View Source

    GetCodeFromAddressString(String)

    Get the code from an address-code string.

    Declaration
    • C#
    • Visual Basic
    public static string GetCodeFromAddressString(string addressString)
    Public Shared Function GetCodeFromAddressString(addressString As String) As String
    Parameters
    Type Name Description
    System.String addressString

    The Address-Code value string to parse

    Returns
    Type Description
    System.String

    The Code value from the string

    Remarks

    HS3 supported an Address and Code field, but the Code field has been deprecated. The Address and Code fields used to also be combined into a single string with the format of ${ADDRESS}-${CODE}. The pseudocode for this is "${ADDRESS}-${CODE}".Trim('-'); To maintain backwards compatibility support, the Address field will be overloaded with the Code for devices created using HS3. Use this method to get the address from the returned address-code string.

    View Source

    GetMiscForFlags(EMiscFlag[])

    Get the value for any combination of EMiscFlags

    Declaration
    • C#
    • Visual Basic
    public static uint GetMiscForFlags(params EMiscFlag[] misc)
    Public Shared Function GetMiscForFlags(ParamArray misc As EMiscFlag()) As UInteger
    Parameters
    Type Name Description
    EMiscFlag[] misc

    EMiscFlags to combine

    Returns
    Type Description
    System.UInt32

    A uint representing the combined EMiscFlags

    View Source

    IsValueValid()

    Determine whether the current value is valid.

    Declaration
    • C#
    • Visual Basic
    protected virtual bool IsValueValid()
    Protected Overridable Function IsValueValid As Boolean
    Returns
    Type Description
    System.Boolean

    Always TRUE when not overriden

    View Source

    RemoveMiscFlag(EMiscFlag)

    Remove the specified EMiscFlag from the device/feature

    Declaration
    • C#
    • Visual Basic
    public void RemoveMiscFlag(EMiscFlag misc)
    Public Sub RemoveMiscFlag(misc As EMiscFlag)
    Parameters
    Type Name Description
    EMiscFlag misc

    The EMiscFlag to remove

    View Source

    RevertChanges()

    Clear all changes since initialization and reset the Changes property

    Declaration
    • C#
    • Visual Basic
    public void RevertChanges()
    Public Sub RevertChanges
    • View Source
    In This Article
    Back to top HomeSeer Technologies