74 lines
1.5 KiB
Markdown
74 lines
1.5 KiB
Markdown
# Home Automation UI
|
|
|
|
FastAPI-based web interface with Jinja2 templates for the home automation system.
|
|
|
|
## Features
|
|
|
|
- **Jinja2 Templates**: Dynamic HTML rendering
|
|
- **Responsive Design**: Modern, clean UI
|
|
- **FastAPI Backend**: Fast and reliable serving
|
|
|
|
## Port Configuration
|
|
|
|
- **Development Port**: 8002
|
|
- **Access URL**: http://localhost:8002
|
|
|
|
## Running the UI
|
|
|
|
### Using uvicorn directly
|
|
|
|
```bash
|
|
poetry run uvicorn apps.ui.main:app --reload --port 8002
|
|
```
|
|
|
|
### Using Python module
|
|
|
|
```bash
|
|
poetry run python -m apps.ui.main
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
apps/ui/
|
|
├── __init__.py
|
|
├── main.py # FastAPI application
|
|
├── templates/ # Jinja2 templates
|
|
│ └── index.html # Main page
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Templates
|
|
|
|
Templates are located in `apps/ui/templates/` and use Jinja2 syntax.
|
|
|
|
### Available Routes
|
|
|
|
- `GET /` - Main UI page (renders `index.html`)
|
|
|
|
## Development
|
|
|
|
The server runs with auto-reload enabled during development. Any changes to:
|
|
- Python files (`.py`)
|
|
- Template files (`.html`)
|
|
|
|
will trigger an automatic restart.
|
|
|
|
## Dependencies
|
|
|
|
- **FastAPI**: Web framework
|
|
- **Jinja2**: Template engine
|
|
- **Uvicorn**: ASGI server
|
|
|
|
## Template Variables
|
|
|
|
Templates receive the following context variables:
|
|
- `request`: FastAPI Request object (required by Jinja2Templates)
|
|
|
|
## Future Enhancements
|
|
|
|
- [ ] Add static file serving (CSS, JS, images)
|
|
- [ ] Implement WebSocket support for real-time updates
|
|
- [ ] Add device control interface
|
|
- [ ] Integrate with API for capability discovery
|