Skip to main content

A robust Python service to ingest ESPHome MQTT data into a TimescaleDB multi-table schema.

Project description

ESPHome MQTT to TimescaleDB Ingestor

A robust Python service that listens for ESPHome data on an MQTT broker and persists it into a structured, multi-table TimescaleDB database.

This project is designed to work with the standard ESPHome and Home Assistant discovery protocols, handling various message types including device discovery, entity configurations, real-time state updates, and commands.

Features

  • Connects to an MQTT broker and subscribes to all relevant ESPHome and Home Assistant topics.
  • Intelligently processes and stores five distinct types of messages.
  • Automatically creates the necessary database tables on the first run.
  • Uses a multi-threaded, queue-based architecture for high performance and resilience.
  • Supports intelligent batch processing for efficient database writes.

Installation

Install the package directly from PyPI:

pip install esphome-mqtt-timescaledb-ingestor

Usage

This package includes an interactive command-line interface (CLI) to help you get started.

1. Initial Configuration

After installing the package, run the configure command. This will launch an interactive setup wizard that will ask for your MQTT and database credentials and save them to a configuration file.

mqtt-ingestor configure

You will be prompted for the following:

  • MQTT Broker Host
  • MQTT Broker Port
  • MQTT Username & Password
  • Database Host
  • Database Port
  • Database Name
  • Database User & Password

2. Start the Ingestor Service

Once you have configured your credentials, you can start the ingestor service:

mqtt-ingestor start

The service will load your saved configuration and begin listening for messages.

Testing

To run the tests, clone the repository, install the development dependencies, and run pytest:

git clone [https://github.com/paandayankur/mqtt-to-timescaledb-ingester.git](https://github.com/paandayankur/mqtt-to-timescaledb-ingester.git)
cd mqtt-to-timescaledb-ingester
poetry install --with dev
poetry run pytest

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esphome_mqtt_timescaledb_ingestor-0.3.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file esphome_mqtt_timescaledb_ingestor-0.3.0.tar.gz.

File metadata

File hashes

Hashes for esphome_mqtt_timescaledb_ingestor-0.3.0.tar.gz
Algorithm Hash digest
SHA256 bc9af432bbeeef4cab1091c7729df7a41689dc6438e48ab5856067533b45e10b
MD5 baced52d53eade44f902dabc25333d33
BLAKE2b-256 9dbfc00672df30d7f85f8a7bfde73563c8f5e4aaa873bc19acb80584315a2876

See more details on using hashes here.

File details

Details for the file esphome_mqtt_timescaledb_ingestor-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for esphome_mqtt_timescaledb_ingestor-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9715adb3129a685ed4d4934e6dee8f0d1582a934ecdb673fc257f999eb240f0
MD5 009ca5621648907150ec73a9e905f99f
BLAKE2b-256 bda7f5ef49a80f1515f245515febb36e2a46efe9bec248d3c2ec0269490699da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page