fix(snmp): correct power status interpretation using OID set mappings
Move power status value interpretation from hardcoded logic to OID set configuration. Each UPS model now defines its own value mappings (e.g., CyberPower: 2=online, 3=onBattery). Fixes incorrect status display where UPS showed "On Battery" when actually online. Changes: - Add POWER_STATUS_VALUES to IOidSet interface - Define value mappings for all UPS models (cyberpower, apc, eaton, tripplite, liebert) - Refactor determinePowerStatus() to use OID set mappings instead of hardcoded values - CyberPower now correctly interprets value 2 as online (was incorrectly onBattery)
This commit is contained in:
@@ -28,6 +28,13 @@ export interface IOidSet {
|
||||
BATTERY_CAPACITY: string;
|
||||
/** OID for battery runtime */
|
||||
BATTERY_RUNTIME: string;
|
||||
/** Power status value mappings */
|
||||
POWER_STATUS_VALUES?: {
|
||||
/** SNMP value that indicates UPS is online (on AC power) */
|
||||
online: number;
|
||||
/** SNMP value that indicates UPS is on battery */
|
||||
onBattery: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user