delian / node-unifiapi

UniFi API ported to Node.JS

Repository from Github https://github.comdelian/node-unifiapiRepository from Github https://github.comdelian/node-unifiapi

UnifiAPI.stat_session function not allowing single mac filtering

shankscoder opened this issue · comments

Comparing the stat_session function (show login sessions for clients), with the PHP version of the Unifi API class, I noticed that the PHP version lets you perform a search of sessions between a data range for a specific MAC. The NodeJS version doesn't accept a MAC as a parameter.

Node implementation

* List client sessions

PHP Implementation

https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#L669

An example of using this function call using the netsite function in NodeJS:

const moment = require('moment');

let conf = {
    mac: "<mac address>",
    'type': 'all',
    'start': moment().subtract(7, 'days').unix(),
    'end': moment().unix()
};

r.netsite('/stat/session', conf, {}, undefined, <sitecode>)
.then((data) => {
   console.log(data.data);
}).catch(err => console.log('Error',err));

Again will be issuing a pull-request soon, but documenting this here.