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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file esphome_mqtt_timescaledb_ingestor-0.2.0.tar.gz.
File metadata
- Download URL: esphome_mqtt_timescaledb_ingestor-0.2.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.11.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64bee059fbaa26ac3c4c1cbd18c46ccfddb176417420836c9739f1f895e00338
|
|
| MD5 |
7c88524eeb825110e9790787afae6b12
|
|
| BLAKE2b-256 |
0db5d0ff0becd116a4993f5e62ba0d1466bb7162e4c074fca40d170891da7960
|
File details
Details for the file esphome_mqtt_timescaledb_ingestor-0.2.0-py3-none-any.whl.
File metadata
- Download URL: esphome_mqtt_timescaledb_ingestor-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.11.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca7eede5bec81696760244a4ea0627c693e90bc0c390df0e4568044aad59c2b4
|
|
| MD5 |
70fe1a7f2db6c84ece79bdb51928c120
|
|
| BLAKE2b-256 |
4e494fb73fc0d6f73517ee6ee832114804c13ff5812012b6ec09e4cd4d9a0ba7
|