Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rpi-wifi-connection

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rpi-wifi-connection

Module to connect a Raspberry Pi to Wi-Fi

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
decreased by-23.53%
Maintainers
1
Weekly downloads
 
Created
Source

rpi-wifi-connection

Module to connect a Raspberry Pi to Wi-Fi

Installation

$ npm install rpi-wifi-connection --save

Usage

var Wifi = require('rpi-wifi-connection');
var wifi = new Wifi();

Methods

constructor(iface)

Constructs a new wifi connection object.

  • iface - Specifies the name of the interface (default is wlan0)

connect(options)

Connects to the specified network.

  • options.ssid - Specifies the network name.
  • options.psk - Specifies the password.
  • options.timeout - Specifies the number of milliseconds to wait for connection. Default is 30000.
var Wifi = require('rpi-wifi-connection');
var wifi = new Wifi();

wifi.connect({ssid:'my-network', psk:'raspberry'}).then(() => {
    console.log('Connected to network.');
})
.catch((error) => {
    console.log(error);
});

getStatus()


var Wifi = require('rpi-wifi-connection');
var wifi = new Wifi();

wifi.getStatus().then((status) => {
    console.log(status);
})
.catch((error) => {
    console.log(error);
});

// { ssid: 'Julia', ip_address: '10.0.1.189' }

getState()

var Wifi = require('rpi-wifi-connection');
var wifi = new Wifi();

wifi.getState().then((connected) => {
    if (connected)        
        console.log('Connected to network.');
    else
        console.log('Not connected to network.');
})
.catch((error) => {
    console.log(error);
});

getNetworks()

Returns a promise containing a list of Wi-Fi networks.

var Wifi = require('rpi-wifi-connection');
var wifi = new Wifi();

wifi.getNetworks().then((networks) => {
    console.log(networks);
});

//  [ { id: 0, ssid: 'Julia' } ]

FAQs

Package last updated on 13 Nov 2017

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