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

rpi2mqtt

v2.0.0

Published

Connect a RaspberryPi 1-Wire and GPIOs to MQTT

Downloads

19

Readme

rpi2mqtt

License NPM version Dependency Status Build Status XO code style License

Connect RaspberryPi GPIOs and 1-Wire temperature sensors to MQTT

Install

Prerequisite: Node.js version 6.0 or above. I suggest to use https://github.com/tj/n to install a recent version of Node.js.

Install rpi2mqtt: $ sudo npm install -g rpi2mqtt

To run rpi2mqtt in background an start on system boot I suggest to use PM2.

Usage

Usage: rpi2mqtt [options]

Options:
  -c, --config         use config file                                                          [default: "~/.pi2mqtt/config.json"]
  -l, --log            log to file                                                              [default: "~/.pi2mqtt/daemon.log"]
  -v, --verbosity      possible values: "error", "info", "debug"                                [default: "error"]
  -a, --alias          alias topics. can be used multiple times. See examples                 
  -i, --in, --input    use gpio as input. can be used multiple times. See examples            
  -o, --out, --output  use gpio as output. can be used multiple times. See examples           
  -p, --payload        type of the mqtt payload. possible values are "plain" and "json"         [default: "plain"]
  -r, --retain         publish with retain flag                                               
  -t, --topic          topic prefix                                                             [default: "<hostname>"]
  -x, --testament      topic for connect and last will message                                  [default: "connected"]
  -u, --url            broker url. See https://github.com/mqttjs/MQTT.js#connect-using-a-url    [default: "mqtt://127.0.0.1"]
  -s, --w1-wait        seconds to wait before reading /sys/bus/w1/devices/                      [default: 30]
  -n, --w1-interval    polling interval for 1-wire temperature sensors in seconds               [default: 30]
  -w, --w1-disable     disable 1-wire                                                         
  -h, --help           show help                                                              
  --version            Show version number                             

MQTT Topics

Default prefix is the hostname. You can disable the topic prefix with empty option --topic

1-Wire Temperature Sensors (DS1820)

<prefix>/status/w1/<1-wire-serial>

Example: raspberrypi/status/w1/28-000005908b0e

GPIOs

Example input <prefix>/status/gpio/<gpio-number>

Aliases

You can set individual topics with the --alias option.
Example: rpi2mqtt -a w1/28-000005908b0e:"Temperature/Garden"

Mind that aliases don't affect the configured prefix. So rpi2mqtt -o 17 -a gpio/17:Garden -t Light would result in topic Light/Garden for GPIO17

Ideas/Todo

  • PiFace
  • Displays
  • uart/spi/i2c?

License

MIT Copyright (c) Sebastian Raff