Metadata-Version: 2.4
Name: piRTC
Version: 1.0.5
Summary: Raspberry Pi RTC & WatchDog Management Package
Author: piRTC Team
Author-email: Tom Sapletta <tom@sapletta.com>
License-Expression: Apache-2.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.68.0
Requires-Dist: uvicorn>=0.15.0
Requires-Dist: websockets>=10.0
Requires-Dist: jinja2>=3.0.0
Requires-Dist: smbus2>=0.4.0
Requires-Dist: RPi.GPIO>=0.7.0
Requires-Dist: pydantic>=1.8.0
Requires-Dist: python-dotenv>=0.19.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.9; extra == "dev"
Dynamic: requires-python

# rpi-rtc - Raspberry Pi RTC & WatchDog Management

Complete solution for managing **DS3231 RTC** and hardware **WatchDog** on Raspberry Pi.

## Features

- **Web Panel** - Modern HTML/JS interface (FastAPI + WebSocket)
- **REST API** - Full REST API with real-time WebSocket updates
- **CLI Commands** - Direct commands for scripts and automation
- **CLI Shell** - Interactive command-line interface
- **Python Package** - Programmatic API (`piRTC` package)
- **Docker Support** - Containerized deployment

## Quick Links

| Document | Description |
|----------|-------------|
| [README_RTC.md](README_RTC.md) | RTC & WatchDog setup, CLI usage, testing |
| [README_piRTC.md](README_piRTC.md) | Python package (`piRTC`) documentation |

## Quick Start

### Method 1: Automated Installer (Recommended)
```bash
cd /home/tom/github/maskservice/rpi-rtc
./install.sh
```

### Method 2: Using Makefile
```bash
cd /home/tom/github/maskservice/rpi-rtc
make quick-start    # Installs deps, creates venv, installs package
make shell          # Run interactive shell
make server         # Start API server
```

### Method 3: Manual Installation
```bash
make deps           # Install system dependencies
make bootstrap      # Create venv and install deps
make install        # Install the package
```

### 4. Use CLI Shell
```bash
ssh pi@192.168.188.229 'cd /opt/rpi-rtc && python3 rtc_shell.py'
```

### 5. Start Web Server
```bash
# Access: http://192.168.188.229:8080
ssh pi@192.168.188.229 'cd /opt/rpi-rtc && python3 -m piRTC.api'
```

### 4. Python API
```python
from piRTC import RTCManager
rtc = RTCManager()
print(rtc.read_time())  # {'hour': 16, 'minute': 42, 'second': 0}
```

## Hardware Wiring

### DS3231 RTC
```
VDD -> 3.3V (Pin 1)   SCL -> SCL (Pin 5)
GND -> GND  (Pin 6)   SDA -> SDA (Pin 3)
```

### WatchDog
```
VDD  -> 3.3V   (Pin 1)    SCL  -> SCL     (Pin 5)
GND  -> GND    (Pin 6)    SDA  -> SDA     (Pin 3)
FEED -> GPIO 4 (Pin 7)
```

## Testing Status

✅ RTC maintains time after restart  
✅ System time sync working  
✅ I2C: 0x68 (RTC), 0x67 (WatchDog)  
✅ Temperature: 26-29°C  
✅ Web API on port 8080  

**Last Test:** March 15, 2026, 17:08 GMT  
**RPi IP:** 192.168.188.229

## License

Apache License 2.0 - see [LICENSE](LICENSE) for details.

## Author

Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
