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

wemore

v0.6.2

Published

A more awesome library for Belkin WeMo interactions

Downloads

97

Readme

wemore

A more awesome library for Belkin WeMo interactions. With acknowledgements to wemo.js for protocol reference.

Usage

NPM

Toggle the first device found:

var wemore = require('wemore')

// with no args, a Discovery object is returned
//  that emits device events as they're discovered
var discovery = wemore.Discover()
.on('device', function(device) {
    device.toggleBinaryState();
    discovery.close(); // stop discovering
});

Toggling a device by its friendly name:

var wemore = require('wemore')

// when the friendly name is provided, a Promise is returned
wemore.Discover('Lights')
.then(function(device) {
    return device.toggleBinaryState();
})
.then(function() {
    console.log("Success!");
})
.fail(function(err) {
    console.error("Couldn't find device", err);
});

Emulate Devices

Wemore also provides a facility for emulating devices, allowing you to transparently respond to toggle events from another device on the network, like perhaps the Amazon Echo.

var wemore = require('wemore');

// note that each device needs a separate port:
var tv = wemore.Emulate({friendlyName: "TV", port: 9001}); // choose a port
var stereo = wemore.Emulate({friendlyName: "Stereo"}); // automatically assigned

stereo.on('listening', function() {
    // if you want it, you can get it:
    console.log("Stereo listening on", this.port);
});

tv.on('state', function(binaryState, self, sender) {
    console.log("TV set to=", binaryState);
    tv.close(); // stop advertising the device
});

// also, 'on' and 'off' events corresponding to binary state
stereo.on('on', function(self, sender) {
    console.log("Stereo turned on");
});

stereo.on('off', function(self, sender) {
    console.log("Stereo turned off");
});

If you need information about who requested the event, it is provided as a "Sender object" that looks something like this:

{
    address: '::ffff:192.168.1.23',
    port: 12345
}

See Socket.remoteAddress for more information about these values.

Binary

Installing with -g provides the wemore-toggle executable:

usage: wemore-toggle <friendlyName>

It's simply a wrapper around the "toggle by friendly name" example above.