Skip to main content

An MQTT/UDP implementation in Python

Project description

MQTT/UDP Python (3.x) implementation

You can check other languages implementations also - https://github.com/dzavalishin/mqtt_udp

Dirs

mqttudp - MQTT/UDP library in Python language

examples - Library usage examples

gate.sh - Shell script to start bidirectional MQTT/UDP to MQTT broker gateway mqttudpgate.service - Unix systemctl service definition for gateway

Examples

pub.py - Send one message

dump.py - Print all MQTT/UDP traffic listen.py - Print packets only if content is changeg

mqtt_udp_to_openhab.py - Translate all the data to OpenHAB REST API openhab_to_udp.py - Translate all the data from OpenHAB REST API (default sitemap) to MQTT/UDP

seq_storm_send.py - Send seqentially numbered packets as fast as possible seq_storm_check.py - Check packets for sequentialness and calc speed

mqtt_bidir_gate.py - Translate data between MQTT/UDP and traditional MQTT mqtt_broker_to_udp.py - One way, to MQTT/UDP mqtt_udp_to_broker.py - One way, from MQTT/UDP

random_to_udp.py - Generate traffic with random numbers

ping.py - Send ping and print replies. Not all the implementations respond to ping yet.

Possible requirements

Some code examples may require paho-mqtt and websocket-client

Usage

Send data:

import mqttudp.engine as me

if __name__ == "__main__":
    me.send_publish( "test_topic", "Hello, world!" )

Listen for data:

import mqttudp.engine as me

def recv_packet(pkt):
    if pkt.ptype != me.PacketType.Publish:
        print( str(pkt.ptype) + ", " + pkt.topic + "\t\t" + str(addr) )
        return
    print( pkt.topic+"="+pkt.value+ "\t\t" + str(pkt.addr) )

if __name__ == "__main__":
    me.listen(recv_packet)

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

mqttudp2-0.5.post0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

mqttudp2-0.5.post0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file mqttudp2-0.5.post0.tar.gz.

File metadata

  • Download URL: mqttudp2-0.5.post0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for mqttudp2-0.5.post0.tar.gz
Algorithm Hash digest
SHA256 955c1666e0f506568646a807f247753a0a7fcac81b0e39bf9717c3446e46c1f3
MD5 39ed26d4f988a88d4d57066024b41ba4
BLAKE2b-256 9b21b9cead2e26209bdfc6e6298e01130dbfaf6580bc8b80120d91d1efade7d6

See more details on using hashes here.

File details

Details for the file mqttudp2-0.5.post0-py3-none-any.whl.

File metadata

  • Download URL: mqttudp2-0.5.post0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for mqttudp2-0.5.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 5da5789c46897569f9b0f320e47486471be2c65b0c10da3c9ae642e868d8b849
MD5 dea498715aa38efb02141b6b2a3fd9ab
BLAKE2b-256 e87daffda1d25ddc0484fded4b3096160617b83fd6751e6d53286b15edfb6bb1

See more details on using hashes here.

Supported by

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