Metadata-Version: 2.4
Name: philiprehberger-mqtt-client
Version: 0.1.5
Summary: Simplified MQTT pub/sub wrapper with auto-reconnect
Project-URL: Homepage, https://github.com/philiprehberger/py-mqtt-client#readme
Project-URL: Repository, https://github.com/philiprehberger/py-mqtt-client
Project-URL: Issues, https://github.com/philiprehberger/py-mqtt-client/issues
Project-URL: Changelog, https://github.com/philiprehberger/py-mqtt-client/blob/main/CHANGELOG.md
Author: Philip Rehberger
License-Expression: MIT
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: paho-mqtt>=2.0
Description-Content-Type: text/markdown

# philiprehberger-mqtt-client

[![Tests](https://github.com/philiprehberger/py-mqtt-client/actions/workflows/publish.yml/badge.svg)](https://github.com/philiprehberger/py-mqtt-client/actions/workflows/publish.yml)
[![PyPI version](https://img.shields.io/pypi/v/philiprehberger-mqtt-client.svg)](https://pypi.org/project/philiprehberger-mqtt-client/)
[![License](https://img.shields.io/github/license/philiprehberger/py-mqtt-client)](LICENSE)

Simplified MQTT pub/sub wrapper with auto-reconnect.

## Install

```bash
pip install philiprehberger-mqtt-client
```

## Usage

```python
from philiprehberger_mqtt_client import MQTTClient

client = MQTTClient("mqtt://localhost:1883", client_id="my-app")

@client.on("home/temperature")
def on_temperature(topic, payload):
    print(f"Temperature: {float(payload)}°C")

@client.on("home/+/status")  # wildcard
def on_device_status(topic, payload):
    device = topic.split("/")[1]
    print(f"{device}: {payload}")

# Publish
client.publish("home/lights/living", "on")
client.publish_json("home/sensors/data", {"temp": 22.5, "humidity": 45})

# Connect (blocks with auto-reconnect)
client.connect()

# Or background mode
client.connect(background=True)
```

## Features

- Decorator-based subscriptions
- MQTT wildcard support (`+` and `#`)
- Auto-reconnect with exponential backoff
- JSON publish/subscribe helpers
- TLS support (`mqtts://`)
- Last will and testament
- Authentication


## Development

```bash
pip install -e .
python -m pytest tests/ -v
```

## License

MIT
