fix(systemd/readme): Improve README documentation and fix UPS status retrieval in systemd service

This commit is contained in:
2025-03-25 09:49:30 +00:00
parent fce5a9bafd
commit 7ef38cf961
4 changed files with 89 additions and 7 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/nupst',
version: '1.10.0',
version: '1.10.1',
description: 'Node.js UPS Shutdown Tool for SNMP-enabled UPS devices'
}

View File

@ -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}`);