From 09e2d83b4964d648393a508564abbe8d9a67c720 Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Mon, 11 May 2026 02:58:19 -0600 Subject: [PATCH] dev stack: pip-install local omni-pca on HA startup Replace the brittle bind-mount-over-site-packages trick with a proper ``pip install --no-deps /opt/omni-pca-src`` in the HA container's entrypoint. This gives HA a real ``omni_pca-2026.5.10.dist-info`` so the manifest's requirement check passes, plus the v1 subpackage that's not in the published wheel yet (omni-pca==2026.5.10 isn't on PyPI). Before: ``--force-recreate`` broke the dev stack because the bind mount overlaid the package contents but left no dist-info, and HA's uv-based installer can't fetch omni-pca from PyPI. After: container recreate just works. ``docker compose restart homeassistant`` re-installs from the latest local source on every start, so HA + library are always in sync with the working tree. Header comments updated to mention the real-panel (UDP/v1) config-flow fields alongside the existing mock-panel ones. --- dev/docker-compose.yml | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index 2649e63..c055394 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -6,15 +6,27 @@ # make dev-logs # tail HA logs # make dev-down # stop and clean # +# On every container start the HA service pip-installs the local +# `omni-pca` library from ../ into site-packages (the version pinned in +# the integration manifest isn't on PyPI yet, and we want our latest +# v1/ subpackage available either way). Source changes in src/omni_pca +# require a ``docker compose restart homeassistant`` to take effect. +# # Once running, open http://localhost:8123 and: # 1. Onboard with any name / location. # 2. Settings -> Devices & Services -> Add Integration -> # "HAI/Leviton Omni Panel". -# 3. Use: -# host host.docker.internal -# port 14369 -# controller_key 000102030405060708090a0b0c0d0e0f -# (matches scripts/run_mock_panel.py defaults) +# 3. Use one of: +# Mock panel (TCP): +# host host.docker.internal +# port 14369 +# transport TCP +# controller_key 000102030405060708090a0b0c0d0e0f +# Real panel (UDP, v1 wire protocol): +# host +# port 4369 +# transport UDP +# controller_key <32 hex chars from the panel's .pca file> services: mock-panel: @@ -40,9 +52,25 @@ services: volumes: - ./ha-config:/config - ../custom_components/omni_pca:/config/custom_components/omni_pca:ro + # Make the whole library project (pyproject + src/ + dist/) available + # so the entrypoint override below can pip-install from local source + # before /init starts. This gives HA real dist-info for + # ``omni-pca==2026.5.10`` (which isn't on PyPI yet) and ensures the + # v1 subpackage is present. + - ../:/opt/omni-pca-src:ro ports: - "8123:8123" extra_hosts: - "host.docker.internal:host-gateway" environment: - TZ=America/Boise + # HA's image entrypoint is /init (s6-overlay). We pre-install our + # local library against site-packages so HA's manifest-requirement + # check finds it, then exec /init normally. + entrypoint: + - sh + - -c + - | + set -e + pip install --quiet --no-deps --upgrade /opt/omni-pca-src + exec /init