mqtt-io


Namemqtt-io JSON
Version 2.3.0 PyPI version JSON
download
home_page
SummaryExpose GPIO modules (Raspberry Pi, Beaglebone, PCF8754, PiFace2 etc.), digital sensors (LM75 etc.) and serial streams to an MQTT server for remote control and monitoring.
upload_time2024-03-01 13:47:37
maintainer
docs_urlNone
authorEllis Percival
requires_python>=3.6,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
***************************************************************************************
DO NOT EDIT README.md DIRECTLY, IT'S GENERATED FROM README.md.j2 USING generate_docs.py
***************************************************************************************
-->

# MQTT IO

[![Discord](https://img.shields.io/discord/713749043662290974.svg?label=Chat%20on%20Discord&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/gWyV9W4)

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](https://mqtt-io.app/) 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`)
  - ADXl345 3-axis accelerometer up to ±16g  (`adxl345`)
  - PMS5003 particulate sensor (`pms5003`)
  - SHT40/SHT41/SHT45 temperature and humidity sensors (`sht4x`)

### 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](https://github.com/flyte/pi-mqtt-gpio/wiki/Configuration) 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.

```yaml
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
  # An INA219 sensor attached to the I2C bus
  - name: ina219_sensor
    module: ina219
    i2c_bus_num: 1
    chip_addr: 0x43


sensor_inputs:
  # lm75 - The configuration of the specific sensor value to use (LM75 only has temperature)
  - name: porch_temperature
    module: lm75_sensor
  # ina219 - The configuration of the specific sensor value to use (4 options for the ina219 sensor)
  - name: power
    type: power
    module: ina219_sensor
  - name: bus_voltage
    type: bus_voltage
    module: ina219_sensor
  - name: current
    type: current
    module: ina219_sensor
  - name: shunt_voltage
    type: shunt_voltage
    module: ina219_sensor

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


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mqtt-io",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ellis Percival",
    "author_email": "mqtt-io@failcode.co.uk",
    "download_url": "https://files.pythonhosted.org/packages/84/d5/16c6b6f40c881ce9f38796e1b44e86129c5bdcab52ed2d962029afc9596a/mqtt_io-2.3.0.tar.gz",
    "platform": null,
    "description": "<!--\n***************************************************************************************\nDO NOT EDIT README.md DIRECTLY, IT'S GENERATED FROM README.md.j2 USING generate_docs.py\n***************************************************************************************\n-->\n\n# MQTT IO\n\n[![Discord](https://img.shields.io/discord/713749043662290974.svg?label=Chat%20on%20Discord&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/gWyV9W4)\n\nExposes 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.\n\nVisit the [documentation](https://mqtt-io.app/) for more detailed information.\n\n## Supported Hardware\n\nHardware 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.\n\n### GPIO Modules\n\n  - Beaglebone GPIO (`beaglebone`)\n  - Linux Kernel 4.8+ libgpiod (`gpiod`)\n  - GPIO Zero (`gpiozero`)\n  - MCP23017 IO expander (`mcp23017`)\n  - Orange Pi GPIO (`orangepi`)\n  - PCF8574 IO expander (`pcf8574`)\n  - PCF8575 IO expander (`pcf8575`)\n  - PiFace Digital IO 2 (`piface2`)\n  - Raspberry Pi GPIO (`raspberrypi`)\n\n### Sensors\n\n  - ADS1x15 analog to digital converters (`ads1x15`)\n  - AHT20 temperature and humidity sensor (`aht20`)\n  - BH1750 light level sensor (`bh1750`)\n  - BME280 temperature, humidity and pressure sensor (`bme280`)\n  - BME680 temperature, humidity and pressure sensor (`bme680`)\n  - DHT11/DHT22/AM2302 temperature and humidity sensors (`dht22`)\n  - DS18S20/DS1822/DS18B20/DS1825/DS28EA00/MAX31850K temperature sensors (`ds18b`)\n  - HCSR04 ultrasonic range sensor (connected to the Raspberry Pi on-board GPIO) (`hcsr04`)\n  - INA219 DC current sensor (`ina219`)\n  - LM75 temperature sensor (`lm75`)\n  - MCP3008 analog to digital converter (`mcp3008`)\n  - ADXl345 3-axis accelerometer up to \u00b116g  (`adxl345`)\n  - PMS5003 particulate sensor (`pms5003`)\n  - SHT40/SHT41/SHT45 temperature and humidity sensors (`sht4x`)\n\n### Streams\n\n  - Serial port (`serial`)\n  - PN532 NFC/RFID reader (`pn532`)\n\n## Installation\n\n_Requires Python 3.6+_\n\n`pip3 install mqtt-io`\n\n## Execution\n\n`python3 -m mqtt_io config.yml`\n\n## Configuration Example\n\nConfiguration is written in a YAML file which is passed as an argument to the server on startup.\n\nSee the [full configuration documentation](https://github.com/flyte/pi-mqtt-gpio/wiki/Configuration) for details.\n\nThe following example will configure the software to do the following:\n\n- Publish MQTT messages on the `home/input/doorbell` topic when the doorbell is pushed and released.\n- Subscribe to the MQTT topic `home/output/port_light/set` and change the output when messages are received on it.\n- Periodically read the value of the LM75 sensor and publish it on the MQTT topic `home/sensor/porch_temperature`.\n- Publish any data received on the `/dev/ttyUSB0` serial port to the MQTT topic `home/serial/alarm_system`.\n- Subscribe to the MQTT topic `home/serial/alarm_system/send` and send any data received on that topic to the serial port.\n\n```yaml\nmqtt:\n  host: localhost\n  topic_prefix: home\n\n# GPIO\ngpio_modules:\n  # Use the Raspberry Pi built-in GPIO\n  - name: rpi\n    module: raspberrypi\n\ndigital_inputs:\n  # Pin 0 is an input connected to a doorbell button\n  - name: doorbell\n    module: rpi\n    pin: 0\n\ndigital_outputs:\n  # Pin 1 is an output connected to a light\n  - name: porch_light\n    module: rpi\n    pin: 1\n\n# Sensors\nsensor_modules:\n  # An LM75 sensor attached to the I2C bus\n  - name: lm75_sensor\n    module: lm75\n    i2c_bus_num: 1\n    chip_addr: 0x48\n  # An INA219 sensor attached to the I2C bus\n  - name: ina219_sensor\n    module: ina219\n    i2c_bus_num: 1\n    chip_addr: 0x43\n\n\nsensor_inputs:\n  # lm75 - The configuration of the specific sensor value to use (LM75 only has temperature)\n  - name: porch_temperature\n    module: lm75_sensor\n  # ina219 - The configuration of the specific sensor value to use (4 options for the ina219 sensor)\n  - name: power\n    type: power\n    module: ina219_sensor\n  - name: bus_voltage\n    type: bus_voltage\n    module: ina219_sensor\n  - name: current\n    type: current\n    module: ina219_sensor\n  - name: shunt_voltage\n    type: shunt_voltage\n    module: ina219_sensor\n\n# Streams\nstream_modules:\n  # A serial port to communicate with the house alarm system\n  - name: alarm_system\n    module: serial\n    device: /dev/ttyUSB0\n    baud: 9600\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Expose GPIO modules (Raspberry Pi, Beaglebone, PCF8754, PiFace2 etc.), digital sensors (LM75 etc.) and serial streams to an MQTT server for remote control and monitoring.",
    "version": "2.3.0",
    "project_urls": {
        "Documentation": "https://flyte.github.io/mqtt-io/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad0409e6a11f10cf31f01632577d9e0a861639bd9ba7ddcc93bf8f326359b68a",
                "md5": "051988b9cb1482c38ce315da61be9e53",
                "sha256": "c8484c7299ad6804b569838ba2628feec7a68915624c250b3f11f79569aae152"
            },
            "downloads": -1,
            "filename": "mqtt_io-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "051988b9cb1482c38ce315da61be9e53",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 86598,
            "upload_time": "2024-03-01T13:47:35",
            "upload_time_iso_8601": "2024-03-01T13:47:35.545088Z",
            "url": "https://files.pythonhosted.org/packages/ad/04/09e6a11f10cf31f01632577d9e0a861639bd9ba7ddcc93bf8f326359b68a/mqtt_io-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84d516c6b6f40c881ce9f38796e1b44e86129c5bdcab52ed2d962029afc9596a",
                "md5": "1042d2067f7ea828310b4a07de820a29",
                "sha256": "9f3600917b7c0eb3a9b9fc53ed584f0775b600cc4a413993e98166d89ccb249f"
            },
            "downloads": -1,
            "filename": "mqtt_io-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1042d2067f7ea828310b4a07de820a29",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 59381,
            "upload_time": "2024-03-01T13:47:37",
            "upload_time_iso_8601": "2024-03-01T13:47:37.617605Z",
            "url": "https://files.pythonhosted.org/packages/84/d5/16c6b6f40c881ce9f38796e1b44e86129c5bdcab52ed2d962029afc9596a/mqtt_io-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-01 13:47:37",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mqtt-io"
}
        
Elapsed time: 0.22701s