Skip to main content

Modular Zigfi Node framework for distributed control and automation

Project description

🔌 Zignode – Zero-Effort, Self-Discovering RPC for Python (and Beyond)

Zignode is a lightweight framework that turns any script (Python and potentially others) into a smart, networked node — often with just a single line of code in Python. Forget about manual server configuration and request handling. Simply expose your functions and let the nodes discover, communicate, and collaborate automatically on your local network.

This project was born from the practical needs of an electronics enthusiast: how to easily control devices connected to a Raspberry Pi (or similar systems) without writing a dedicated server for each project? Zignode is the answer, offering a universal and instant solution.

Although originally implemented in Python, the Zignode protocol is language-agnostic. Support for other platforms (e.g., Arduino/C++, Node.js) is actively being explored.


✨ Key Features

  • ⚙️ Effortless Python Integration Just call zignode.auto(locals()) at the end of your script — and all your functions become available on the network.

  • 🌐 Automatic Network Discovery Nodes scan the local network to find others — no config files, no central server required.

  • 🧐 Intelligent Function Routing Zignode builds a "mesh mind" across the network. If a function isn't available locally, it automatically forwards the call to the right node — even via 2-hop neighbors.

  • 🎯 Targeted or Automatic Execution Call a specific node (by ID) or let the network choose the best node for the job.

  • 🧱 Built-in Web UI Each node hosts a web interface with its function list, status info, and discovered neighbors.

  • 🛎️ Integrated Utilities Optional built-in helpers: msg(), notif(), speak() for notifications and TTS (RHVoice/Linux).

  • 🦦 Lightweight & Interoperable Fully async (aiohttp, netifaces2), using standard HTTP/JSON — works great with ESP32, MicroPython, and is extendable to C++/Arduino/Node.js.


⚙️ Requirements

  • Python 3.8+

  • Automatically installs:

    • aiohttp
    • netifaces2

📦 Installation

pip install zignode

🧪 Usage Example (Python)

#!/usr/bin/python
# -*- coding: utf-8 -*-

import zignode

def set_servo_position(position: int):
    print(f"SERVO: Setting position to {position} degrees.")
    return f"Servo position set to {position}."

def read_temperature():
    temp = 23.5
    print(f"SENSOR: Read temperature: {temp}°C")
    return {"temperature": temp, "unit": "Celsius"}

if __name__ == '__main__':
    zignode.auto(
        external_locals=locals(),
        debug_mode=True,
        manual_node_list=[('192.168.1.101', 8635)]
    )

📡 How It Works

Zignode creates a peer-to-peer network where every node is equal.

Startup

  • The node starts a local HTTP server and begins scanning the network.

Discovery

  • On port 8635, Zignode discovers others, exchanging available functions and neighbors.

Execution

  • When a call is made:

    1. If the function exists locally → execute.
    2. Else → check neighbors.
    3. If needed → 2-hop route via neighbor’s neighbors.

This builds a self-healing, mesh-style RPC network.


📬 How to Call Functions

You can use any HTTP client (curl, requests, Postman) to call functions on any node.

1. Call a local or auto-routed function:

curl -X POST -H "Content-Type: application/json" \
-d '{"call": "set_servo_position", "args": [90]}' \
http://localhost:8635/

2. Call a function on a specific node (by ID):

curl -X POST -H "Content-Type: application/json" \
-d '{"call": "read_temperature", "id": "a1b2c3d4-..."}' \
http://localhost:8635/

3. Send a message using msg():

curl -X POST -H "Content-Type: application/json" \
-d '{"call": "msg", "args": ["Message from the network!"]}' \
http://localhost:8635/

🗐 Web UI

Each node automatically hosts a web page at http://<ip>:8635/, showing:

  • Node ID
  • Available functions
  • Discovered neighbors
  • Optional logs

(Screenshot coming soon)


🚧 Roadmap

  • Authentication & API tokens
  • Optional encryption (Fernet or TLS)
  • Multicast ZeroConf support
  • WebSocket-based push events
  • Native MicroPython/ESP8266 bridge
  • Arduino/C++ protocol client
  • Node.js-compatible Zignode client

🧑‍💻 Authors & Credits

  • Concept, architecture & integration: Zigfi (GitHub)

  • Early implementations & sync version: written by Zigfi

  • Code support provided by AI assistants:

    • Gemini (Google)
    • ChatGPT (OpenAI)
    • Claude (Anthropic)
    • Mistral, Tulu3 and others
  • Protocol and structure are designed to be human-readable and language-agnostic

Feedback, forks and PRs welcome!


📜 License

This project is licensed under the Apache 2.0 License. See LICENSE for details.

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

zignode-24.1.3.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

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

zignode-24.1.3-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file zignode-24.1.3.tar.gz.

File metadata

  • Download URL: zignode-24.1.3.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for zignode-24.1.3.tar.gz
Algorithm Hash digest
SHA256 822bb2337da430fa92f01fef7f20b1d1404deafd86b2110f2945f2d35d85c2bb
MD5 59b82681a1b8bc4b49ac36f38ecdea07
BLAKE2b-256 925f223c9b6f33ed781395b88a0ba339fd42e6f107d805c2d225acf4272c6834

See more details on using hashes here.

File details

Details for the file zignode-24.1.3-py3-none-any.whl.

File metadata

  • Download URL: zignode-24.1.3-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for zignode-24.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f1bfda11e09a3d24bfb6ed77a6627bbf5518eb4941172869d7e882fe3a2bd368
MD5 a765d7547a4b49b86410151cb7dd7846
BLAKE2b-256 5052fde5e2d497ee67763e44471fc488d5cdbc1e9179ecdc182ea1cc0ef3fb55

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