Open grgmll opened 4 years ago
interesting, so what is the exact JSON being used for the plugin, e.g., what does the fragment corresponding to https://github.com/homespun/homebridge-accessory-apcupsd#configuration look like?
what error is printed on the crash?
thanks!
ps: sorry for the 5 month delay in replying ... for some reason when an issue is submitted, github only intermittently sends me an email... sorry!
I'm not the person that opened this, but I'm up against the exact same thing. Here's the output:
[10/12/2020, 14:04:14] [Frieza UPS Wall Power] Initializing apcupsd accessory...
[10/12/2020, 14:04:14] TypeError: Cannot read property 'UUID' of undefined
at PowerService.Service.getCharacteristic (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:295:79)
at APC.getServices (/usr/local/lib/node_modules/homebridge-accessory-apcupsd/index.js:557:12)
at Server.createHAPAccessory (/usr/local/lib/node_modules/homebridge/src/server.ts:448:41)
at /usr/local/lib/node_modules/homebridge/src/server.ts:358:30
at Array.forEach (<anonymous>)
at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:328:29)
at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:154:12)
at cli (/usr/local/lib/node_modules/homebridge/src/cli.ts:80:10)
at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Here's the json I'm using. I added the unique_serial out of desperation. It is exactly the same without it. The battery entry works exactly as intended:
{
"accessory": "apcupsd",
"name": "Frieza UPS Battery",
"location": "frieza.local:3551",
"subtype": "battery",
"unique_serial": "12678"
},
{
"accessory": "apcupsd",
"name": "Frieza UPS Wall Power",
"location": "frieza.local:3551",
"subtype": "power",
"unique_serial": "12679"
}
@Numbski - i've re-opened this. at first glance, it appears that CommunityTypes.EveResetTotal
is undefined at https://github.com/homespun/homebridge-accessory-apcupsd/blob/master/index.js#L557 - however, this simply should not be possible, cf., https://github.com/homespun/hap-nodejs-community-types/blob/master/types.js#L429-L439
fortunately, i am now able to reproduce it. so i am looking into it.
i believe i found the issue! that is a very obscure interaction. please try the latest version and let me know if it works for you!
homebridge now starts fine but no reports on the power is displayed
It appears in my case that apcupsd is working and the plugin works - turns out apcupsd is on a mac, and the MacOS UPS kernel extension (driver) is fighting with libusb for the UPS, and that may be the main problem here - and why it seemed so obscure to mrose17.
Frieza:apcupsd baroque$ sudo /usr/local/sbin/apcupsd -b -d0 -f /usr/local/etc/apcupsd/apcupsd.conf
libusb: error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access
Frieza:apcupsd baroque$ apcaccess
APC : 001,017,0427
DATE : 2020-10-13 07:20:16 -0500
HOSTNAME : Frieza.local
VERSION : 3.14.14 (31 May 2016) darwin
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2020-10-13 07:20:15 -0500
**STATUS : COMMLOST**
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
STATFLAG : 0x05000100
END APC : 2020-10-13 07:20:26 -0500
So yeah. I need to get apcinfo to give me actual output, and this will all likely start working correctly for me. I was fooled by it showing up in Apple Home. Gotta get rid of that "STATUS: COMMLOST" at minimum.
Okay. Got apcaccess reporting correct info. Power still isn't showing up quite right though. It is listed, but shows itself as "Unsupported". Here's the current output of apcaccess for me:
Frieza:~ baroque$ apcaccess
APC : 001,036,0873
DATE : 2020-10-13 09:28:46 -0500
HOSTNAME : Frieza.local
VERSION : 3.14.14 (31 May 2016) darwin
UPSNAME : Frieza.local
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2020-10-13 09:23:22 -0500
MODEL : Back-UPS NS 1250
STATUS : ONLINE
LINEV : 122.0 Volts
LOADPCT : 4.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 58.6 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 97.0 Volts
HITRANS : 139.0 Volts
ALARMDEL : 30 Seconds
BATTV : 26.9 Volts
LASTXFER : No transfers since turnon
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : JB0540017550
BATTDATE : 2005-09-28
NOMINV : 120 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 780 Watts
FIRMWARE : 7.g1 .D USB FW:g1
END APC : 2020-10-13 09:28:47 -0500
It looks to me as though LINEV : 122.0 Volts
should mean that power shouldn't be "Unsupported"...?
Screen grabs from my phone (accessories may not be named appropriately, made a best guess).
@Numbski & @oigroigm - the apple "Home" app doesn't handle many types of accessories, sadly. i use the elgato eve app (although there are several nice homekit apps available). the only time i use the "Home" app is to manage special settings (e.g., notifications) that other homekit apps aren't allowed to do...
https://imgur.com/gallery/FXaewbh
Doesn't show up in Eve either.
It is very puzzling. :\
EDIT: fixed link
Tony Shadwick
Again, your project, not mine. It's not mandatory for you to do anything whatsoever. It does seem a separate defect might be warranted for the line power issue. You're correct about Apple Home not supporting everything, but it is very, very puzzling that Eve doesn't register it at all, nor apparently does Homebridge itself on the Accessories tab. It makes me wonder if there's not a stale entry in my "Home" that is no longer correct, but is somehow unremovable due to the bridge still existing.
It is completely fair and correct to say that the subtype no longer causes a crash. I also want to reiterate that I have the utmost respect that people pour into open source software for free. I don't hold you to any obligations whatsoever. Just wanted to add clarity to the state of things here, in case it comes up again later.
@Numbski - thanks for the clarification. it sounds like the homebridge isn't advertising the power subtype, which is quite odd. all i can suggest is that you:
homebridge
~/.homebridge/accessories/
and ~/.homebridge/persist/
directorieshomebridge
using the Home appfrom time to time, i've had to use that "nuclear option", which i don't like because i lose the any automations that use any accessories on the bridge...
also, i am likely moving off of Homebridge at the end of the year. pretty much everything that i use now has native HomeKit support, so Homebridge isn't going to be needed in my environment. If you, or someone else, wants to take over the "homespun" repositories, that's a possibility. Otherwise, i'll keep the repos around, but won't be doing any support...
after adding the subtype power homebridge it does not restart