public VSPair AddVSPair(double Value, string Status, ePairControlUse ControlUse, string Graphic = null, ePairStatusControl Status_Control = ePairStatusControl.Both ) { var svPair = new VSPair(Status_Control) { PairType = VSVGPairType.SingleValue, Value = Value, Status = Status, ControlUse = ControlUse, Render = Enums.CAPIControlType.Button, IncludeValues = true }; bool ret = hs.DeviceVSP_AddPair(RefId, svPair); if (Graphic != null) { var vgPair = new VGPair(); vgPair.PairType = VSVGPairType.SingleValue; vgPair.Set_Value = Value; vgPair.Graphic = Graphic; ret = hs.DeviceVGP_AddPair(RefId, vgPair); } return(svPair); }
public string DeviceVSP_GetStatus(int deviceRef, double deviceValue, ePairStatusControl type) { HomeseerDeviceVsp device = GetHomeseerDevicevspByIdAndValue(deviceRef, deviceValue); if (device == null) { return(""); } return(device.ValueAsString); }
/// <summary> /// Main Function. /// Get all VSPairs, for performance keep them in dict with the key Status/Control/Both /// Convert VSVGPairs.VSPair[] to simple PairList /// Note: ranges *split* into individual states /// </summary> /// <param name="StatusControl">ePairStatusControl - Status, Control, or Both</param> /// <param name="splitrange">ranges *split* into individual states</param> /// <returns></returns> public MyPairList vspsList(ePairStatusControl StatusControl, SplitRangeType splitrange) { if (!this.ContainsKey(splitrange)) { this[splitrange] = new PairStatusControlDict(); } // If this particular list is in the Dictionary already - just return it if (!this[splitrange].ContainsKey(StatusControl)) { this[splitrange][Control] = MakeVSpsListControl(splitrange); this[splitrange][Status] = MakeVSpsListStatus(splitrange); // For ePairStatusControl.Both merge two lists (Union) this[splitrange][Both] = Merge(this[splitrange][Control], this[splitrange][Status]); } return(this[splitrange][StatusControl]); }
public VSPair AddVSTemperaturePair(bool C, double Start = 0, double End = 35, string Suffix = null, int RangeStatusDecimals = 0, ePairControlUse ControlUse = ePairControlUse.Not_Specified, CAPIControlType ControlType = CAPIControlType.ValuesRange, string Graphic = "/images/HomeSeer/status/Thermometer-50.png", ePairStatusControl Status_Control = ePairStatusControl.Both ) { return(AddVSRangePair(Start, End, Suffix: Suffix ?? (C ? " °C" : " °F"), Graphic: Graphic, RangeStatusDecimals: RangeStatusDecimals, ControlUse: ControlUse, ControlType: ControlType, Status_Control: Status_Control )); }
public VSPair AddVSRangePair(double Start, double End, string Prefix = "", string Suffix = "", int RangeStatusDecimals = 0, ePairControlUse ControlUse = ePairControlUse.Not_Specified, CAPIControlType ControlType = CAPIControlType.ValuesRange, string Graphic = null, ePairStatusControl Status_Control = ePairStatusControl.Both ) { var svPair = new VSPair(Status_Control) { PairType = VSVGPairType.Range, RangeStart = Start, RangeEnd = End, ControlUse = ControlUse, Render = ControlType, IncludeValues = true, RangeStatusPrefix = Prefix, RangeStatusSuffix = Suffix, RangeStatusDecimals = RangeStatusDecimals }; bool ret = hs.DeviceVSP_AddPair(RefId, svPair); if (Graphic != null) { var vgPair = new VGPair(); vgPair.PairType = VSVGPairType.Range; vgPair.RangeStart = Start; vgPair.RangeEnd = End; vgPair.Graphic = Graphic; ret = hs.DeviceVGP_AddPair(RefId, vgPair); } return(svPair); }