0.0.6 • Published 10 years ago

pi2mqtt v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

pi2mqtt

Connect RaspberryPi GPIOs and 1-Wire temperature sensors to MQTT

Install

Tested on Raspbian Wheezy

Prerequisites - Node.js and npm Installation:

wget http://node-arm.herokuapp.com/node_latest_armhf.deb  
sudo dpkg -i node_latest_armhf.deb

Install pi2mqtt: sudo npm install -g pi2mqtt

Usage

Usage: pi2mqtt [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"]
  -d, --debug          don't fork into background and log to stdout. implies --verbosity debug
  -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>/status"]
  -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>/w1/<1-wire-serial>

Example: raspberrypi/w1/28-000005908b0e

GPIOs

<prefix>/gpio/<gpio-number>

Aliases

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

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

Ideas/Todo

  • PiFace
  • more 1-Wire devices
  • HD44780 Displays
  • i2c devices?
  • Test on beagle, banana, cubie, hummingboard, ... ?

Changes