Skip to content

Stop substituting default/fallback values for UPS variables #116

@gbakeman

Description

@gbakeman

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

  • Missing battery.voltage
    image

  • UPS data retrieval subroutine

    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

Related

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions