Skip to main content

MQTT transport extension for iqrfpy

Project description

iqrf-mqtt-transport

An extension for iqrfpy for MQTT communication with IQRF Gateway daemon.

Quick start

Before installing the library, it is recommended to first create a virtual environment. Virtual environments help isolate python installations as well as pip packages independent of the operating system.

A virtual environment can be created and launched using the following commands:

python3 -m venv <dir>
source <dir>/bin/activate

iqrfpy can be installed using the pip utility:

python3 -m pip install -U iqrfpy-mqtt-transport

Example use:

from iqrfpy.ext.mqtt_sync_transport import MqttTransport, MqttTransportParams
from iqrfpy.peripherals.coordinator.requests.bonded_devices import BondedDevicesRequest
from iqrfpy.peripherals.coordinator.responses.bonded_devices import BondedDevicesResponse

params = MqttTransportParams(
    host=..., # MQTT broker host
    port=..., # MQTT broker port
    client_id=..., # MQTT client ID
    request_topic=..., # Request topic that Daemon subscribes to
    response_topic=..., # Response topic that Daemon publishes responses to
    qos=1,
    keepalive=25
)
transport = MqttTransport(params=params, auto_init=True)

request = BondedDevicesRequest()
response: BondedDevicesResponse = transport.send_and_receive(request=request, timeout=10)

print(response.bonded)

Documentation

For more information, check out our API reference.

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

iqrfpy-mqtt-transport-0.1.0.tar.gz (10.4 kB view hashes)

Uploaded Source

Built Distribution

iqrfpy_mqtt_transport-0.1.0-py3-none-any.whl (11.4 kB view hashes)

Uploaded Python 3

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