semvec/pypi-packages huggingface dataset:
xmpp2mqtt 0.1.0
Daemonized bridge between XMPP and MQTT
Requires Python: >=3.11

# xmpp2mqtt

`xmpp2mqtt` is a daemonizable microservice that bridges XMPP chats with MQTT endpoints so
automation tooling that only understands MQTT/HTTP can exchange messages with XMPP users.
The service logs into an XMPP account via `slixmpp`, subscribes/publishes MQTT topics
via `paho-mqtt`, and relays messages in both directions using JSON payloads.

## Status

In development, somewhat useable

## Configuration

Create a JSON file (e.g. `~/.config/xmpp2mqtt.cfg`, location os overrideable with
a CLI parameter) with at least the following structure:

```json
{
  "xmpp": {
    "jid": "bot@example.com/resource",
    "password": "changeme",
    "host": "xmpp.example.com",
    "port": 5222,
    "use_tls": true,
    "verify_tls": true,
    "use_ipv6": false,
    "allowed_jids": {
      "receive": ["trusted-user@example.com"],
      "send_only": ["notify-only@example.com"]
    }
  },
  "mqtt": {
    "host": "mqtt.example.com",
    "port": 8883,
    "username": "xmpp2mqtt",
    "password": "secret",
    "keepalive": 60,
    "inbound_topics": ["xmpp/bridge/in"],
    "outbound_topics": ["xmpp/bridge/out"],
    "qos": 1
  },
  "backoff": {
    "initial": 1.0,
    "max": 60.0,
    "jitter": 0.5
  },
  "logging": {
    "level": "debug"
  }
}
```

Notes:

- Empty topic lists are allowed; the service simply skips bridging for that direction.
- `mqtt.inbound_topics` are the publish targets for messages received via XMPP (XMPP -> MQTT).
- `mqtt.outbound_topics` are the subscriptions for payloads that should be delivered
  to XMPP peers (MQTT -> XMPP).
- `allowed_jids.receive` implies send permission as well.  `send_only` grants transmit privilege
  without accepting inbound chats.
- Additional sections (REST, HTTP TLS, etc.) will be defined once the REST bridge is implemented.

## CLI Overview

```
xmpp2mqtt start [--foreground] [--cfg path] [--logfile path] [--pidfile path]
xmpp2mqtt stop [--pidfile path]
xmpp2mqtt status [--pidfile path]
```

- `start --foreground` keeps the process attached to the terminal with stdout/stderr logging.
- Background mode writes logs to the configured file; use newsyslog for rotation.