New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wifi

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wifi

wifi.io node.js sdk

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

wifi.io sdk npm

wifi.io node.js sdk

banner

How to install

$ npm install wifi

Sample code

require wifi.io

var Wifi = require('wifi');

// init instance
var wifi = new Wifi({
    username: 'xxx',
    password: 'xxx'
});

users api

// signin
wifi.user.login(function(err,result){
    // console.log result token
    // token will be stored in wifi instance
    console.log(result);
});

// signout
wifi.user.logout(function(err,result){
    // console.log result token
    console.log(result) 
});

// get_devices
// http://wifi.io/developer/api_if.php?id=50e67bc57f8b9aaf18000000
wifi.user.devices({
    status: 0 , // 根据设备在线状态查询,-1:不在线,0:全部,1:在线,默认为全部,
    page: 1, // 分页页码,默认为1
    pagesize: 10 // 分页大小,默认每页10条,如果pagesize为0,则返回全量数据
},function(err,result){
    // console.log result token
    console.log(result) 
});

device api

wifi.device.command({
    did: 123, // device id 目标设备的设备id
    method: 'reboot', // 要执行的方法名称
    params: {} // 需要传递的参数
},function(err,result){
    console.log(result);
});

data apis

wifi.data.get({
    tags: '123', // device id 目标设备的设备id
    starttime: 0,
    endtime: 100,
    filter: '(3,9]',
    simplify: false,
    page: 1,
    pagesize: 10,
    method: 'reboot', // 要执行的方法名称
    params: {} // 需要传递的参数
},function(err,result){
    console.log(result);
});

wifi.data.getByKey({
    key: '123', // 要查询的数据的key
},function(err,result){
    console.log(result);
});

wifi.data.insert({
    tags: '123', // 数据的标签,用于标识数据的用途,便于查询
    value: 123 , // 数据内容(数值型)
},function(err,result){
    console.log(result);
});

Local scanner supported

// init local instance
var local = new Wifi().scan();

// send command
local.device.command({
    method: 'reboot', // 要执行的方法名称
    params: {} // 需要传递的参数
},function(err,result){
    console.log(result);
});

Pull Request Welcome !

  • fork this repo
  • feel free to add your feature
  • make sure your feature are fully tested!
  • send me a PR, and enjoy !

Run unit-test (Mocha)

$ git clone https://github.com/turingou/beer.git
$ cd beer
$ npm install // will install mocha localy
$ npm test

Keywords

FAQs

Package last updated on 24 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc