Files
flucto-heisskleber/README.md
Felix Weiler-Detjen 01d8042c3f Update README.
2025-09-16 11:02:36 +02:00

3.5 KiB

Heisskleber

PyPI Python Version License

Read the documentation at https://heisskleber.readthedocs.io/ Tests codecov

pre-commit Format

🇩🇪Heißkleber m: "hot glue".

Heisskleber is a versatile library designed to seamlessly "glue" together various data producers and consumers across a multitude of protocols including zmq, mqtt, udp, serial, files and cmdline. Heisskleber offers asynchronous interfaces for a wide range of IoT connectivity needs.

Features

  • Multiple Protocol Support: Easy integration with zmq, mqtt, udp, serial, and cmdline.
  • Custom Data Handling: Customizable unpacker and packer functions allow for the translation of any data format (e.g., ascii encoded, comma-separated messages from a serial bus) into user defined objects (dataclasses, pydantic classes... default: dictionaries) for easy manipulation and transmission.
  • Extensible: Designed for easy extension with additional protocols and data handling functions.
  • Modern type hints

Installation

You can install Heisskleber via pip from PyPI:

pip install heisskleber

Quick Start

Here's a simple example to demonstrate how Heisskleber can be used to connect a serial input to an mqtt output:

"""
A simple forwarder that takes messages from a serial device and publishes them via MQTT.
"""
import asyncio

from heisskleber.serial import SerialReceiver, SerialConf
from heisskleber.mqtt import MqttSender, MqttConf


async def main():
  source = SerialSubscriber(config=SerialConf(port="/dev/ACM0", baudrate=9600))
  sink = MqttPublisher(config=MqttConf(host="mqtt.example.com", port=1883, user="", password=""))

  while True:
      data, metadata = await source.receive()
      await sink.send(data, topic=f"hotglue/{metadata.get("topic", "serial")}")

asyncio.run(main())

All sources and sinks come with customizable "unpacker" and "packer" functions, making it simple to work with various data formats.

See the documentation for detailed usage.

License

Distributed under the terms of the MIT license, Heisskleber is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.