-
Notifications
You must be signed in to change notification settings - Fork 27
Description
The WinNUT variable update system has a design that causes it to substitute in default/fallback values for when there's an error retrieving a variable. This is a problem because the user may be unaware of when a variable is being substituted, and when it is a true value.
Examples
-
UPS data retrieval subroutine
WinNUT-Client/WinNUT_V2/WinNUT-Client_Common/UPS_Device.vb
Lines 265 to 268 in 1d9fe47
With UPS_Datas.UPS_Value .Batt_Charge = Double.Parse(GetUPSVar("battery.charge", 255), ciClone) .Batt_Voltage = Double.Parse(GetUPSVar("battery.voltage", 12), ciClone) .Batt_Runtime = Double.Parse(GetUPSVar("battery.runtime", 86400), ciClone)
Solution
First, the concept of having fallback values should be removed. When an error is encountered retrieving a variable, that error (exception) should be passed along to the calling method. It will be up to the variables management system to handle errors. Most likely, an error will occur due to a variable not being available on the NUT server. In which case, the variable should be marked so that WinNUT knows how to handle it, and the variable is no longer fetched during periodic update calls.
Items
- Alert user if battery condition is not available (Crashes relating to bad/out-of-range values reported by NUT server #129) when stop conditions are active
- Modify gauge displays to indicate that the value is invalid or not available (precludes larger change to gauges and how they're displayed or added?)