Skip to content

flazer/unifi-activity-statistics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Listen for for RX/TX activity statistics on specified port via Unifi Socket (Ubiquiti Wifi).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published