EDPMT - Electronic Device Protocol Management (Transparent)
Simple • Secure • Universal Hardware Communication
EDPMT is a revolutionary hardware communication library that provides a transparent, zero-configuration solution for controlling GPIO, I2C, SPI, UART, and other hardware interfaces. Built from the ground up with security, simplicity, and transparency in mind.
🌟 Key Features
🚀 Radical Simplicity
- Single Universal Method: One
execute(action, target, params)method for everything - Zero Configuration: Automatic detection of transport, TLS, and hardware
- Minimal Dependencies: Only 2-3 required packages vs 15+ in traditional solutions
- One File Deployment: Complete functionality in a single transparent module
🔐 Security First
- Automatic TLS Encryption: Self-signed certificates generated automatically
- HTTPS/WSS by Default: Secure communication out of the box
- Optional Let's Encrypt: Easy integration with production certificates
- No Hardcoded Secrets: No API keys, UUIDs, or hash authentication needed
🎯 Complete Transparency
- Full Operation Logging: Every action logged with clear timestamps
- Linear Data Flow: Simple
Client → TLS → Server → Hardware → Response - Debug-Friendly: Easy troubleshooting with comprehensive logs
- Layer Separation: Clean architecture with distinct responsibilities
🌐 Universal Access
- Cross-Platform: Linux, Windows, macOS support
- Multi-Language API: Same interface for Python, JavaScript, curl, etc.
- Transport Auto-Selection: IPC (local), TLS (network), WSS (browser)
- Hardware Abstraction: Works with real hardware or simulators
📦 Installation
🚀 Development Setup (Recommended)
For modern Python environments with externally-managed-environment:
# Clone repository
git clone https://github.com/stream-ware/edpmt.git
cd edpmt
# Setup development environment (no pip installation needed)
make dev-setup
# Start using EDPMT immediately
./bin/edpmt server --dev --port 8877
./bin/edpmt info
./bin/edpmt --help
🐍 Virtual Environment Setup
# Create isolated virtual environment
make venv-setup
# Activate and use
source venv/bin/activate
edpmt server --dev --port 8877
📦 Traditional Installation (if supported)
# Install from PyPI (when published)
pip install edpmt
# Or install from source (may fail on managed environments)
git clone https://github.com/stream-ware/edpmt.git
cd edpmt
pip install -e .
🔧 Hardware Support (Raspberry Pi)
# With dev-setup - hardware libraries auto-detected
make dev-setup
./bin/edpmt server --dev # Auto-falls back to simulators
# With pip installation
pip install edpmt[rpi] # Raspberry Pi GPIO support
pip install edpmt[all] # All optional dependencies
Requirements
- Python 3.8+ (3.9+ recommended)
- Linux/Windows/macOS (Linux recommended for hardware access)
- Optional: Docker for containerized deployment
Core Dependencies (installed automatically):
aiohttp- HTTP server and clientaiohttp-cors- Cross-origin resource sharingcryptography- TLS certificate generationwebsockets- WebSocket communication
Hardware Dependencies (optional):
RPi.GPIO- Raspberry Pi GPIO controlsmbus2- I2C communicationspidev- SPI communicationpyserial- UART/Serial communication
🚀 Quick Start
1. Start the Server
# Start with TLS (recommended)
edpmt server --tls --port 8888
# Or start in development mode (auto TLS + debug)
edpmt server --dev
Access Points:
- 🌐 Web Interface: https://localhost:8888
- 🔌 REST API: https://localhost:8888/api/execute
- 📡 WebSocket: wss://localhost:8888/ws
- 💚 Health Check: https://localhost:8888/health
2. Control Hardware
Python Client:
import asyncio
from edpmt import EDPMClient
async def main():
# Auto-detects server URL and TLS settings
client = EDPMClient()
# GPIO Control
await client.execute('set', 'gpio', pin=17, value=1) # LED ON
await client.execute('set', 'gpio', pin=17, value=0) # LED OFF
state = await client.execute('get', 'gpio', pin=18) # Read pin
# I2C Communication
devices = await client.execute('scan', 'i2c')
data = await client.execute('read', 'i2c',
device=0x76, register=0xD0, length=1)
# PWM Control
await client.execute('pwm', 'gpio',
pin=18, frequency=1000, duty_cycle=50)
# Audio Generation
await client.execute('play', 'audio', frequency=440, duration=1.0)
await client.close()
asyncio.run(main())
JavaScript/Browser:
// WebSocket connection (real-time)
const ws = new WebSocket('wss://localhost:8888/ws');
ws.onopen = () => {
// Control GPIO
ws.send(JSON.stringify({
action: 'set',
target: 'gpio',
params: { pin: 17, value: 1 }
}));
};
// HTTP REST API (simple)
fetch('https://localhost:8888/api/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'scan',
target: 'i2c'
})
}).then(r => r.json()).then(console.log);
Command Line:
# Single command execution
edpmt client --execute set gpio '{"pin": 17, "value": 1}'
# Interactive mode
edpmt client --interactive
> set gpio {"pin": 17, "value": 1}
> scan i2c
> play audio {"frequency": 440, "duration": 1.0}
# Using curl
curl -k https://localhost:8888/api/execute \
-H "Content-Type: application/json" \
-d '{"action":"set","target":"gpio","params":{"pin":17,"value":1}}'
🐳 Docker Deployment
Raspberry Pi 3 with Docker Compose
# Clone repository
git clone https://github.com/stream-ware/edpmt.git
cd edpmt/examples/docker
# Start full stack (EDPMT + MQTT + InfluxDB + Grafana)
docker-compose up -d
# Access services:
# - EDPMT Web UI: https://localhost:8888
# - Grafana Dashboard: http://localhost:3000 (admin/admin)
# - MQTT Broker: localhost:1883
Single Container (Minimal)
# Build EDPMT image
docker build -t edpmt .
# Run with hardware access
docker run -d --name edpmt-server \
--device /dev/gpiomem \
--device /dev/i2c-1 \
--device /dev/spidev0.0 \
--device /dev/spidev0.1 \
-p 8888:8888 \
-v edpmt-certs:/app/certs \
-v edpmt-logs:/app/logs \
-e EDPM_TLS=true \
-e EDPM_PORT=8888 \
edpmt
Environment Variables
| Variable | Default | Description |
|---|---|---|
EDPM_PORT |
8888 |
Server port |
EDPM_HOST |
0.0.0.0 |
Bind address |
EDPM_TLS |
true |
Enable TLS encryption |
EDPM_DEV |
false |
Development mode (debug + relaxed TLS) |
EDPM_URL |
Auto | Client connection URL |
EDPM_CERT_PATH |
/app/certs |
Certificate storage path |
EDPM_LOG_LEVEL |
INFO |
Logging verbosity |
🔌 API Reference
Universal Execute Method
await client.execute(action: str, target: str, **params) -> Any
GPIO Operations
# Digital I/O
await client.execute('set', 'gpio', pin=17, value=1) # Set HIGH
await client.execute('set', 'gpio', pin=17, value=0) # Set LOW
state = await client.execute('get', 'gpio', pin=18) # Read pin
# PWM Control
await client.execute('pwm', 'gpio', pin=18, frequency=1000, duty_cycle=50)
await client.execute('pwm', 'gpio', pin=18, frequency=0) # Stop PWM
# Pin Configuration
await client.execute('config', 'gpio', pin=17, mode='out') # Output mode
await client.execute('config', 'gpio', pin=18, mode='in', pull='up') # Input with pullup
I2C Operations
# Device Discovery
devices = await client.execute('scan', 'i2c') # Scan bus for devices
# Data Transfer
data = await client.execute('read', 'i2c', device=0x76, register=0xD0, length=1)
await client.execute('write', 'i2c', device=0x76, register=0xF4, data=[0x27])
# Raw I2C
data = await client.execute('read_raw', 'i2c', device=0x76, length=6)
await client.execute('write_raw', 'i2c', device=0x76, data=[0x1, 0x2, 0x3])
SPI Operations
# SPI Transfer
response = await client.execute('transfer', 'spi', data=[0x01, 0x02, 0x03])
# SPI Configuration
await client.execute('config', 'spi', bus=0, device=0,
speed=1000000, mode=0, bits=8)
UART/Serial Operations
# Send Data
await client.execute('write', 'uart', data="Hello World\n")
# Read Data
data = await client.execute('read', 'uart', timeout=1.0)
# Configuration
await client.execute('config', 'uart', port='/dev/ttyUSB0',
baudrate=9600, timeout=1.0)
📚 Complete Examples
See the
examples/ directory for complete project implementations:
- LED Controller: Multi-pattern RGB LED controller
- Docker Setup: Complete containerized deployment
- PC Simulation: Cross-platform hardware simulation
🛠️ CLI Usage
⚠️ Important: Use local wrapper script ./bin/edpmt for development setup
# Server management (development setup)
./bin/edpmt server --dev # Start in development mode
./bin/edpmt server --dev --port 8877 # Custom port
./bin/edpmt info # Show system information
./bin/edpmt --help # Show all commands
# Client operations
./bin/edpmt client --url https://localhost:8877 # Connect to server
./bin/edpmt client --interactive # Interactive mode
# Alternative with system installation
edpmt server --dev # Only if installed via pip/venv
edpmt info # System-wide command
🔧 Troubleshooting
Common Installation Issues
Problem: bash: edpmt: command not found
# ❌ Don't use: edpmt server --dev
# ✅ Use instead: ./bin/edpmt server --dev
Problem: externally-managed-environment error
# Solution 1: Use development setup (recommended)
make dev-setup
./bin/edpmt server --dev
# Solution 2: Use virtual environment
make venv-setup
source venv/bin/activate
edpmt server --dev
Problem: 'NoneType' object has no attribute 'setup' errors
# Fixed in latest version - hardware interfaces now properly fall back to simulators
./bin/edpmt server --dev # Should run without hardware errors
Problem: [Errno 98] address already in use
# Use different port
./bin/edpmt server --dev --port 8877
./bin/edpmt server --dev --port 9999
Development Workflow
# 1. Clone and setup
git clone https://github.com/stream-ware/edpmt.git
cd edpmt
# 2. Development setup (no installation needed)
make dev-setup
# 3. Start server
./bin/edpmt server --dev --port 8877
# 4. Access web interface
# Open: https://localhost:8877
# 5. Run tests
make test
🔧 Development
Setup Development Environment
# Clone repository
git clone https://github.com/stream-ware/edpmt.git
cd edpmt
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/macOS
# or: venv\Scripts\activate # Windows
# Install in development mode
pip install -e .[dev]
# Start development server
edpmt server --dev
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🙋 Support
- Issues: GitHub Issues
- Documentation: Architecture Document
- Examples: Complete Examples
Made with ❤️ for simple, secure, and transparent hardware communication
EDPM Transparent (EDPMT)
EDPM Transparent (EDPMT) is a simple, secure, and universal server framework designed for hardware interaction and control. It provides a hardware-agnostic architecture with pluggable interfaces, allowing seamless switching between real hardware and simulators.
Key Features
- Single Universal API: Use
execute(action, target, params)for all hardware interactions. - Automatic TLS: Secure communication with self-signed certificates.
- Multi-Transport Support: Supports Local IPC, Network TLS, and Browser WSS.
- Hardware Abstraction: Automatically falls back to simulators if real hardware is unavailable.
- Zero Configuration: Auto-detection of hardware and environment settings.
- Comprehensive Web Interface: Real-time control and monitoring.
- Docker Support: Easy deployment with hardware access.
- Full Logging and Transparency: Detailed logs for debugging and monitoring.
Installation
To install EDPMT, follow these steps:
# Clone the repository
git clone https://github.com/stream-ware/edpmt.git
cd edpmt
# Set up for development
make dev-setup
For detailed installation instructions and troubleshooting, refer to the Installation Guide section below.
Usage
Starting the Server
# Start the server in development mode with simulators
make server-dev-sim
# Or use the CLI directly
./bin/edpmt server --dev --hardware-simulators
Accessing the Server
Once the server is running, you can access:
- Web Interface:
https://<host>:<port>(default:https://0.0.0.0:8888) - REST API:
https://<host>:<port>/api/execute - WebSocket:
wss://<host>:<port>/ws - Health Check:
https://<host>:<port>/health
Hardware-Agnostic Framework
EDPMT now features a hardware-agnostic framework with pluggable hardware interfaces. This allows dynamic setup of hardware during initialization, with fallback to simulators if real hardware is unavailable. Currently supported interfaces include:
- GPIO: Real (Raspberry Pi) and Simulated implementations.
- I2C: Real (SMBus) and Simulated implementations.
- SPI, UART, USB, I2S: Dummy implementations (to be expanded with real and simulated versions).
To run the server with simulated hardware:
make server-dev-sim
Examples
EDPMT comes with several examples to demonstrate its capabilities. You can find them in the examples directory:
- Complete Projects: Full-fledged projects showcasing comprehensive use of EDPMT.
- Docker Setup: Docker configuration for running EDPMT on Raspberry Pi 3 with hardware access.
- GPIO Frontend: A web frontend for GPIO control using EDPMT.
- PC Simulation: Examples for simulating hardware interactions on a PC.
- Raspberry Pi 3 GPIO LED Controller: A specific example for controlling LEDs on Raspberry Pi 3 using GPIO.
Installation Guide
Prerequisites
- Python 3.6 or higher
- Access to hardware (Raspberry Pi for real hardware interaction) or use simulators
Steps
- Clone the Repository:
git clone https://github.com/stream-ware/edpmt.git cd edpmt
- Development Setup:
make dev-setup - Running the Server:
- For development with simulators:
make server-dev-sim - For development with real hardware:
make server-dev
- For development with simulators:
Troubleshooting
- Server Fails to Start: Ensure no other process is using the default port (8888). Use the
--portoption to specify a different port. - Hardware Not Detected: Verify hardware connections and permissions. Use
--hardware-simulatorsflag to test with simulated hardware. - TLS Errors: If you encounter certificate issues, use
--no-tlsto disable TLS temporarily for debugging.
Contributing
Contributions to EDPMT are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with descriptive messages.
- Push your changes to your fork.
- Create a pull request with a detailed description of your changes.
License
EDPMT is licensed under the Apache 2.0 License. See LICENSE for more information.
Metadata
Release files for edpmt 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| edpmt-1.0.7.tar.gz | 63.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| edpmt-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 118.9 kB
Release files / edpmt-1.0.7.tar.gz
| Download URL | edpmt-1.0.7.tar.gz |
|---|---|
| Size | 63.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cdebefa17687679f19b0402b7b266bcecc59a94ff8037fd0c7c961d8b5747b6
|
|
BLAKE2b-256 checksum How to use checksums |
21ece0ddb5647cea84eaadc24455bbbcdf19b4f36f50351230a797826ef55061
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Release files / edpmt-1.0.7-py3-none-any.whl
| Download URL | edpmt-1.0.7-py3-none-any.whl |
|---|---|
| Size | 55.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27f01a4107b3fb650f433af1cd39ab72a4733886f0ca0822dcb5e79ef60854ca
|
|
BLAKE2b-256 checksum How to use checksums |
73ed0b88b69ff61b28160104ecf7618e66169328fe055d97bf4ab25f5145ebdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|