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

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.44.tar.gz (153.5 kB view details)

Uploaded Source

Built Distribution

iqrfpy-0.1.44-py3-none-any.whl (247.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for iqrfpy-0.1.44.tar.gz
Algorithm Hash digest
SHA256 2a3aef8a9e86c3c1438eba2434653611c7eeec048d4a89310126a8abfa2343e5
MD5 99dc9034829cc3eb1710923b0d756bb6
BLAKE2b-256 9fdbbe798564f376cfc5d7eab2ddb7337287a7e18d16bacb000cfec032f2d295

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for iqrfpy-0.1.44-py3-none-any.whl
Algorithm Hash digest
SHA256 8435f27790ccaafa6aa38abc46b1ef1a517ec17144f8610dc6cf3c390c0a5959
MD5 e6dc83ae74f668f35ad1ed5d73ce6008
BLAKE2b-256 29fd1317d880e21ba8117bb24ca394ad542d75fafea4f5f6479d600482e7272f

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