channels-asgi-mqtt
Interface between MQTT and ASGI and Channels 2.0 compatible
Installation
pip install chasgimqtt
Configuration
First you would to configure a valid channel_layer endpoint to consume and connect between chasgimqtt and channels.
In your_channel_application/asgi.py:
import os
import django
from channels.routing import get_default_application
from channels.layers import get_channel_layer
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "your_channel_application.settings")
django.setup()
# Application
application = get_default_application()
# Layers
channel_layer = get_channel_layer()
Usage
chasgimqtt -H iot.eclipse.org -p 1883 --topic=some_topic:2 your_channel_application.asgi:channel_layer
Options
chasgimqtt -h
usage: chasgimqtt [-h] [-H HOST] [-p PORT] [-v] [-U USERNAME] [-P PASSWORD]
[--topic TOPICS] [-n CHANNEL_NAME] [-s CHANNEL_SUB]
[-x CHANNEL_PUB]
channel_layer
Simple MQTT bridge for ASGI
positional arguments:
channel_layer The ASGI channel layer instance to use as
path.to.module:instance.path
optional arguments:
-h, --help show this help message and exit
-H HOST, --host HOST MQTT broker host
-p PORT, --port PORT MQTT broker port
-v, --verbosity Set verbosity
-U USERNAME, --username USERNAME
MQTT username to authorised connection
-P PASSWORD, --password PASSWORD
MQTT password to authorised connection
--topic TOPICS MQTT topics with qos to subscribe --topic TOPIC:QOS
--topic /office/sensor:0 --topic /home/sensor:1 If
empty (#, 2) is set as default
-n CHANNEL_NAME, --channel-name CHANNEL_NAME
Name of Channels's channel to send and receive
messages
-s CHANNEL_SUB, --channel-sub CHANNEL_SUB
Name of Channels's channel for MQTT Sub messages,
default is mqtt.pub
-x CHANNEL_PUB, --channel-pub CHANNEL_PUB
Name of Channels's channel for MQTT Pub messages,
default is mqtt.sub
HOST: MQTT broker host
PORT: MQTT broker port, default 1883
USERNAME: MQTT username to authorised connection
PASSWORD: MQTT password to authorised connection
TOPICS: MQTT topics with qos to subscribe. This option expect a valid topic name and a QOS value splited by :
To subscribe to a list of topics use the same option --topic.
--topic some_topic:qos --topic another_topic:qos --topic home/kitchen_gas_sensor:2 --topic home/office_air_sensor:0
CHANNEL_NAME : Name of Channels's channel to send and receive messages, this channel_name must to exist in your channel's consumer, default is mqtt.
CHANNEL_SUB : Name of Channels's channel for MQTT Sub messages, default is mqtt.sub.
CHANNEL_PUB : Name of Channels's channel for MQTT Pub messages, default is mqtt.pub.
License
Open source projects: AGPL-3.0
Commercial / proprietary projects: Commercial License
Metadata
Release files for chasgimqtt 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chasgimqtt-1.0.0.tar.gz | 17.6 kB | Without provenance | Details for chasgimqtt-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chasgimqtt-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for chasgimqtt-1.0.0-py3-none-any.whl |
Total release size: 35.9 kB
Release files / chasgimqtt-1.0.0.tar.gz
| Download URL | chasgimqtt-1.0.0.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a04fc0ab8adbb70f095c43e6b7fd4bc211569cbbb876e27084a6a52ebb2875c
|
|
BLAKE2b-256 checksum How to use checksums |
989309a07e1cddc123808c0c3aae49a1d8ea752ecb0157c01d0d88f9b1338a48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / chasgimqtt-1.0.0-py3-none-any.whl
| Download URL | chasgimqtt-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92e73ed5307baebd83e82636d09537f5b04d9a87d24659bc71dc5ac4baf80c65
|
|
BLAKE2b-256 checksum How to use checksums |
9f5684f4961948a93699ec7fa7d38c21a432577d91540d3824a9e681f7147d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for chasgimqtt 1.0.0
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.