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

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

Listen for data:

import mqttudp.engine

def recv_packet(ptype,topic,value,pflags,addr):
    if ptype != "publish":
        print( ptype + ", " + topic + "\t\t" + str(addr) )
        return
    print( topic+"="+value+ "\t\t" + str(addr) )

if __name__ == "__main__":
    mqttudp.engine.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.

Files for mqttudp, version 0.1.post1
Filename, size File type Python version Upload date Hashes
Filename, size mqttudp-0.1.post1-py3-none-any.whl (11.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mqttudp-0.1.post1.tar.gz (15.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page