Initial commit - Phase 3/4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
michael
2026-01-06 13:45:29 -08:00
parent 1da6730735
commit 4f35df1781
323 changed files with 98287 additions and 1195 deletions

View File

@@ -0,0 +1,239 @@
# Implementation Priorities - Updated
**Date**: 2025-11-26
**Status**: Active Development
---
## 🔴 PRIORITY 1: Power Management (BEFORE PI TESTING)
**Why Critical**: System behavior must be defined for UPS-present and UPS-absent scenarios before deploying to hardware.
### Tasks
#### 1.1 UPS Manager - Power Restrictions Method ⚠️ CRITICAL
- **File**: `app/backend/managers/ups_manager.py`
- **Action**: Add `get_power_restrictions()` method
- **Estimated Time**: 30 minutes
- **Blocks**: All hardware testing
**Implementation**:
```python
def get_power_restrictions(self) -> Dict[str, Any]:
"""Get current power restrictions based on hardware state."""
# See POWER_MANAGEMENT_POLICY.md for full implementation
```
#### 1.2 System API - Power Restrictions Endpoint
- **File**: `app/backend/api/system.py`
- **Action**: Add `GET /api/system/power/restrictions` endpoint
- **Estimated Time**: 15 minutes
- **Depends on**: 1.1
**Implementation**:
```python
@router.get("/power/restrictions")
async def get_power_restrictions():
"""Get current power restrictions."""
# See POWER_MANAGEMENT_POLICY.md
```
#### 1.3 Header Widget - UPS Missing Warning
- **File**: Multiple (plugin_manager, ups_manager)
- **Action**: Register widget when UPS not detected
- **Estimated Time**: 20 minutes
- **Depends on**: Header widget system (can defer to Phase 2)
#### 1.4 Documentation Update
- **Files**:
- `README.md` - Add power management section
- `GETTING_STARTED.md` - Mention UPS optional
- `PROJECT_STATUS.md` - Update status
- **Estimated Time**: 15 minutes
**Total Time**: ~1.5 hours for Phase 1 (core functionality)
---
## 🟡 PRIORITY 2: Header Widget System (OPTIONAL FOR TESTING)
**Why Important**: Good UX, but not required for basic Pi testing
### Tasks
#### 2.1 Backend Widget Infrastructure
- Add `HeaderWidget` dataclass to plugin_manager
- Add widget registry methods
- Add dismissed widgets tracking
- **Estimated Time**: 1 hour
#### 2.2 API Endpoints
- `GET /api/system/widgets`
- `POST /api/system/widgets/{id}/dismiss`
- **Estimated Time**: 30 minutes
#### 2.3 Frontend Component
- Create `HeaderWidgets.tsx`
- Add CSS styles
- Integrate into `root.tsx`
- **Estimated Time**: 1.5 hours
#### 2.4 UPS Integration
- Register widget on missing hardware
- Register widget on low battery
- **Estimated Time**: 30 minutes
**Total Time**: ~3.5 hours
---
## 🟢 PRIORITY 3: Pi-gen Build Testing (READY TO GO)
**Status**: Scripts complete, ready for build
### Tasks
#### 3.1 Test Build
- Run `./build-image.sh quick`
- Verify PM3 client builds
- Verify Python bindings work
- **Estimated Time**: 30 minutes (build time 5-10 min)
#### 3.2 Fix Issues
- Address any build failures
- Update scripts as needed
- **Estimated Time**: Variable
#### 3.3 Full Build
- Run `./build-image.sh full`
- Create complete bootable image
- **Estimated Time**: 1-2 hours (build time)
**Total Time**: 2-3 hours
---
## 🔵 PRIORITY 4: Hardware Testing
**Prerequisites**: Priorities 1 & 3 complete
### 4.1 Deploy to Pi Zero 2 W
- Flash SD card with custom image
- Boot and verify services start
- Test web interface access
### 4.2 Test Without UPS
- Verify power restrictions return "assumed AC"
- Verify header widget shows warning
- Verify no unexpected restrictions
### 4.3 Test With UPS (if available)
- Connect UPS HAT
- Verify battery monitoring works
- Test power restrictions on battery
- Test AC power detection
### 4.4 Test PM3 Operations
- Connect PM3 device
- Execute commands
- Test multi-device (if available)
**Total Time**: 2-4 hours
---
## 🟣 PRIORITY 5: Future Enhancements (POST-MVP)
- Firmware flashing UI (Sprint 3)
- Advanced header widgets
- Plugin ecosystem
- Multi-device hardware testing
---
## Recommended Order
### Session Today: Power Management
1. ✅ Plans A, B, C (cloud-init, PYTHONPATH, port conflict) - DONE
2. ✅ Header widget system design - DONE
3. ✅ Power management policy design - DONE
4. **⏭️ NEXT: Implement Priority 1 (Power Management)**
### Next Session: Build & Deploy
1. Test pi-gen build (Priority 3)
2. Deploy to Pi hardware (Priority 4)
3. Verify power management works
4. Test PM3 operations
### Future Session: Polish
1. Implement header widgets (Priority 2)
2. Add firmware flashing (Sprint 3)
3. Advanced features
---
## Quick Implementation Guide
### Step 1: Add Power Restrictions to UPS Manager
```bash
# Edit UPS manager
nano app/backend/managers/ups_manager.py
# Add get_power_restrictions() method
# See POWER_MANAGEMENT_POLICY.md lines 49-120
```
### Step 2: Add API Endpoint
```bash
# Edit system API
nano app/backend/api/system.py
# Add /power/restrictions endpoint
# See POWER_MANAGEMENT_POLICY.md lines 166-180
```
### Step 3: Test Locally
```bash
# Start backend
cd app/backend
python -m uvicorn main:app --reload
# Test endpoint
curl http://localhost:8000/api/system/power/restrictions
```
### Step 4: Update Docs
```bash
# Update PROJECT_STATUS.md
# Update README.md with power management info
```
---
## Success Criteria
### Priority 1 Complete When:
- [x] Power management policy documented
- [ ] `get_power_restrictions()` method implemented
- [ ] API endpoint `/api/system/power/restrictions` working
- [ ] Returns correct response when UPS not detected
- [ ] Returns correct response when UPS on AC
- [ ] Returns correct response when UPS on battery
- [ ] Documentation updated
### Ready for Pi Testing When:
- [ ] Priority 1 complete
- [ ] Priority 3 complete (build tested)
- [ ] Services start correctly
- [ ] Web interface accessible
- [ ] No Python import errors
---
**Current Status**: Priority 1 design complete, implementation needed (~1.5 hours)
**Blocker**: Must implement before Pi deployment
**Next Action**: Implement `get_power_restrictions()` method