unifi-activity-statistics

1.0.0 • Public • Published

unifi-activity-statistics

npm npm License

unifi-activity-statistics is a Node.js module that allows you to listen for activity statistics and shows you the current RX and TX speeds from a specified port on your UnfiFi Dreammachine (UniFi is Ubiquiti Networks wifi controller software).

This package is heavily based on the awesome work of oznu's unifi-events.
Please follow the link and buy him a coffee.

Requirements

Installation

$ npm install unifi-activity-statistics

Example

const UnifiActivityStatistics = require('unifi-activity-statistics');

let unifi = new UnifiActivityStatistics({
  host:             'unifi',    // The hostname or ip address of the unifi controller (default: 'unifi')
  port:             8443,       // Port of the unifi controller (default: 8443)
  username:         'admin',    // Username (default: 'admin').
  password:         'ubnt',     // Password (default: 'ubnt').
  uplink_interface: 'eth9',     // Port you want to listen to (default: eth9).
  site:             'default',  // The UniFi site to connect to (default: 'default').
  insecure:         true,       // Allow connections if SSL certificate check fails (default: false).
  unifios:          true        // For devices with UnifiOS turn this on
});

// Listen for event
unifi.on('uplink_activity', (data) => {
 console.log('RX: ' + (data.rx / 125000).toFixed(2) + ' TX: ' + (data.tx / 125000).toFixed(2));
});

Events

unifi-activity-statistics uses EventEmitter2 and namespaced events.

namespace ctrl

These events indicate the status of the connection to the UniFi controller

  • ctrl.connect - emitted when the connection to the controller is established
  • ctrl.disconnect - emitted when the connection to the controller is lost
  • ctrl.error -
  • ctrl.reconnect -

License

Package Sidebar

Install

npm i unifi-activity-statistics

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

11 kB

Total Files

4

Last publish

Collaborators

  • flazer