edpmt


Nameedpmt JSON
Version 1.0.6 PyPI version JSON
download
home_pagehttps://github.com/stream-ware/edpmt
SummaryEDPM Transparent - Simple, Secure, Universal Hardware Communication
upload_time2025-09-15 17:31:16
maintainerNone
docs_urlNone
authorTom Sapletta
requires_python>=3.8
licenseNone
keywords hardware gpio i2c spi uart raspberry-pi iot embedded automation transparent secure
VCS
bugtrack_url
requirements aiohttp aiohttp-cors cryptography websockets flask flask-socketio portkeeper
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # EDPMT - Electronic Device Protocol Management (Transparent)

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/downloads/)
[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20windows%20%7C%20macOS-lightgrey)](https://github.com/stream-ware/edpmt)
[![Docker](https://img.shields.io/badge/docker-supported-blue)](https://hub.docker.com/)

**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:**

```bash
# 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**

```bash
# Create isolated virtual environment
make venv-setup

# Activate and use
source venv/bin/activate
edpmt server --dev --port 8877
```

### **📦 Traditional Installation (if supported)**

```bash
# 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)**

```bash
# 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 client
- `aiohttp-cors` - Cross-origin resource sharing
- `cryptography` - TLS certificate generation
- `websockets` - WebSocket communication

**Hardware Dependencies** (optional):
- `RPi.GPIO` - Raspberry Pi GPIO control
- `smbus2` - I2C communication
- `spidev` - SPI communication  
- `pyserial` - UART/Serial communication

## 🚀 Quick Start

### **1. Start the Server**

```bash
# 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:**
```python
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:**
```javascript
// 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:**
```bash
# 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**

```bash
# 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)**

```bash
# 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**

```python
await client.execute(action: str, target: str, **params) -> Any
```

### **GPIO Operations**

```python
# 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**

```python
# 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**

```python
# 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**

```python
# 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
![img.png](img.png)
See the [`examples/`](examples/) directory for complete project implementations:

- **[LED Controller](examples/rpi3-gpio/led-controller/)**: Multi-pattern RGB LED controller
- **[Docker Setup](examples/docker/)**: Complete containerized deployment
- **[PC Simulation](examples/pc-simulation/)**: Cross-platform hardware simulation

## 🛠️ CLI Usage

**⚠️ Important: Use local wrapper script `./bin/edpmt` for development setup**

```bash
# 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`**
```bash
# ❌ Don't use: edpmt server --dev
# ✅ Use instead: ./bin/edpmt server --dev
```

**Problem: `externally-managed-environment` error**
```bash
# 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**
```bash
# 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`**
```bash
# Use different port
./bin/edpmt server --dev --port 8877
./bin/edpmt server --dev --port 9999
```

### **Development Workflow**

```bash
# 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**

```bash
# 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](LICENSE) file for details.

## 🙋 Support

- **Issues**: [GitHub Issues](https://github.com/stream-ware/edpmt/issues)
- **Documentation**: [Architecture Document](edpm-transparent-architecture.md)
- **Examples**: [Complete Examples](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:

```bash
# 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](#installation-guide) section below.

## Usage

### Starting the Server

```bash
# 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:
```bash
make server-dev-sim
```

## Examples

EDPMT comes with several examples to demonstrate its capabilities. You can find them in the `examples` directory:

- **[Complete Projects](examples/complete-projects/)**: Full-fledged projects showcasing comprehensive use of EDPMT.
- **[Docker Setup](examples/docker/)**: Docker configuration for running EDPMT on Raspberry Pi 3 with hardware access.
  - [Dockerfile](examples/docker/Dockerfile)
  - [docker-compose.yml](examples/docker/docker-compose.yml)
  - [docker-entrypoint.sh](examples/docker/docker-entrypoint.sh)
  - [README.md](examples/docker/README.md)
- **[GPIO Frontend](examples/gpio-frontend/)**: A web frontend for GPIO control using EDPMT.
  - [app.py](examples/gpio-frontend/app.py)
  - [README.md](examples/gpio-frontend/README.md)
  - [templates/](examples/gpio-frontend/templates/)
- **[PC Simulation](examples/pc-simulation/)**: Examples for simulating hardware interactions on a PC.
  - [gpio_led_matrix.py](examples/pc-simulation/gpio_led_matrix.py)
  - [i2c_sensor_simulation.py](examples/pc-simulation/i2c_sensor_simulation.py)
  - [README.md](examples/pc-simulation/README.md)
  - [spi_device_simulation.py](examples/pc-simulation/spi_device_simulation.py)
  - [uart_communication.py](examples/pc-simulation/uart_communication.py)
- **[Raspberry Pi 3 GPIO LED Controller](examples/rpi3-gpio/led-controller/)**: A specific example for controlling LEDs on Raspberry Pi 3 using GPIO.
  - [app.py](examples/rpi3-gpio/led-controller/app.py)

## Installation Guide

### Prerequisites

- Python 3.6 or higher
- Access to hardware (Raspberry Pi for real hardware interaction) or use simulators

### Steps

1. **Clone the Repository**:
   ```bash
   git clone https://github.com/stream-ware/edpmt.git
   cd edpmt
   ```
2. **Development Setup**:
   ```bash
   make dev-setup
   ```
3. **Running the Server**:
   - For development with simulators:
     ```bash
     make server-dev-sim
     ```
   - For development with real hardware:
     ```bash
     make server-dev
     ```

### Troubleshooting

- **Server Fails to Start**: Ensure no other process is using the default port (8888). Use the `--port` option to specify a different port.
- **Hardware Not Detected**: Verify hardware connections and permissions. Use `--hardware-simulators` flag to test with simulated hardware.
- **TLS Errors**: If you encounter certificate issues, use `--no-tls` to disable TLS temporarily for debugging.

## Contributing

Contributions to EDPMT are welcome! Please follow these steps:
1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Make your changes and commit them with descriptive messages.
4. Push your changes to your fork.
5. Create a pull request with a detailed description of your changes.

## License

EDPMT is licensed under the Apache 2.0 License. See [LICENSE](LICENSE) for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/stream-ware/edpmt",
    "name": "edpmt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "hardware gpio i2c spi uart raspberry-pi iot embedded automation transparent secure",
    "author": "Tom Sapletta",
    "author_email": "info@softreck.dev",
    "download_url": "https://files.pythonhosted.org/packages/9f/d6/d63a78f20a90accff7163f2e60753c0130ba410b2b95a318ca74a84f8987/edpmt-1.0.6.tar.gz",
    "platform": null,
    "description": "# EDPMT - Electronic Device Protocol Management (Transparent)\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/downloads/)\n[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20windows%20%7C%20macOS-lightgrey)](https://github.com/stream-ware/edpmt)\n[![Docker](https://img.shields.io/badge/docker-supported-blue)](https://hub.docker.com/)\n\n**Simple \u2022 Secure \u2022 Universal Hardware Communication**\n\nEDPMT 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.\n\n## \ud83c\udf1f Key Features\n\n### **\ud83d\ude80 Radical Simplicity**\n- **Single Universal Method**: One `execute(action, target, params)` method for everything\n- **Zero Configuration**: Automatic detection of transport, TLS, and hardware\n- **Minimal Dependencies**: Only 2-3 required packages vs 15+ in traditional solutions\n- **One File Deployment**: Complete functionality in a single transparent module\n\n### **\ud83d\udd10 Security First**\n- **Automatic TLS Encryption**: Self-signed certificates generated automatically  \n- **HTTPS/WSS by Default**: Secure communication out of the box\n- **Optional Let's Encrypt**: Easy integration with production certificates\n- **No Hardcoded Secrets**: No API keys, UUIDs, or hash authentication needed\n\n### **\ud83c\udfaf Complete Transparency**\n- **Full Operation Logging**: Every action logged with clear timestamps\n- **Linear Data Flow**: Simple `Client \u2192 TLS \u2192 Server \u2192 Hardware \u2192 Response`\n- **Debug-Friendly**: Easy troubleshooting with comprehensive logs\n- **Layer Separation**: Clean architecture with distinct responsibilities\n\n### **\ud83c\udf10 Universal Access**\n- **Cross-Platform**: Linux, Windows, macOS support\n- **Multi-Language API**: Same interface for Python, JavaScript, curl, etc.\n- **Transport Auto-Selection**: IPC (local), TLS (network), WSS (browser)\n- **Hardware Abstraction**: Works with real hardware or simulators\n\n## \ud83d\udce6 Installation\n\n### **\ud83d\ude80 Development Setup (Recommended)**\n\n**For modern Python environments with externally-managed-environment:**\n\n```bash\n# Clone repository\ngit clone https://github.com/stream-ware/edpmt.git\ncd edpmt\n\n# Setup development environment (no pip installation needed)\nmake dev-setup\n\n# Start using EDPMT immediately\n./bin/edpmt server --dev --port 8877\n./bin/edpmt info\n./bin/edpmt --help\n```\n\n### **\ud83d\udc0d Virtual Environment Setup**\n\n```bash\n# Create isolated virtual environment\nmake venv-setup\n\n# Activate and use\nsource venv/bin/activate\nedpmt server --dev --port 8877\n```\n\n### **\ud83d\udce6 Traditional Installation (if supported)**\n\n```bash\n# Install from PyPI (when published)\npip install edpmt\n\n# Or install from source (may fail on managed environments)\ngit clone https://github.com/stream-ware/edpmt.git\ncd edpmt\npip install -e .\n```\n\n### **\ud83d\udd27 Hardware Support (Raspberry Pi)**\n\n```bash\n# With dev-setup - hardware libraries auto-detected\nmake dev-setup\n./bin/edpmt server --dev  # Auto-falls back to simulators\n\n# With pip installation\npip install edpmt[rpi]     # Raspberry Pi GPIO support\npip install edpmt[all]     # All optional dependencies\n```\n\n### **Requirements**\n\n- **Python 3.8+** (3.9+ recommended)\n- **Linux/Windows/macOS** (Linux recommended for hardware access)\n- **Optional**: Docker for containerized deployment\n\n**Core Dependencies** (installed automatically):\n- `aiohttp` - HTTP server and client\n- `aiohttp-cors` - Cross-origin resource sharing\n- `cryptography` - TLS certificate generation\n- `websockets` - WebSocket communication\n\n**Hardware Dependencies** (optional):\n- `RPi.GPIO` - Raspberry Pi GPIO control\n- `smbus2` - I2C communication\n- `spidev` - SPI communication  \n- `pyserial` - UART/Serial communication\n\n## \ud83d\ude80 Quick Start\n\n### **1. Start the Server**\n\n```bash\n# Start with TLS (recommended)\nedpmt server --tls --port 8888\n\n# Or start in development mode (auto TLS + debug)\nedpmt server --dev\n```\n\n**Access Points:**\n- \ud83c\udf10 **Web Interface**: https://localhost:8888\n- \ud83d\udd0c **REST API**: https://localhost:8888/api/execute\n- \ud83d\udce1 **WebSocket**: wss://localhost:8888/ws\n- \ud83d\udc9a **Health Check**: https://localhost:8888/health\n\n### **2. Control Hardware**\n\n**Python Client:**\n```python\nimport asyncio\nfrom edpmt import EDPMClient\n\nasync def main():\n    # Auto-detects server URL and TLS settings\n    client = EDPMClient()\n    \n    # GPIO Control\n    await client.execute('set', 'gpio', pin=17, value=1)  # LED ON\n    await client.execute('set', 'gpio', pin=17, value=0)  # LED OFF\n    state = await client.execute('get', 'gpio', pin=18)   # Read pin\n    \n    # I2C Communication\n    devices = await client.execute('scan', 'i2c')\n    data = await client.execute('read', 'i2c', \n                               device=0x76, register=0xD0, length=1)\n    \n    # PWM Control\n    await client.execute('pwm', 'gpio', \n                        pin=18, frequency=1000, duty_cycle=50)\n    \n    # Audio Generation\n    await client.execute('play', 'audio', frequency=440, duration=1.0)\n    \n    await client.close()\n\nasyncio.run(main())\n```\n\n**JavaScript/Browser:**\n```javascript\n// WebSocket connection (real-time)\nconst ws = new WebSocket('wss://localhost:8888/ws');\nws.onopen = () => {\n    // Control GPIO\n    ws.send(JSON.stringify({\n        action: 'set',\n        target: 'gpio',\n        params: { pin: 17, value: 1 }\n    }));\n};\n\n// HTTP REST API (simple)\nfetch('https://localhost:8888/api/execute', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({\n        action: 'scan',\n        target: 'i2c'\n    })\n}).then(r => r.json()).then(console.log);\n```\n\n**Command Line:**\n```bash\n# Single command execution\nedpmt client --execute set gpio '{\"pin\": 17, \"value\": 1}'\n\n# Interactive mode\nedpmt client --interactive\n> set gpio {\"pin\": 17, \"value\": 1}\n> scan i2c\n> play audio {\"frequency\": 440, \"duration\": 1.0}\n\n# Using curl\ncurl -k https://localhost:8888/api/execute \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"action\":\"set\",\"target\":\"gpio\",\"params\":{\"pin\":17,\"value\":1}}'\n```\n\n## \ud83d\udc33 Docker Deployment\n\n### **Raspberry Pi 3 with Docker Compose**\n\n```bash\n# Clone repository\ngit clone https://github.com/stream-ware/edpmt.git\ncd edpmt/examples/docker\n\n# Start full stack (EDPMT + MQTT + InfluxDB + Grafana)\ndocker-compose up -d\n\n# Access services:\n# - EDPMT Web UI: https://localhost:8888\n# - Grafana Dashboard: http://localhost:3000 (admin/admin)\n# - MQTT Broker: localhost:1883\n```\n\n### **Single Container (Minimal)**\n\n```bash\n# Build EDPMT image\ndocker build -t edpmt .\n\n# Run with hardware access\ndocker run -d --name edpmt-server \\\n  --device /dev/gpiomem \\\n  --device /dev/i2c-1 \\\n  --device /dev/spidev0.0 \\\n  --device /dev/spidev0.1 \\\n  -p 8888:8888 \\\n  -v edpmt-certs:/app/certs \\\n  -v edpmt-logs:/app/logs \\\n  -e EDPM_TLS=true \\\n  -e EDPM_PORT=8888 \\\n  edpmt\n```\n\n### **Environment Variables**\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `EDPM_PORT` | `8888` | Server port |\n| `EDPM_HOST` | `0.0.0.0` | Bind address |\n| `EDPM_TLS` | `true` | Enable TLS encryption |\n| `EDPM_DEV` | `false` | Development mode (debug + relaxed TLS) |\n| `EDPM_URL` | Auto | Client connection URL |\n| `EDPM_CERT_PATH` | `/app/certs` | Certificate storage path |\n| `EDPM_LOG_LEVEL` | `INFO` | Logging verbosity |\n\n## \ud83d\udd0c API Reference\n\n### **Universal Execute Method**\n\n```python\nawait client.execute(action: str, target: str, **params) -> Any\n```\n\n### **GPIO Operations**\n\n```python\n# Digital I/O\nawait client.execute('set', 'gpio', pin=17, value=1)        # Set HIGH\nawait client.execute('set', 'gpio', pin=17, value=0)        # Set LOW\nstate = await client.execute('get', 'gpio', pin=18)         # Read pin\n\n# PWM Control\nawait client.execute('pwm', 'gpio', pin=18, frequency=1000, duty_cycle=50)\nawait client.execute('pwm', 'gpio', pin=18, frequency=0)    # Stop PWM\n\n# Pin Configuration\nawait client.execute('config', 'gpio', pin=17, mode='out') # Output mode\nawait client.execute('config', 'gpio', pin=18, mode='in', pull='up') # Input with pullup\n```\n\n### **I2C Operations**\n\n```python\n# Device Discovery\ndevices = await client.execute('scan', 'i2c')              # Scan bus for devices\n\n# Data Transfer\ndata = await client.execute('read', 'i2c', device=0x76, register=0xD0, length=1)\nawait client.execute('write', 'i2c', device=0x76, register=0xF4, data=[0x27])\n\n# Raw I2C\ndata = await client.execute('read_raw', 'i2c', device=0x76, length=6)\nawait client.execute('write_raw', 'i2c', device=0x76, data=[0x1, 0x2, 0x3])\n```\n\n### **SPI Operations**\n\n```python\n# SPI Transfer\nresponse = await client.execute('transfer', 'spi', data=[0x01, 0x02, 0x03])\n\n# SPI Configuration\nawait client.execute('config', 'spi', bus=0, device=0, \n                     speed=1000000, mode=0, bits=8)\n```\n\n### **UART/Serial Operations**\n\n```python\n# Send Data\nawait client.execute('write', 'uart', data=\"Hello World\\n\")\n\n# Read Data  \ndata = await client.execute('read', 'uart', timeout=1.0)\n\n# Configuration\nawait client.execute('config', 'uart', port='/dev/ttyUSB0', \n                     baudrate=9600, timeout=1.0)\n```\n\n## \ud83d\udcda Complete Examples\n![img.png](img.png)\nSee the [`examples/`](examples/) directory for complete project implementations:\n\n- **[LED Controller](examples/rpi3-gpio/led-controller/)**: Multi-pattern RGB LED controller\n- **[Docker Setup](examples/docker/)**: Complete containerized deployment\n- **[PC Simulation](examples/pc-simulation/)**: Cross-platform hardware simulation\n\n## \ud83d\udee0\ufe0f CLI Usage\n\n**\u26a0\ufe0f Important: Use local wrapper script `./bin/edpmt` for development setup**\n\n```bash\n# Server management (development setup)\n./bin/edpmt server --dev                    # Start in development mode\n./bin/edpmt server --dev --port 8877        # Custom port\n./bin/edpmt info                            # Show system information\n./bin/edpmt --help                          # Show all commands\n\n# Client operations\n./bin/edpmt client --url https://localhost:8877  # Connect to server\n./bin/edpmt client --interactive                 # Interactive mode\n\n# Alternative with system installation\nedpmt server --dev                    # Only if installed via pip/venv\nedpmt info                            # System-wide command\n```\n\n## \ud83d\udd27 Troubleshooting\n\n### **Common Installation Issues**\n\n**Problem: `bash: edpmt: command not found`**\n```bash\n# \u274c Don't use: edpmt server --dev\n# \u2705 Use instead: ./bin/edpmt server --dev\n```\n\n**Problem: `externally-managed-environment` error**\n```bash\n# Solution 1: Use development setup (recommended)\nmake dev-setup\n./bin/edpmt server --dev\n\n# Solution 2: Use virtual environment\nmake venv-setup\nsource venv/bin/activate\nedpmt server --dev\n```\n\n**Problem: `'NoneType' object has no attribute 'setup'` errors**\n```bash\n# Fixed in latest version - hardware interfaces now properly fall back to simulators\n./bin/edpmt server --dev  # Should run without hardware errors\n```\n\n**Problem: `[Errno 98] address already in use`**\n```bash\n# Use different port\n./bin/edpmt server --dev --port 8877\n./bin/edpmt server --dev --port 9999\n```\n\n### **Development Workflow**\n\n```bash\n# 1. Clone and setup\ngit clone https://github.com/stream-ware/edpmt.git\ncd edpmt\n\n# 2. Development setup (no installation needed)\nmake dev-setup\n\n# 3. Start server\n./bin/edpmt server --dev --port 8877\n\n# 4. Access web interface\n# Open: https://localhost:8877\n\n# 5. Run tests\nmake test\n```\n\n## \ud83d\udd27 Development\n\n### **Setup Development Environment**\n\n```bash\n# Clone repository\ngit clone https://github.com/stream-ware/edpmt.git\ncd edpmt\n\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate  # Linux/macOS\n# or: venv\\Scripts\\activate  # Windows\n\n# Install in development mode\npip install -e .[dev]\n\n# Start development server\nedpmt server --dev\n```\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the **Apache License 2.0** - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4b Support\n\n- **Issues**: [GitHub Issues](https://github.com/stream-ware/edpmt/issues)\n- **Documentation**: [Architecture Document](edpm-transparent-architecture.md)\n- **Examples**: [Complete Examples](examples/)\n\n---\n\n**Made with \u2764\ufe0f for simple, secure, and transparent hardware communication**\n\n# EDPM Transparent (EDPMT)\n\nEDPM 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.\n\n## Key Features\n\n- **Single Universal API**: Use `execute(action, target, params)` for all hardware interactions.\n- **Automatic TLS**: Secure communication with self-signed certificates.\n- **Multi-Transport Support**: Supports Local IPC, Network TLS, and Browser WSS.\n- **Hardware Abstraction**: Automatically falls back to simulators if real hardware is unavailable.\n- **Zero Configuration**: Auto-detection of hardware and environment settings.\n- **Comprehensive Web Interface**: Real-time control and monitoring.\n- **Docker Support**: Easy deployment with hardware access.\n- **Full Logging and Transparency**: Detailed logs for debugging and monitoring.\n\n## Installation\n\nTo install EDPMT, follow these steps:\n\n```bash\n# Clone the repository\ngit clone https://github.com/stream-ware/edpmt.git\ncd edpmt\n\n# Set up for development\nmake dev-setup\n```\n\nFor detailed installation instructions and troubleshooting, refer to the [Installation Guide](#installation-guide) section below.\n\n## Usage\n\n### Starting the Server\n\n```bash\n# Start the server in development mode with simulators\nmake server-dev-sim\n\n# Or use the CLI directly\n./bin/edpmt server --dev --hardware-simulators\n```\n\n### Accessing the Server\n\nOnce the server is running, you can access:\n- **Web Interface**: `https://<host>:<port>` (default: `https://0.0.0.0:8888`)\n- **REST API**: `https://<host>:<port>/api/execute`\n- **WebSocket**: `wss://<host>:<port>/ws`\n- **Health Check**: `https://<host>:<port>/health`\n\n## Hardware-Agnostic Framework\n\nEDPMT 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:\n- **GPIO**: Real (Raspberry Pi) and Simulated implementations.\n- **I2C**: Real (SMBus) and Simulated implementations.\n- **SPI, UART, USB, I2S**: Dummy implementations (to be expanded with real and simulated versions).\n\nTo run the server with simulated hardware:\n```bash\nmake server-dev-sim\n```\n\n## Examples\n\nEDPMT comes with several examples to demonstrate its capabilities. You can find them in the `examples` directory:\n\n- **[Complete Projects](examples/complete-projects/)**: Full-fledged projects showcasing comprehensive use of EDPMT.\n- **[Docker Setup](examples/docker/)**: Docker configuration for running EDPMT on Raspberry Pi 3 with hardware access.\n  - [Dockerfile](examples/docker/Dockerfile)\n  - [docker-compose.yml](examples/docker/docker-compose.yml)\n  - [docker-entrypoint.sh](examples/docker/docker-entrypoint.sh)\n  - [README.md](examples/docker/README.md)\n- **[GPIO Frontend](examples/gpio-frontend/)**: A web frontend for GPIO control using EDPMT.\n  - [app.py](examples/gpio-frontend/app.py)\n  - [README.md](examples/gpio-frontend/README.md)\n  - [templates/](examples/gpio-frontend/templates/)\n- **[PC Simulation](examples/pc-simulation/)**: Examples for simulating hardware interactions on a PC.\n  - [gpio_led_matrix.py](examples/pc-simulation/gpio_led_matrix.py)\n  - [i2c_sensor_simulation.py](examples/pc-simulation/i2c_sensor_simulation.py)\n  - [README.md](examples/pc-simulation/README.md)\n  - [spi_device_simulation.py](examples/pc-simulation/spi_device_simulation.py)\n  - [uart_communication.py](examples/pc-simulation/uart_communication.py)\n- **[Raspberry Pi 3 GPIO LED Controller](examples/rpi3-gpio/led-controller/)**: A specific example for controlling LEDs on Raspberry Pi 3 using GPIO.\n  - [app.py](examples/rpi3-gpio/led-controller/app.py)\n\n## Installation Guide\n\n### Prerequisites\n\n- Python 3.6 or higher\n- Access to hardware (Raspberry Pi for real hardware interaction) or use simulators\n\n### Steps\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/stream-ware/edpmt.git\n   cd edpmt\n   ```\n2. **Development Setup**:\n   ```bash\n   make dev-setup\n   ```\n3. **Running the Server**:\n   - For development with simulators:\n     ```bash\n     make server-dev-sim\n     ```\n   - For development with real hardware:\n     ```bash\n     make server-dev\n     ```\n\n### Troubleshooting\n\n- **Server Fails to Start**: Ensure no other process is using the default port (8888). Use the `--port` option to specify a different port.\n- **Hardware Not Detected**: Verify hardware connections and permissions. Use `--hardware-simulators` flag to test with simulated hardware.\n- **TLS Errors**: If you encounter certificate issues, use `--no-tls` to disable TLS temporarily for debugging.\n\n## Contributing\n\nContributions to EDPMT are welcome! Please follow these steps:\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Make your changes and commit them with descriptive messages.\n4. Push your changes to your fork.\n5. Create a pull request with a detailed description of your changes.\n\n## License\n\nEDPMT is licensed under the Apache 2.0 License. See [LICENSE](LICENSE) for more information.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "EDPM Transparent - Simple, Secure, Universal Hardware Communication",
    "version": "1.0.6",
    "project_urls": {
        "Bug Reports": "https://github.com/stream-ware/edpmt/issues",
        "Documentation": "https://github.com/stream-ware/edpmt/blob/main/README.md",
        "Homepage": "https://github.com/stream-ware/edpmt",
        "Source": "https://github.com/stream-ware/edpmt"
    },
    "split_keywords": [
        "hardware",
        "gpio",
        "i2c",
        "spi",
        "uart",
        "raspberry-pi",
        "iot",
        "embedded",
        "automation",
        "transparent",
        "secure"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6ee45741808c04776aa573ccbae4b5e94364abb5482e0c5862e4970701848b20",
                "md5": "f0f415ca3f4448c0ac8901aefe98a9fb",
                "sha256": "3c88e3c08cf138ba6f8c33d913d43cebe8aa64f8f95c1242765dd7170bf7231f"
            },
            "downloads": -1,
            "filename": "edpmt-1.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f0f415ca3f4448c0ac8901aefe98a9fb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 55631,
            "upload_time": "2025-09-15T17:31:14",
            "upload_time_iso_8601": "2025-09-15T17:31:14.956874Z",
            "url": "https://files.pythonhosted.org/packages/6e/e4/5741808c04776aa573ccbae4b5e94364abb5482e0c5862e4970701848b20/edpmt-1.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9fd6d63a78f20a90accff7163f2e60753c0130ba410b2b95a318ca74a84f8987",
                "md5": "515be6cdb473e34ebd09154216ff5ca6",
                "sha256": "19726e7d45f0bf0c17fb03b1dd9d831d3a80c18c10cdd45a3c9c54ef98561d97"
            },
            "downloads": -1,
            "filename": "edpmt-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "515be6cdb473e34ebd09154216ff5ca6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 62927,
            "upload_time": "2025-09-15T17:31:16",
            "upload_time_iso_8601": "2025-09-15T17:31:16.325667Z",
            "url": "https://files.pythonhosted.org/packages/9f/d6/d63a78f20a90accff7163f2e60753c0130ba410b2b95a318ca74a84f8987/edpmt-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-15 17:31:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stream-ware",
    "github_project": "edpmt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": [
                [
                    ">=",
                    "3.8.0"
                ]
            ]
        },
        {
            "name": "aiohttp-cors",
            "specs": [
                [
                    ">=",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "cryptography",
            "specs": [
                [
                    ">=",
                    "3.4.8"
                ]
            ]
        },
        {
            "name": "websockets",
            "specs": [
                [
                    ">=",
                    "10.0"
                ]
            ]
        },
        {
            "name": "flask",
            "specs": [
                [
                    ">=",
                    "2.3.0"
                ]
            ]
        },
        {
            "name": "flask-socketio",
            "specs": [
                [
                    ">=",
                    "5.3.0"
                ]
            ]
        },
        {
            "name": "portkeeper",
            "specs": [
                [
                    ">=",
                    "0.1.0"
                ]
            ]
        }
    ],
    "lcname": "edpmt"
}
        
Elapsed time: 1.44012s