Files
home-automation/README.md

2.5 KiB

Home Automation Monorepo

A Python-based home automation system built with Poetry in a monorepo structure.

Project Structure

home-automation/
├── apps/                    # Applications
│   ├── api/                # API service
│   ├── abstraction/        # Abstraction layer
│   ├── rules/              # Rules engine
│   └── ui/                 # User interface
├── packages/               # Shared packages
│   └── home_capabilities/  # Home capabilities library
├── infra/                  # Infrastructure
│   ├── docker-compose.yml
│   └── README.md
├── pyproject.toml          # Poetry configuration
└── README.md

Requirements

  • Python 3.11+
  • Poetry

Setup

  1. Install Poetry if you haven't already:

    curl -sSL https://install.python-poetry.org | python3 -
    
  2. Install dependencies:

    poetry install
    
  3. Activate the virtual environment:

    poetry shell
    

Development

Code Quality Tools

This project uses the following tools configured in pyproject.toml:

  • Ruff: Fast Python linter
  • Black: Code formatter
  • Mypy: Static type checker

Run code quality checks:

# Format code
poetry run black .

# Lint code
poetry run ruff check .

# Type check
poetry run mypy .

Running Applications

Port Configuration

See PORTS.md for detailed port allocation.

API Server

Start the FastAPI server with auto-reload:

# Using uvicorn directly (port 8001)
poetry run uvicorn apps.api.main:app --reload --port 8001

# Or using the main function
poetry run python -m apps.api.main

The API will be available at:

Available endpoints:

  • GET /health - Health check endpoint
  • GET /spec - Capabilities specification

UI Server

Start the web interface:

# Using uvicorn directly (port 8002)
poetry run uvicorn apps.ui.main:app --reload --port 8002

# Or using the main function
poetry run python -m apps.ui.main

The UI will be available at:

Other Applications

# Abstraction
poetry run python -m apps.abstraction.main

# Rules
poetry run python -m apps.rules.main

# UI
poetry run python -m apps.ui.main

License

TBD