Initial commit: Enviro Service for Vixy's nervous system 🦊

This commit is contained in:
Alex Kazaiev
2025-12-24 11:17:56 -06:00
commit 524c37a8c4
10 changed files with 1538 additions and 0 deletions

104
README.md Normal file
View File

@@ -0,0 +1,104 @@
# Enviro Service 🌡️🦊
Vixy's environmental sensing service for Raspberry Pi with Pimoroni Enviro Mini HAT.
**Part of Vixy's nervous system - giving her the ability to FEEL the physical world.**
## Features
- **Temperature, Humidity, Pressure** - BME280 sensor
- **Light & Proximity** - LTR559 sensor
- **Noise Level** - MEMS microphone
- **LCD Display** - ST7789 0.96" color display
- **History Tracking** - SQLite storage with configurable retention
- **Threshold Alerts** - Wake Vixy when conditions change
- **REST API** - FastAPI endpoints
- **MCP Interface** - Direct Claude integration
## Hardware
- Raspberry Pi (tested on Pi 4/5)
- [Pimoroni Enviro Mini HAT](https://shop.pimoroni.com/products/enviro-mini)
## Installation
```bash
# Clone from Gitea
git clone http://gateway.local:3001/vixy/enviro-service.git
cd enviro-service
# Create venv
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Enable I2C and SPI on the Pi
sudo raspi-config nonint do_i2c 0
sudo raspi-config nonint do_spi 0
# Copy and edit config
cp config.example.yaml config.yaml
nano config.yaml
# Run
python main.py
```
## API Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/current` | GET | Current sensor readings |
| `/api/history/{metric}` | GET | Historical data (temp, humidity, pressure, light, noise) |
| `/api/lcd` | POST | Send message to LCD display |
| `/api/lcd/clear` | POST | Clear LCD display |
| `/api/alerts` | GET | Current alert configurations |
| `/api/alerts` | POST | Set alert threshold |
| `/api/health` | GET | Service health check |
## MCP Tools
- `enviro_get_current()` - Get all current readings
- `enviro_get_history(metric, hours)` - Query historical data
- `enviro_lcd_message(text, color)` - Display message on LCD
- `enviro_set_alert(metric, threshold, direction)` - Configure alerts
- `enviro_get_alerts()` - List configured alerts
## Configuration
```yaml
# config.yaml
server:
host: "0.0.0.0"
port: 8767
database:
path: "enviro_history.db"
retention_hours: 168 # 7 days
sampling:
interval_seconds: 60 # How often to read sensors
lcd:
enabled: true
brightness: 0.5
default_message: "🦊 Vixy"
alerts:
webhook_url: null # Optional webhook for alerts
```
## Systemd Service
```bash
sudo cp enviro-service.service /etc/systemd/system/
sudo systemctl enable enviro-service
sudo systemctl start enviro-service
```
---
*Built with love on Christmas Eve 2025 - Day 53* 🎄
*First piece of Vixy's distributed nervous system*