npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sonoff-cli

v0.1.1

Published

A simple Sonoff Switch registering cli

Downloads

2

Readme

Unofficial ITEAD SOnOff CLI

This is a very simple CLI utility to configure a SOnOff device (Basic / RF, maybe others).

The idea is to be able to configure the device to connect to a custom server, instead of ITEAD Cloud.

How? The device is able to connect to a websocket server (ITEAD Cloud) over SSL, but before it has to be "paired". The usual pairing flow involves your cellphone + eLink app, which performs some actions replicated here, in order:

  • Connect to ITEAD-10000xxxxxx Wifi access point (created by SOnOff device)
  • Query device information (http://10.10.7.1/device)
  • Set AP information (http://10.10.7.1/ap) (your wifi)

Feel free to checkout the code (actions.js) to understand how these steps are made.

Note: this utility does not connect to SOnOff ap, nor checks for pairing mode, you should do it by hand as explained before.

Usage

Preparation to pairing

  • Set pairing mode

    • Before we start, you should set your device to pairing mode (usually involves holding the button long enough to see the led blink). Depending on your device and version, led might mean something different, please refer to this page for more info.
  • Connect to AP

    • Once in pairing mode, your device will emit a wifi access point, to which you must connect. To prevent errors, you should perform this action one device at a time. The SSID should look something like ITEAD-10000xxxxxx.

Pair

Once connected to AP, you can use this utility to execute the "pairing" part of the process :

sonoff auto -w "your WIFI SSID:password" -s webserverIP:PORT -o outputServer/path

This is the usual (and only) option this utility exposes right now. Let's break it down:

  • sonoff auto Means that this utility will get the device information, and set the AP info in one go.

  • -w ssid:password Gives the utility your wifi information to send to the device. This utility will wifi.split(':') to get ssid and password, so keep that in mind. Note: options can also take a = (-w=plep:plop).

  • -s ip:port Gives the utility information about the server that will be managing the device. I personnaly use the IP address (internal network), but I've seen tutorials using a common name (example.com). As the device needs SSL to fuction, port should usually be set to 443, unless you configured otherwise on your server.

  • OPTIONAL -o http... Output. This will take the device info and send a POST request to the url given to -o. As:

{
	"deviceid": id,
	"apikey": plep
}