• Stars
    star
    463
  • Rank 94,019 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Expose GPIO modules (Raspberry Pi, Beaglebone, PCF8754, PiFace2 etc.) and digital sensors (LM75 etc.) to an MQTT server for remote control and monitoring.

MQTT IO

Discord

Exposes general purpose inputs and outputs (GPIO), hardware sensors and serial devices to an MQTT server. Ideal for single-board computers such as the Raspberry Pi.

Visit the documentation for more detailed information.

Supported Hardware

Hardware support is provided by specific GPIO, Sensor and Stream modules. It's easy to add support for new hardware and the list is growing fast.

GPIO Modules

  • Beaglebone GPIO (beaglebone)
  • Linux Kernel 4.8+ libgpiod (gpiod)
  • GPIO Zero (gpiozero)
  • MCP23017 IO expander (mcp23017)
  • Orange Pi GPIO (orangepi)
  • PCF8574 IO expander (pcf8574)
  • PCF8575 IO expander (pcf8575)
  • PiFace Digital IO 2 (piface2)
  • Raspberry Pi GPIO (raspberrypi)

Sensors

  • ADS1x15 analog to digital converters (ads1x15)
  • AHT20 temperature and humidity sensor (aht20)
  • BH1750 light level sensor (bh1750)
  • BME280 temperature, humidity and pressure sensor (bme280)
  • BME680 temperature, humidity and pressure sensor (bme680)
  • DHT11/DHT22/AM2302 temperature and humidity sensors (dht22)
  • DS18S20/DS1822/DS18B20/DS1825/DS28EA00/MAX31850K temperature sensors (ds18b)
  • HCSR04 ultrasonic range sensor (connected to the Raspberry Pi on-board GPIO) (hcsr04)
  • INA219 DC current sensor (ina219)
  • LM75 temperature sensor (lm75)
  • MCP3008 analog to digital converter (mcp3008)

Streams

  • Serial port (serial)
  • PN532 NFC/RFID reader (pn532)

Installation

Requires Python 3.6+

pip3 install mqtt-io

Execution

python3 -m mqtt_io config.yml

Configuration Example

Configuration is written in a YAML file which is passed as an argument to the server on startup.

See the full configuration documentation for details.

The following example will configure the software to do the following:

  • Publish MQTT messages on the home/input/doorbell topic when the doorbell is pushed and released.
  • Subscribe to the MQTT topic home/output/port_light/set and change the output when messages are received on it.
  • Periodically read the value of the LM75 sensor and publish it on the MQTT topic home/sensor/porch_temperature.
  • Publish any data received on the /dev/ttyUSB0 serial port to the MQTT topic home/serial/alarm_system.
  • Subscribe to the MQTT topic home/serial/alarm_system/send and send any data received on that topic to the serial port.
mqtt:
  host: localhost
  topic_prefix: home

# GPIO
gpio_modules:
  # Use the Raspberry Pi built-in GPIO
  - name: rpi
    module: raspberrypi

digital_inputs:
  # Pin 0 is an input connected to a doorbell button
  - name: doorbell
    module: rpi
    pin: 0

digital_outputs:
  # Pin 1 is an output connected to a light
  - name: porch_light
    module: rpi
    pin: 1

# Sensors
sensor_modules:
  # An LM75 sensor attached to the I2C bus
  - name: lm75_sensor
    module: lm75
    i2c_bus_num: 1
    chip_addr: 0x48

sensor_inputs:
  # The configuration of the specific sensor value to use (LM75 only has temperature)
  - name: porch_temperature
    module: lm75_sensor

# Streams
stream_modules:
  # A serial port to communicate with the house alarm system
  - name: alarm_system
    module: serial
    device: /dev/ttyUSB0
    baud: 9600

More Repositories

1

upnpclient

uPnP client library for Python 3.
Python
199
star
2

pcf8574

A library for the pcf8574 I2C IO expander chip
Python
32
star
3

apcaccess

Python
30
star
4

zmcat

A simple command line tool to test ZMQ push/pull/pub/sub sockets. Based on https://github.com/lucasdicioccio/zmcat
Python
11
star
5

confp

Builds configuration files using Jinja2 template with data pulled from Redis, etcd, Terraform or environment variables.
Python
11
star
6

xbee-helper

This project offers a high level API to an XBee device running an up-to-date version of the ZigBee firmware. It builds upon the existing XBee project by abstracting more functionality into methods.
Python
6
star
7

docker-vault-cert-reloader

Send SIGHUP signal to Vault when the TLS certificate is updated.
Shell
5
star
8

docker-motion-mqtt

Motion CCTV tracking software, plus mosquitto-clients installed.
3
star
9

remember-django-docs-version

JavaScript
2
star
10

ast-to-xml

Converts a Python abstract source tree (AST) to an XML representation. Uses lxml to enable full XPath searching.
Python
1
star
11

terraform-provider-influxdb-v2

Terraform provider for influxv2
Go
1
star
12

runner-chaser

Python
1
star
13

celery-docker-tools

A set of Celery tasks to perform actions using the docker API
Python
1
star
14

aws-expire

Python
1
star
15

simple-http-db

This is a simple HTTP (Flask) server which accepts HTTP POSTs to any endpoint, then saves the body data back to a Redis server. The data can be retrieved again by doing an HTTP GET to the same endpoint.
Python
1
star
16

chromium-pdf-api

A server which uses headless Chromium to visit any URL and create a PDF from it. Uses a simple JSON API to set the URL and options for PDF creation.
Python
1
star
17

digidoc

a document digitiser
Python
1
star