Skip to content

Developer Setup

Jason Rhubottom edited this page Apr 20, 2026 · 1 revision

Developer Setup

Prerequisites

Before you begin development, ensure you have the following installed:

Required Tools

  • Python 3.11+ - The integration requires Python 3.11 or higher
  • Git - Version control
  • Home Assistant Core - For testing the integration
  • pip - Python package manager

Recommended Tools

  • GitHub CLI (gh) - Required for automated releases
  • jq - Required for release script (JSON parsing)
  • Visual Studio Code or PyCharm - Recommended IDEs with Home Assistant support

Installation (macOS)

# Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install required tools
brew install python@3.11 git gh jq

# Verify installations
python3 --version
git --version
gh --version
jq --version

Getting Started

1. Clone the Repository

git clone https://github.com/jrhubott/adaptive-cover.git
cd adaptive-cover

2. Run Initial Setup

The setup script installs development dependencies and configures pre-commit hooks:

./scripts/setup

This script will:

  • Install Python development dependencies (ruff, pre-commit, etc.)
  • Set up pre-commit hooks for automatic linting
  • Configure your development environment

3. Verify Setup

# Check linting works
./scripts/lint

# Verify pre-commit hooks are installed
pre-commit run --all-files

Project Structure

adaptive-cover/
β”œβ”€β”€ custom_components/adaptive_cover_pro/
β”‚   β”œβ”€β”€ __init__.py              # Integration entry point
β”‚   β”œβ”€β”€ coordinator.py           # Data coordinator (orchestrator, ~1,477 lines)
β”‚   β”œβ”€β”€ calculation.py           # Position calculations (pure, 0 HA imports)
β”‚   β”œβ”€β”€ config_flow.py           # Configuration UI
β”‚   β”œβ”€β”€ config_types.py          # CoverConfig typed dataclass
β”‚   β”œβ”€β”€ sun.py                   # Solar calculations (pure, 0 HA imports)
β”‚   β”œβ”€β”€ engine/                  # Next-gen calculation engine
β”‚   β”‚   β”œβ”€β”€ sun_geometry.py      # SunGeometry dataclass
β”‚   β”‚   └── covers/
β”‚   β”‚       └── venetian.py      # VenetianCoverCalculation (dual-axis)
β”‚   β”œβ”€β”€ managers/                # Extracted coordinator responsibilities
β”‚   β”‚   β”œβ”€β”€ manual_override.py   # Manual override detection & tracking
β”‚   β”‚   β”œβ”€β”€ grace_period.py      # Per-command + startup grace periods
β”‚   β”‚   β”œβ”€β”€ motion.py            # Motion sensor timeout tracking
β”‚   β”‚   β”œβ”€β”€ position_verification.py  # Periodic position verification
β”‚   β”‚   └── cover_command.py     # Cover service calls & delta checks
β”‚   β”œβ”€β”€ state/                   # HA boundary layer (state providers)
β”‚   β”‚   β”œβ”€β”€ climate_provider.py  # Reads climate/weather/presence entities
β”‚   β”‚   β”œβ”€β”€ cover_provider.py    # CoverProvider β€” reads cover entity state
β”‚   β”‚   β”œβ”€β”€ snapshot.py          # SunSnapshot, CoverStateSnapshot dataclasses
β”‚   β”‚   └── sun_provider.py      # Reads astral location from HA
β”‚   β”œβ”€β”€ pipeline/                # Override priority chain
β”‚   β”‚   β”œβ”€β”€ registry.py          # Evaluates handlers in priority order
β”‚   β”‚   β”œβ”€β”€ types.py             # PipelineContext, PipelineResult, DecisionStep
β”‚   β”‚   β”œβ”€β”€ handler.py           # OverrideHandler base class
β”‚   β”‚   └── handlers/            # 8 priority handlers
β”‚   β”‚       β”œβ”€β”€ force_override.py    # Priority 100
β”‚   β”‚       β”œβ”€β”€ wind.py              # Priority 95 (stub)
β”‚   β”‚       β”œβ”€β”€ motion_timeout.py    # Priority 80
β”‚   β”‚       β”œβ”€β”€ manual_override.py   # Priority 70
β”‚   β”‚       β”œβ”€β”€ climate.py           # Priority 50
β”‚   β”‚       β”œβ”€β”€ solar.py             # Priority 40
β”‚   β”‚       β”œβ”€β”€ cloud_suppression.py # Priority 35 (stub)
β”‚   β”‚       └── default.py           # Priority 0
β”‚   β”œβ”€β”€ diagnostics/             # Diagnostic data builder
β”‚   β”‚   └── builder.py           # DiagnosticsBuilder + DiagnosticContext
β”‚   β”œβ”€β”€ services/                # Service layer
β”‚   β”‚   └── configuration_service.py
β”‚   β”œβ”€β”€ sensor.py                # Sensor platform
β”‚   β”œβ”€β”€ switch.py                # Switch platform
β”‚   β”œβ”€β”€ binary_sensor.py         # Binary sensor platform
β”‚   β”œβ”€β”€ button.py                # Button platform
β”‚   β”œβ”€β”€ entity_base.py           # Base entity classes
β”‚   β”œβ”€β”€ helpers.py               # Utility functions
β”‚   β”œβ”€β”€ const.py                 # Constants
β”‚   β”œβ”€β”€ enums.py                 # Type-safe enumerations
β”‚   β”œβ”€β”€ geometry.py              # Geometric utilities
β”‚   β”œβ”€β”€ position_utils.py        # Position conversion utilities
β”‚   β”œβ”€β”€ config_context_adapter.py # Logging adapter
β”‚   β”œβ”€β”€ manifest.json            # Integration metadata
β”‚   └── translations/            # i18n files
β”œβ”€β”€ tests/                       # Unit tests (751 tests)
β”‚   β”œβ”€β”€ conftest.py              # Shared fixtures
β”‚   β”œβ”€β”€ test_calculation.py      # Core calculation tests
β”‚   β”œβ”€β”€ test_geometric_accuracy.py
β”‚   β”œβ”€β”€ test_sill_height.py
β”‚   β”œβ”€β”€ test_control_state_reason.py
β”‚   β”œβ”€β”€ test_position_explanation.py
β”‚   β”œβ”€β”€ test_position_limits.py
β”‚   β”œβ”€β”€ test_inverse_state.py
β”‚   β”œβ”€β”€ test_manual_override.py
β”‚   β”œβ”€β”€ test_motion_control.py
β”‚   β”œβ”€β”€ test_force_override_sensors.py
β”‚   β”œβ”€β”€ test_startup_grace_period.py
β”‚   β”œβ”€β”€ test_delta_position.py
β”‚   β”œβ”€β”€ test_interpolation.py
β”‚   β”œβ”€β”€ test_helpers.py
β”‚   β”œβ”€β”€ test_time_window_sensor.py
β”‚   β”œβ”€β”€ test_coordinator_logging.py
β”‚   β”œβ”€β”€ test_managers/           # Manager unit tests
β”‚   β”œβ”€β”€ test_pipeline/           # Pipeline handler tests
β”‚   β”œβ”€β”€ test_state/              # State provider tests
β”‚   β”œβ”€β”€ test_engine/             # Engine module tests
β”‚   └── test_diagnostics/        # Diagnostics builder tests
β”œβ”€β”€ scripts/
β”œβ”€β”€ docs/
β”œβ”€β”€ release_notes/
β”œβ”€β”€ notebooks/
β”œβ”€β”€ CLAUDE.md
β”œβ”€β”€ HANDOFF.md
β”œβ”€β”€ README.md
└── pyproject.toml

Clone this wiki locally