Class FeatureFactory
public class FeatureFactory
Inheritance
Inherited Members
Namespace: HomeSeer.PluginSdk.Devices
Assembly: PluginSdk.dll
Factory class for defining new HsFeatures for HomeSeer
Fields
View Source_feature
Declaration
HsFeature _feature
Field Value
Type | Description |
---|---|
HsFeature |
Properties
View SourceFeature
Declaration
HsFeature Feature { }
Property Value
Type | Description |
---|---|
HsFeature |
Methods
View SourceAddButton(Double, String, ControlLocation, EControlUse)
Add a button to the HsFeature.
Declaration
public FeatureFactory AddButton(double targetValue, string targetStatus, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
System.Double | targetValue | The unique value associated with this control. |
System.String | targetStatus | The text displayed on the button. |
ControlLocation | location | The location of the control in the grid. See ControlLocation |
EControlUse | controlUse | The specific use for this control. See EControlUse |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with a new StatusControl added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a control, targeting the specified |
See Also
View SourceAddColorPicker(ControlLocation, EControlUse)
Deprecated
Declaration
[Obsolete("This signature has been deprecated. Use one of the new signatures.", true)]
public FeatureFactory AddColorPicker(ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
ControlLocation | location | The location of the control in the grid |
EControlUse | controlUse | The specific use for this control |
Returns
Type | Description |
---|---|
FeatureFactory | A FeatureFactory with the new color control added |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when a control, targeting the specified value, already exists |
AddColorPicker(ValueRange, ControlLocation, EControlUse)
Add a color picker control to the feature
Declaration
public FeatureFactory AddColorPicker(ValueRange targetRange, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
ValueRange | targetRange | The values this control occupies on the feature. |
ControlLocation | location | The location of the control in the grid |
EControlUse | controlUse | The specific use for this control |
Returns
Type | Description |
---|---|
FeatureFactory | A FeatureFactory with the new color control added |
Remarks
Color pickers do not use the value of the feature to operate. They use a control string;
so the targetRange
is superficial and does not correspond to the actual selected color.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when a control, targeting the specified value, already exists |
See Also
View SourceAddColorPicker(Double, ControlLocation, EControlUse)
Add a color picker control to the feature
Declaration
public FeatureFactory AddColorPicker(double targetValue, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
System.Double | targetValue | The value this control occupies on the feature. |
ControlLocation | location | The location of the control in the grid |
EControlUse | controlUse | The specific use for this control |
Returns
Type | Description |
---|---|
FeatureFactory | A FeatureFactory with the new color control added |
Remarks
Color pickers do not use the value of the feature to operate. They use a control string;
so the targetValue
is superficial and does not correspond to the actual selected color.
A unique targetValue
must still be specified.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when a control, targeting the specified value, already exists |
See Also
View SourceAddControl(StatusControl)
Add a StatusControl to the HsFeature being built
Declaration
public FeatureFactory AddControl(StatusControl statusControl)
Parameters
Type | Name | Description |
---|---|---|
StatusControl | statusControl | The StatusControl to add. |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with an added StatusControl |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a StatusControl for the values targeted by |
AddGraphic(StatusGraphic)
Add a StatusGraphic to the HsFeature being built
Declaration
public FeatureFactory AddGraphic(StatusGraphic statusGraphic)
Parameters
Type | Name | Description |
---|---|---|
StatusGraphic | statusGraphic | The StatusGraphic to add. |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with an added StatusGraphic |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a StatusGraphic for the values targeted by |
AddGraphicForRange(String, Double, Double, String)
Add a StatusGraphic that targets a range of values to the HsFeature being built
Declaration
public FeatureFactory AddGraphicForRange(string imagePath, double minValue, double maxValue, string statusText = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | imagePath | A path to an image file relative to the HomeSeer root directory |
System.Double | minValue | The minimum value handled by the StatusGraphic. |
System.Double | maxValue | The maximum value handled by the StatusGraphic |
System.String | statusText | The text displayed by the StatusGraphic. Default is a blank string. |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with an added StatusGraphic |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a StatusGraphic for a value between |
AddGraphicForValue(String, Double, String)
Add a StatusGraphic that targets a single value to the HsFeature being built
Declaration
public FeatureFactory AddGraphicForValue(string imagePath, double targetValue, string statusText = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | imagePath | A path to an image file relative to the HomeSeer root directory |
System.Double | targetValue | The Value targeted by the StatusGraphic |
System.String | statusText | The text displayed for the |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with an added StatusGraphic |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a StatusGraphic for the |
AddNumberInputField(Double, String, ControlLocation, EControlUse)
Add a number input field to the HsFeature.
Declaration
public FeatureFactory AddNumberInputField(double targetValue, string hintText, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
System.Double | targetValue | The unique value associated with this control. |
System.String | hintText | The text displayed to the user to help them know what kind of value to input. |
ControlLocation | location | The location of the control in the grid. See ControlLocation |
EControlUse | controlUse | The specific use for this control. See EControlUse |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with a new StatusControl added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a control, targeting the specified |
See Also
View SourceAddRadioSelectList(SortedDictionary<String, Double>, ControlLocation, EControlUse)
Add a set of radio input controls to the HsFeature
Declaration
public FeatureFactory AddRadioSelectList(SortedDictionary<string, double> textOptions, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.SortedDictionary<System.String, System.Double> | textOptions | A System.Collections.Generic.SortedDictionary<TKey, TValue> of options where the key is the Label and the value is the TargetValue |
ControlLocation | location | The location of the control in the grid. See ControlLocation |
EControlUse | controlUse | The specific use for this control. See EControlUse |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with StatusControls with a ControlType of RadioOption added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when no |
System.ArgumentException | Thrown when a control, targeting the specified value, already exists. |
See Also
View SourceAddSlider(ValueRange, ControlLocation, EControlUse)
Add a slider control to the HsFeature.
Declaration
public FeatureFactory AddSlider(ValueRange targetRange, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
ValueRange | targetRange | |
ControlLocation | location | The location of the control in the grid. See ControlLocation |
EControlUse | controlUse | The specific use for this control. See EControlUse |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with a new StatusControl added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a control, targeting any of the specified values, already exists. |
See Also
View SourceAddTextDropDown(SortedDictionary<String, Double>, ControlLocation, EControlUse)
Add a select list control to the HsFeature
Declaration
public FeatureFactory AddTextDropDown(SortedDictionary<string, double> textOptions, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.SortedDictionary<System.String, System.Double> | textOptions | A System.Collections.Generic.SortedDictionary<TKey, TValue> of options where the key is the Label and the value is the TargetValue |
ControlLocation | location | The location of the control in the grid. See ControlLocation |
EControlUse | controlUse | The specific use for this control. See EControlUse. This is applied to all options. |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with StatusControls with a ControlType of TextSelectList added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when no |
System.ArgumentException | Thrown when a control, targeting any of the specified values, already exists. |
See Also
View SourceAddTextInputField(Double, String, ControlLocation, EControlUse)
Add a text input field to the HsFeature.
Declaration
public FeatureFactory AddTextInputField(double targetValue, string hintText, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
System.Double | targetValue | The unique value associated with this control. |
System.String | hintText | The text displayed to the user to help them know what kind of value to input. |
ControlLocation | location | The location of the control in the grid. See ControlLocation |
EControlUse | controlUse | The specific use for this control. See EControlUse |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with a new StatusControl added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a control, targeting the specified |
See Also
View SourceAddValueDropDown(ValueRange, ControlLocation, EControlUse)
Add a select list control to the HsFeature for a range of numbers.
Declaration
public FeatureFactory AddValueDropDown(ValueRange targetRange, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
Parameters
Type | Name | Description |
---|---|---|
ValueRange | targetRange | |
ControlLocation | location | The location of the control in the grid. See ControlLocation |
EControlUse | controlUse | The specific use for this control. See EControlUse |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with a new StatusControl added |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.ArgumentException | Thrown when a control, targeting any of the specified values, already exists. |
See Also
View SourceAsType(EFeatureType, Int32)
Declaration
public FeatureFactory AsType(EFeatureType featureType, int featureSubType)
Parameters
Type | Name | Description |
---|---|---|
EFeatureType | featureType | The EFeatureType of the HsFeature |
System.Int32 | featureSubType | An int value representing a HsFeature sub type. See HomeSeer.PluginSdk.Devices.Identification for enums listed as "FeatureSubType" for current lists. |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with an updated TypeInfo |
See Also
CreateFeature(String)
Prepare a new feature definition
Declaration
public static FeatureFactory CreateFeature(string pluginId)
Parameters
Type | Name | Description |
---|---|---|
System.String | pluginId | The Id of the plugin that owns the new feature |
Returns
Type | Description |
---|---|
FeatureFactory | A FeatureFactory containing information about the new feature |
Remarks
Make sure to associate this feature with a device before creating it. You can do this with OnDevice(Int32) or PrepareForHsDevice(Int32) if you are creating this feature on its own, or you can add this to a DeviceFactory with WithFeature(FeatureFactory).
CreateFeature(String, Int32)
Prepare a new feature definition for a specific HsDevice
Declaration
public static FeatureFactory CreateFeature(string pluginId, int devRef)
Parameters
Type | Name | Description |
---|---|---|
System.String | pluginId | The Id of the plugin that owns the new feature |
System.Int32 | devRef | The Ref of the device that should own the new feature |
Returns
Type | Description |
---|---|
FeatureFactory | A FeatureFactory containing information about the new feature |
CreateGenericBinaryControl(String, String, String, String, Double, Double)
Create a new generic, binary control feature that has 2 button controls and 2 corresponding status graphics.
Declaration
public static FeatureFactory CreateGenericBinaryControl(string pluginId, string name, string onText, string offText, double onValue = 1, double offValue = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | pluginId | The Id of the plugin to be used as the interface property |
System.String | name | The name of the feature |
System.String | onText | The text on the On button |
System.String | offText | The text on the Off button |
System.Double | onValue | The corresponding value for the On state |
System.Double | offValue | The corresponding value for the Off state |
Returns
Type | Description |
---|---|
FeatureFactory | A FeatureFactory representing the desired feature |
CreateGenericBinarySensor(String, String, String, String, Double, Double)
Create a new generic, binary sensor feature that has 2 status graphics representing 2 different sensor states.
Declaration
public static FeatureFactory CreateGenericBinarySensor(string pluginId, string name, string onText, string offText, double onValue = 1, double offValue = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | pluginId | The Id of the plugin to be used as the interface property |
System.String | name | The name of the feature |
System.String | onText | The text displayed when the status is active |
System.String | offText | The text displayed when the status is passive |
System.Double | onValue | The corresponding value for the active state |
System.Double | offValue | The corresponding value for the passive state |
Returns
Type | Description |
---|---|
FeatureFactory | A FeatureFactory representing the desired feature |
OnDevice(Int32)
Associate the feature with a specific HsDevice
Declaration
public FeatureFactory OnDevice(int devRef)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | devRef |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with its AssociatedDevices set to link to the desired device |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if a |
PrepareForHs()
Prepare the FeatureFactory to be sent to HomeSeer for creation.
Declaration
public NewFeatureData PrepareForHs()
Returns
Type | Description |
---|---|
NewFeatureData | NewFeatureData ready to be sent to HomeSeer via CreateFeatureForDevice(NewFeatureData) |
Remarks
Make sure the HsFeature is associated with a device by calling OnDevice(Int32) to set the owning device prior to calling this method.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the HsFeature isn't correctly associated with a device. |
See Also
View SourcePrepareForHsDevice(Int32)
Prepare the FeatureFactory to be sent to HomeSeer and added to a specific device.
Declaration
public NewFeatureData PrepareForHsDevice(int devRef)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | devRef |
Returns
Type | Description |
---|---|
NewFeatureData | NewFeatureData ready to be sent to HomeSeer via CreateFeatureForDevice(NewFeatureData) |
Remarks
You can either use this to assign the feature to a device as the last step before creation, or you can call OnDevice(Int32) to set the owning device and then PrepareForHs() when you are ready to send it to HomeSeer.
See Also
View SourceWithAddress(String)
Add an Address to the feature
Declaration
public FeatureFactory WithAddress(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The string to set the address to |
Returns
Type | Description |
---|---|
FeatureFactory | The FeatureFactory with the updated address value |
WithDefaultValue(Double)
Set the value the feature is created with
Declaration
public FeatureFactory WithDefaultValue(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value the feature should default to when it is created |
Returns
Type | Description |
---|---|
FeatureFactory | The FeatureFactory updated with the specified value |
WithDisplayType(EFeatureDisplayType)
Set the DisplayType for the feature
Declaration
public FeatureFactory WithDisplayType(EFeatureDisplayType displayType)
Parameters
Type | Name | Description |
---|---|---|
EFeatureDisplayType | displayType | The EFeatureDisplayType to set |
Returns
Type | Description |
---|---|
FeatureFactory | The FeatureFactory with the updated display type value |
WithExtraData(PlugExtraData)
Set the PlugExtraData for the HsFeature
Declaration
public FeatureFactory WithExtraData(PlugExtraData extraData)
Parameters
Type | Name | Description |
---|---|---|
PlugExtraData | extraData | PlugExtraData to set on the HsFeature |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory with the specified PlugExtraData |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
WithLocation(String)
Set the Location property on the feature.
Declaration
public FeatureFactory WithLocation(string location)
Parameters
Type | Name | Description |
---|---|---|
System.String | location | The location to set on the feature |
Returns
Type | Description |
---|---|
FeatureFactory | The FeatureFactory updated with the specified location |
Remarks
You should only adjust this if the location on the owning device is insufficient for this feature. This will be a location IN ADDITION to the device location.
WithLocation2(String)
Set the Location2 property on the feature.
Declaration
public FeatureFactory WithLocation2(string location2)
Parameters
Type | Name | Description |
---|---|---|
System.String | location2 | The location2 to set on the feature |
Returns
Type | Description |
---|---|
FeatureFactory | The FeatureFactory updated with the specified location2 |
Remarks
You should only adjust this if the location2 on the owning device is insufficient for this feature. This will be a location2 IN ADDITION to the device location2.
WithMiscFlags(EMiscFlag[])
Add a EMiscFlag to the feature
Declaration
public FeatureFactory WithMiscFlags(params EMiscFlag[] miscFlags)
Parameters
Type | Name | Description |
---|---|---|
EMiscFlag[] | miscFlags | EMiscFlag(s) to add |
Returns
Type | Description |
---|---|
FeatureFactory | The FeatureFactory updated by adding the specified EMiscFlag(s) |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when no |
WithName(String)
Declaration
public FeatureFactory WithName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the feature |
Returns
Type | Description |
---|---|
FeatureFactory | The calling FeatureFactory updated with the desired name |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the |
WithoutMiscFlags(EMiscFlag[])
Remove a EMiscFlag from the feature
Declaration
public FeatureFactory WithoutMiscFlags(params EMiscFlag[] miscFlags)
Parameters
Type | Name | Description |
---|---|---|
EMiscFlag[] | miscFlags | EMiscFlag(s) to remove |
Returns
Type | Description |
---|---|
FeatureFactory | The FeatureFactory updated by removing the specified EMiscFlag(s) |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when no |