fix(systemd/readme): Improve README documentation and fix UPS status retrieval in systemd service
This commit is contained in:
@@ -170,9 +170,16 @@ WantedBy=multi-user.target
|
||||
*/
|
||||
private async displayUpsStatus(): Promise<void> {
|
||||
try {
|
||||
const upsStatus = await this.daemon.getConfig().snmp;
|
||||
const config = this.daemon.getConfig();
|
||||
const snmp = this.daemon.getNupstSnmp();
|
||||
const status = await snmp.getUpsStatus(upsStatus);
|
||||
|
||||
// Create a test config with appropriate timeout, similar to the test command
|
||||
const snmpConfig = {
|
||||
...config.snmp,
|
||||
timeout: Math.min(config.snmp.timeout, 10000) // Use at most 10 seconds for status check
|
||||
};
|
||||
|
||||
const status = await snmp.getUpsStatus(snmpConfig);
|
||||
|
||||
console.log('┌─ UPS Status ───────────────────────────────┐');
|
||||
console.log(`│ Power Status: ${status.powerStatus}`);
|
||||
|
Reference in New Issue
Block a user