Skip to main content

Daemonized bridge between XMPP and MQTT

Project description

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:

{
  "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.

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

xmpp2mqtt-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xmpp2mqtt-0.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file xmpp2mqtt-0.1.0.tar.gz.

File metadata

  • Download URL: xmpp2mqtt-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for xmpp2mqtt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af553d3e759242bc0c039505bb0a6e93cd44401ee3bdd1e705b5f890ead85079
MD5 717326c9aa1786c19531a46935ea8a84
BLAKE2b-256 4773de117d3f8c97ab76d876aca4159ef1485e0973621066aa5350c6f2dd461d

See more details on using hashes here.

File details

Details for the file xmpp2mqtt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xmpp2mqtt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for xmpp2mqtt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb2a932658d55ce9dd3e00fb2979a5d34348091876e3e65d1c94ebfe949f447d
MD5 687e3936fb234a968368026f536ac485
BLAKE2b-256 39a7c8abced91a3477bfcdcbd75dc4d0903368a677bef549f342df1d14be550e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page