Open mcsSolutions opened 1 year ago
I agree the event action should present an input field to the user when the EControlType is TextBoxNumber or TextBoxString. It is logged as HS-1723
Note that as a workaround you can create a number input field control as a range and add it to your FeatureFactory:
var numberInputControlAsRange = new StatusControl(EControlType.TextBoxNumber) {
IsRange = true,
TargetRange = new ValueRange(-3100, -3000),
Label = "Number Input As Range",
};
ff.AddControl(numberInputControlAsRange);
related issue on hint labels missing for TextBoxNumber and TextBoxString on devices page: #255
HS 4.2.15.0 and earlier
FeatureFactory AddNumberInputField is intended to be used to allow the user to specify a number input control for a feature. It contains the following definition:
public FeatureFactory AddNumberInputField(double targetValue, string hintText, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified)
When used it adds a Feature control with single value (targetValue) and with label (hintText). While the hintText being a status label was not expected, it does not present an issue on the Devices page where the number box with a Submit button is rendered.
When trying to use Feature as a Device Control in an Event Action is where the problem shows up. The hintText is presented as the control option for the Feature. This is understandable based upon how AddNumberInputField used the hintText and targetValue as VSP. What is expected, however, is that a NumberInputField should present a Number TextBox and not a VSP state label.
It seems the prototype for AddNumberInputField (and equivalent for Text) should be a range rather than a single targetValue. This would then allow the Device Control Action to render a selector as it does with other ranges.
The selector is presented for other ranges in Device Control Action even when the HomeSeer.PluginSdk.Devices.Controls.EControlType is specified as TextBoxNumber. While this is not desired and makes the Control Action unusable for large ranges and for fractional values, it is better than showing a hintText as the Control Action.