Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Commit

Permalink
0.9.4
Browse files Browse the repository at this point in the history
Prepare for possible merge of homebridge/homebridge#2169

Add apcupsd tutorial to README
  • Loading branch information
mrose17 committed Mar 3, 2019
1 parent 842e270 commit 6a56a71
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ Then all subsequent installations must be like this:
sudo npm install -g --unsafe-perm homebridge-accessory-apcupsd

# Install, Configure, and Test apcupsd
This plugin won't work until you hjave [apcupsd](http://ww.apcupsd.org/) running in your network.
By default,
a single UPS is monitored via the USB cable.
This plugin won't work until you have [apcupsd](http://ww.apcupsd.org/) running in your network.
I found this
[tutorial](http://www.anites.com/2013/09/monitoring-ups.html#How%20to%20monitor%20a%20UPS%20with%20a%20Raspberry%20Pi)
enlightening.

If you are running [homebridge](https://github.com/nfarina/homebridge) on a different platform than `apcupsd`,
then you must edit `/etc/apcupsd/apcupsd.conf` and change
Expand All @@ -54,7 +55,10 @@ Also make sure you have
NETSERVER on

## Monitoring Multiple UPS Devices
You can monitor multiple UPS devices on the same platform,
By default,
a single UPS is monitored via the USB cable;
however,
you can monitor multiple UPS devices on the same platform,
but the configuration depends on the platform.
For example,
using the Debian [instructions](https://wiki.debian.org/apcupsd#Configuring_.28Multiple_UPS_Devices.29) on my system:
Expand Down Expand Up @@ -156,11 +160,10 @@ The default port number is `3551`,
and can be changed by adding it to the `location` value, e.g., `"192.168.1.109:3552"`.

## Name, Model, Serial Number, and Firmware Revision
This is a **known bug:**
although the plugin successfully retrieves these values from `apcusbd` --
because of this [issue](https://github.com/nfarina/homebridge/issues/697) --
Although the plugin successfully retrieves these values from `apcusbd`,
the plugin can not provide the modified values.
Until a fix is in place,
A [PR](https://github.com/nfarina/homebridge/pull/2169) has been submitted with a possible fix.
Until then,
I suggest you run

% apcaccess
Expand Down
28 changes: 16 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,33 +203,37 @@ module.exports = function (homebridge) {

, getName:
function (callback) {
debug('getName', { location: this.location.host })
this.fetchStatus(function (err, status) {
callback(err, ((this.name !== 'apcupsd') && status && status.UPSNAME) || this.name)
const self = this

self.fetchStatus(function (err, status) {
callback(err, (status && status.UPSNAME) || self.name)
})
}

, getModel:
function (callback) {
debug('getModel', { location: this.location.host })
this.fetchStatus(function (err, status) {
callback(err, status && status.MODEL)
const self = this

self.fetchStatus(function (err, status) {
callback(err, (status && status.MODEL) || self.config.model)
})
}

, getSerialNumber:
function (callback) {
debug('getSerialNumber', { location: this.location.host })
this.fetchStatus(function (err, status) {
callback(err, status && status.SERIALNO)
const self = this

self.fetchStatus(function (err, status) {
callback(err, (status && status.SERIALNO) || self.config.serialNo)
})
}

, getFirmwareRevision:
function (callback) {
debug('getFirmwareRevision', { location: this.location.host })
this.fetchStatus(function (err, status) {
callback(err, status && status.FIRMWARE)
const self = this

self.fetchStatus(function (err, status) {
callback(err, ((status && status.FIRMWARE) || self.config.firmware))
})
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-accessory-apcupsd",
"version": "0.9.3",
"version": "0.9.4",
"description": "An apcupsd accessory plugin for Homebridge: https://github.com/nfarina/homebridge",
"author": {
"name": "Marshall Rose",
Expand Down

0 comments on commit 6a56a71

Please sign in to comment.