cr3ative / homebridge-apcaccess

what if apcaccess, but in homebridge??
MIT License
8 stars 5 forks source link

Please Fix #20

Closed aor980 closed 1 year ago

aor980 commented 1 year ago

Getting the following status every second

Polling UPS service failed: TypeError: Cannot read properties of undefined (reading 'trim') at APCAccess.parseData (/var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:161:45) at APCAccess.checkBatteryLevel (/var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:226:34) at APCAccess.doPolledChecks (/var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:241:10) at /var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:99:14 at processTicksAndRejections (node:internal/process/task_queues:95:5)

cr3ative commented 1 year ago

What does apcaccess output for you in the command line?

cr3ative commented 1 year ago

@aor980 I need more information from you to proceed; apcaccess should work before this plugin will, and I need to see the output of it to know what it is trying to parse.

aor980 commented 1 year ago

[13/04/2023, 12:29:01] [UPS] Power: Connected [13/04/2023, 12:29:01] [UPS] Battery state: Normal [13/04/2023, 12:29:01] [UPS] Charging state: NOT_CHARGING [13/04/2023, 12:29:01] [UPS] Polling UPS service failed: TypeError: Cannot read properties of undefined (reading 'trim') at APCAccess.parseData (/var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:161:45) at APCAccess.checkBatteryLevel (/var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:226:34) at APCAccess.doPolledChecks (/var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:241:10) at /var/lib/homebridge/node_modules/homebridge-apcaccess/index.js:99:14 at processTicksAndRejections (node:internal/process/task_queues:95:5)

cr3ative commented 1 year ago

No mate, the output of apcaccess on the command line of the box which it is configured on. Not in homebridge etc.

aor980 commented 1 year ago

Let's pretend I'm an idot, how do I do that?

cr3ative commented 1 year ago

Go to the command line of your machine with the UPS attached. For me, it's this, I ssh to the tower and run apcaccess on the terminal.

➜  ~ ssh tower
Last login: Wed Mar  8 09:46:02 2023 from 192.168.86.110
Linux 5.19.17-Unraid.
root@Tower:~# apcaccess
APC      : 001,036,0870
DATE     : 2023-04-13 18:00:20 +0100  
HOSTNAME : Tower
VERSION  : 3.14.14 (31 May 2016) slackware
UPSNAME  : Tower
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2023-04-09 04:40:04 +0100  
MODEL    : Back-UPS XS 1400U  
STATUS   : ONLINE 
LINEV    : 234.0 Volts
LOADPCT  : 7.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 83.1 Minutes
MBATTCHG : 25 Percent
MINTIMEL : 10 Minutes
MAXTIME  : 0 Seconds
SENSE    : High
LOTRANS  : 155.0 Volts
HITRANS  : 280.0 Volts
ALARMDEL : No alarm
BATTV    : 27.1 Volts
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 3B1512X19643  
BATTDATE : 2021-02-26
NOMINV   : 230 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 700 Watts
FIRMWARE : 926.T1 .I USB FW:T1
END APC  : 2023-04-13 18:00:21 +0100  
aor980 commented 1 year ago

root@DD-WRT:/tmp/home/root# apcaccess APC : 001,032,0745 DATE : 2023-04-13 13:17:02 -0400 HOSTNAME : DD-WRT VERSION : 3.14.14 (31 May 2016) debian UPSNAME : DD-WRT CABLE : USB Cable DRIVER : USB UPS Driver UPSMODE : Stand Alone STARTTIME: 1969-12-31 19:00:08 -0500 MODEL : GX1500U STATUS : ONLINE LINEV : 121.0 Volts LOADPCT : 3.0 Percent BCHARGE : 100.0 Percent TIMELEFT : 135.4 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds OUTPUTV : 121.0 Volts DWAKE : -1 Seconds LOTRANS : 100.0 Volts HITRANS : 139.0 Volts ALARMDEL : 30 Seconds NUMXFERS : 0 TONBATT : 0 Seconds CUMONBATT: 0 Seconds XOFFBATT : N/A SELFTEST : NO STATFLAG : 0x05000008 SERIALNO : QA9LT7001219 NOMINV : 120 Volts NOMPOWER : 900 Watts END APC : 2023-04-13 13:17:08 -0400

cr3ative commented 1 year ago

Hm, right, your UPS doesn't report BATTV. That doesn't look critical. I'll see what I can do.

cr3ative commented 1 year ago

@aor980 Published 1.0.2 - can you give that a try for me?

aor980 commented 1 year ago

will do.

...and its fixed. Great job.

cr3ative commented 1 year ago

wheyyyyyyyy