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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@binaryme/mqtt-onoff

v1.0.2

Published

MQTT-onoff bridge.

Readme

Bridge between mqtt and onoff.

Usage: mqtt-onoff [options]

Options:
  -c, --url <value>       connect URL (default: mqtt://localhost:1883)
  -u, --username <value>  MQTT broker username (optional)
  -p, --password <value>  MQTT broker password (optional)
  -t, --topic <value>     MQTT topic (default: onoff)
  -l, --log <value>       extra logging for socket connection issues

Environment variables may be used instead: MQTT_URL, MQTT_USERNAME, MQTT_PASSWORD, MQTT_TOPIC and MQTT_ONOFF_LOG.

A config file named .mqtt-onoff.json may also be used.

{
  "url": "mqtt://localhost:1883",
  "username": "system",
  "password": "***",
  "topic": "onoff/device1",
  "log": 1
}

Configure

Pins are configured by publishing to the topic cmnd/[topic]/configure.

Configuration payload needs to be a JSON string in the following format:

{
  "pins": [
    {
      "topic": "doorbel", // used to compose the MQTT topic
      "gpio": 22, // onoff gpio
      "direction": "in", // onoff direction
      "edge": "none", // onoff edge
      "options": {} // onoff options
    }
  ]
}

More info about these properties can be found here.

At any time individual pins can be configured by publishing a JSON string the following format:

{
  "topic": "doorbel",
  "gpio": 22,
  "direction": "out"
}

Inputs (direction: "in")

An onoff read can be done by publishing any payload (eg. "") to cmnd/[topic]/[pin.topic]. This will publish the input value to tele/[topic]/[pin.topic].

In the logs this is refered to as an R.O.D. (read on deamand).

Watch inputs (direction: "watch")

When the onoff pin is configured an in direction is used. However within mqtt-onoff an onoff watch is setup and values are published to tele/[topic]/[pin.topic].

An R.O.D can also be done on these pins.

Outputs (direction: "out" | "high" | "low")

Publishing "0" or "1" to cmnd/[topic]/[pin.topic] will result in an onoff write. A successful write is acknowledged by the payload being published to tele/[topic]/[pin.topic].