Skip to main content

Python client for the IoTFlow IoT platform — telemetry uplink and two-way device control over HTTP or MQTT (Raspberry Pi, PC, any device that runs Python)

Project description

IoTFlow — Python client

Connect any device that runs Python (Raspberry Pi, PC, Mac, Linux SBCs) to the IoTFlow platform. For microcontrollers (Arduino, ESP8266, ESP32) use the Arduino library — both speak the same protocol.

Install

pip install iotflow            # HTTP only (zero dependencies)
pip install "iotflow[mqtt]"    # + real-time MQTT (paho-mqtt)

Straight from GitHub (before/without a PyPI release):

pip install "iotflow[mqtt] @ git+https://github.com/alfredang/iotplatform.git#subdirectory=clients/python"

Or zero-install — HTTP mode uses only the standard library, so you can just drop the file next to your script:

curl -O https://raw.githubusercontent.com/alfredang/iotplatform/main/clients/python/iotflow.py

Report readings (HTTP — out of the box)

from iotflow import IoTFlow

iot = IoTFlow("https://iot.tertiaryinfotech.com", "dev_XXXX", "rpi-weather")
iot.send(temperature=22.5, humidity=60)     # several metrics at once
iot.virtual_write("temperature", 22.5)      # or one at a time

Report readings (MQTT — every 10 s)

The Python equivalent of the Arduino ESP8266_Telemetry_Upload example — see examples/telemetry_upload.py:

import time
from iotflow import IoTFlow

iot = IoTFlow(token="dev_XXXX", device_id="test-device",
              mqtt_host="192.168.3.228", mqtt_port=1883)
iot.connect()                               # MQTT runs in the background

while True:
    iot.mqtt_publish(temperature=28.5, humidity=65, voltage=3.7)
    time.sleep(10)

React to control commands

Poll over HTTP (no extra deps):

@iot.on_command
def handle(pin, value, text):
    if pin == "pump":
        print("pump ->", value)             # drive a GPIO here

iot.run(interval=3)                         # blocks, polls every 3s

Real-time over MQTT:

iot = IoTFlow(token="dev_XXXX", device_id="rpi-room",
              mqtt_host="broker.host", mqtt_port=1883)

@iot.on_command
def handle(pin, value, text): ...

iot.loop_forever()

pin names match your dashboard widgets: report to a metric name (temperature) for Number/Gauge/Line widgets; receive on a control pin (V1, relay, pump) set by Button/Switch/Slider widgets or n8n flows.

Publish to PyPI (maintainers)

cd clients/python
python -m build
twine upload dist/*

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

iotflow-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iotflow-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file iotflow-0.1.0.tar.gz.

File metadata

  • Download URL: iotflow-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for iotflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 17bd344c7f9063120921c21ac80480f38145ca247cd38173209ecfc01fd8f225
MD5 5724a0cf35219b95ef4fc5a9fd0568c8
BLAKE2b-256 b02350f96e629cc74a8c72c21f4e28b4e5b9614854905264de81a19823918610

See more details on using hashes here.

File details

Details for the file iotflow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iotflow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for iotflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51c83357e3fa6e16a9fd0722eb7ead44306a3437d177d5406b09f87f5a62eaba
MD5 426de496bc3b477f4dd31e19b98c61a8
BLAKE2b-256 27d2debc91c7e65b856981b0df371325c758646d4d0ce1a526be46f70e391876

See more details on using hashes here.

Supported by

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