Class DeviceFactory
public class DeviceFactory
Inheritance
Inherited Members
Namespace: HomeSeer.PluginSdk.Devices
Assembly: PluginSdk.dll
Factory class for defining new HsDevices for HomeSeer
Fields
View Source_device
Declaration
HsDevice _device
Field Value
Type | Description |
---|---|
HsDevice |
_features
Declaration
List<HsFeature> _features
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<HsFeature> |
Methods
View SourceAsType(EDeviceType, Int32)
Declaration
public DeviceFactory AsType(EDeviceType deviceType, int deviceSubType)
Parameters
Type | Name | Description |
---|---|---|
EDeviceType | deviceType | The EDeviceType used to describe the device |
System.Int32 | deviceSubType | The SubType of the device. Use the int value of the appropriate SubType enum in HomeSeer.PluginSdk.Devices.Identification |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory with an updated TypeInfo |
Remarks
View SourceCreateDevice(String)
Prepare a new device definition
Declaration
public static DeviceFactory CreateDevice(string pluginId)
Parameters
Type | Name | Description |
---|---|---|
System.String | pluginId | The Id of the plugin that owns the new device |
Returns
Type | Description |
---|---|
DeviceFactory | A DeviceFactory containing information about the new device |
PrepareForHs()
Prepare the data to be sent to HS for processing.
Declaration
public NewDeviceData PrepareForHs()
Returns
Type | Description |
---|---|
NewDeviceData | A NewDeviceData bundle for HS to use to create a device. |
WithAddress(String)
Add an Address to the device
Declaration
public DeviceFactory WithAddress(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The string to set the address to |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory with the updated address value |
WithExtraData(PlugExtraData)
Set the PlugExtraData on the device
Declaration
public DeviceFactory WithExtraData(PlugExtraData extraData)
Parameters
Type | Name | Description |
---|---|---|
PlugExtraData | extraData | PlugExtraData to add to the device |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory with the updated PlugExtraData value |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
WithFeature(FeatureFactory)
Declaration
public DeviceFactory WithFeature(FeatureFactory feature)
Parameters
Type | Name | Description |
---|---|---|
FeatureFactory | feature | A FeatureFactory describing the new HsFeature |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory with the new HsFeature definition included |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the FeatureFactory provided is invalid |
WithLocation(String)
Set the Location property on the device.
Declaration
public DeviceFactory WithLocation(string location)
Parameters
Type | Name | Description |
---|---|---|
System.String | location | The location to set on the device |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory updated with the specified location |
Remarks
Null or whitespace strings will be converted to empty strings ""
WithLocation2(String)
Set the Location2 property on the device.
Declaration
public DeviceFactory WithLocation2(string location2)
Parameters
Type | Name | Description |
---|---|---|
System.String | location2 | The location2 to set on the device |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory updated with the specified location2 |
Remarks
Null or whitespace strings will be converted to empty strings ""
WithMiscFlags(EMiscFlag[])
Add EMiscFlags to the device
Declaration
public DeviceFactory WithMiscFlags(params EMiscFlag[] miscFlags)
Parameters
Type | Name | Description |
---|---|---|
EMiscFlag[] | miscFlags | A collection of EMiscFlags to add to the device |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory with the specified flags added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
WithName(String)
Set the Name of the device
Declaration
public DeviceFactory WithName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the device. It must not be blank or whitespace |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory with the updated name value |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when the specified name is null or whitespace |
WithoutMiscFlags(EMiscFlag[])
Remove a EMiscFlag from the device
Declaration
public DeviceFactory WithoutMiscFlags(params EMiscFlag[] miscFlags)
Parameters
Type | Name | Description |
---|---|---|
EMiscFlag[] | miscFlags | EMiscFlag(s) to remove |
Returns
Type | Description |
---|---|
DeviceFactory | The DeviceFactory updated by removing the specified EMiscFlag(s) |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when no |