Skip to main content

mqttsensor

A Python package for sending sensor data over MQTT with message persistence and reconnection support.

Features

  • MQTT client with TLS support
  • Automatic message storage and resend on connection loss
  • Configurable via TOML file
  • Logging with loguru

Installation

pip install .

Configuration

Create a config.toml file in your project directory:

[mqtt]
broker = "localhost"
port = 1883
client_id = "your_client_id"
ca_certs = "ca.pem"
certfile = "cert.pem"
key = "key.pem"
max_times = 3

Usage

from mqttsensor.main import init_client

config, mqtt_client = init_client("config.toml")
mqtt_client.start()
# Send sensor data
mqtt_client.send_sensor_data(
    measurement="temperature",
    location="office",
    sensor_id="sensor01",
    unit="C",
    value=23.5
)
mqtt_client.stop()

Testing

Run all tests with:

pytest

License

MIT License

Metadata

Release files for mqttsensor 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mqttsensor 0.2.1
File Size Uploaded Provenance Actions
mqttsensor-0.2.1.tar.gz 23.3 kB Without provenance Details for mqttsensor-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mqttsensor 0.2.1
File Interpreter ABI Platform Actions
mqttsensor-0.2.1-py3-none-any.whl Python 3 none any Details for mqttsensor-0.2.1-py3-none-any.whl

Total release size: 29.4 kB

Release files / mqttsensor-0.2.1.tar.gz

Download URL mqttsensor-0.2.1.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
19e3a326ba5242ca44061fb023dfbc68b968750e78e1fb1a8d14f2c2b38189e6
BLAKE2b-256 checksum
How to use checksums
39a6a4f906989605d79f2d82f3546d01cbd1d23f50e7ac51068d5983f340ac9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.5

Release files / mqttsensor-0.2.1-py3-none-any.whl

Download URL mqttsensor-0.2.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
530f04cea2166151e941472f0294bf9d71571119c6a19ca775e9d4cafd806976
BLAKE2b-256 checksum
How to use checksums
5e4e53c29a9fcb7cacb2c9dca3c9cdeb9c7b9a46219845f595e318d4c79ca455
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.5

Security for mqttsensor 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page