Speak with APC UPS on his language
JavaScript Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib append tests, demos and stuff Oct 20, 2015
test append tests, demos and stuff Oct 20, 2015
index.js is it alive? Oct 19, 2015


Cylon.js for APC UPS

Build Status via Travis CI NPM version Coverage Status

Cylon.js (http://cylonjs.com) is a JavaScript framework for robotics, physical computing, and the Internet of Things (IoT).

This repository contains the adaptor/driver to work with APC UPS. It communicates overt apcupsd daemon. It can be used to receive current APC power consuption, raise events on power lost etc.

How to Install

1) Plug your APC UPS to computer and install apcupsd daemon:

$ apt-get install apcupsd
$ edit /etc/apcupsd/apcupsd.conf
$ service apcupsd start

2) Ensure binary and log files are exists: /sbin/apcaccess, /var/log/apcupsd.events

3) Install cylon with apc support:

$ npm install cylon cylon-apcupsd

How to Use

'use strict';
var Cylon = require('cylon'),
    config = require('config');

  name: 'Maria',
  config: config,
  connections: {
    apc: { adaptor: 'apcupsd' }
  devices: {
    apc: {driver: 'apcupsd' }
  work: function () {
    var device = this.devices.apc;

    // functions:
    // device.state() - return JSON with full UPS info
    // device.power() - return current power state
    // device.charge() - return current UPS charge (in %)
    // device.timeleft() - return current time till charge is over (in minutes %)
    // events:
    // >> device.on('{event}', function (newValue, oldValue) { ... });
    // 'power' - emitted whenever UPS connecton status changed (true|false)
    // 'charge' - emitted whenever charge is changes (0-100)
    // 'timeleft' - emitted when time left changed

    device.timeleft(function (err, minutes) {
      console.log('>>> UPS will remain active %s minutes if power suddenly dissapear', minutes);

    device.on('power', function (status) {
      console.log('>>> power is:', status ? 'enabled now' : 'disabled');


Cylon.api('http', config.api);


Nope, sorry. Please read and launch example, point your browser to - you will see all available methods and events. Also, please read official documentation on cylon.js. Good luck.


Copyright (c) 2015. Licensed under the Apache 2.0 license.