Skip to main content

A python library for communication with IQRF Network

Project description

What is iqrfpy?

iqrfpy is a library that provides a python API for interacting with the IQRF network utilizing the DPA framework (DPA) or IQRF Gateway Daemon (Daemon) JSON API. Communication between a python runtime and the IQRF network is facilitated by transports.

For communication with Daemon, only the MQTT transport is implemented at this time. However, this library provides an abstract transport class, allowing for custom communication implementations.

The library provides classes for serialization of requests and deserialization of responses to message class objects.

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

Example use:

from iqrfpy.transports.mqtt_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)

The library also provides a single import solution for messages:

from iqrfpy.transports.mqtt_transport import MqttTransport, MqttTransportParams
from iqrfpy.messages import CoordinatorBondedDevicesReq, CoordinatorBondedDevicesRsp

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 = CoordinatorBondedDevicesReq()
response: CoordinatorBondedDevicesRsp = 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-0.1.57.tar.gz (201.4 kB view details)

Uploaded Source

Built Distribution

iqrfpy-0.1.57-py3-none-any.whl (271.0 kB view details)

Uploaded Python 3

File details

Details for the file iqrfpy-0.1.57.tar.gz.

File metadata

  • Download URL: iqrfpy-0.1.57.tar.gz
  • Upload date:
  • Size: 201.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for iqrfpy-0.1.57.tar.gz
Algorithm Hash digest
SHA256 22083f57e40ce449ba8f212b7274010466511a5b3e18c494ad6c7c87b2689131
MD5 7a2519b3b8928d0057e298a182656b1f
BLAKE2b-256 2efb6eb317d5419eef6b3836380afc489cb8360fbb333cf612cf04cd8ae7f268

See more details on using hashes here.

File details

Details for the file iqrfpy-0.1.57-py3-none-any.whl.

File metadata

  • Download URL: iqrfpy-0.1.57-py3-none-any.whl
  • Upload date:
  • Size: 271.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for iqrfpy-0.1.57-py3-none-any.whl
Algorithm Hash digest
SHA256 e63eb15cb17522c2be8f0135e3f20226a5e3e1331241d41a4d036e3d04676436
MD5 5f41e52698833cc19657504fbc40d181
BLAKE2b-256 e33c753ffa92827e05f88c0e6b70a2c1f6c08208f6d425046be4f4bad98f9216

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