From 8a0fa9604cccd2b57882ac115a5ecf3d05068971 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 2 Aug 2025 21:00:07 -0700 Subject: [PATCH] Add Home Assistant development environment to flake - Add home-assistant and mosquitto to dev shell - Create minimal dev-config/ for HA development instance - Symlink custom integration for easy testing - Add HA dev files to .gitignore - No HA codebase committed, just references via Nix Usage: nix develop hass --config ./dev-config Features: - Isolated from production HA instance - MQTT broker for testing - Debug logging enabled - In-memory database for fast iteration --- .gitignore | 6 +++ dev-config/automations.yaml | 2 + dev-config/configuration.yaml | 47 +++++++++++++++++++++ dev-config/scenes.yaml | 2 + dev-config/scripts.yaml | 2 + flake.nix | 14 +++++- server/dev-config/custom_components/systant | 1 + 7 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 dev-config/automations.yaml create mode 100644 dev-config/configuration.yaml create mode 100644 dev-config/scenes.yaml create mode 100644 dev-config/scripts.yaml create mode 120000 server/dev-config/custom_components/systant diff --git a/.gitignore b/.gitignore index baeb73b..1cf4962 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,9 @@ system_stats_daemon-*.tar # Nix result symlinks result result-* + +# Home Assistant development files +dev-config/.storage/ +dev-config/home-assistant.log* +dev-config/deps/ +dev-config/.cloud/ diff --git a/dev-config/automations.yaml b/dev-config/automations.yaml new file mode 100644 index 0000000..dfe1128 --- /dev/null +++ b/dev-config/automations.yaml @@ -0,0 +1,2 @@ +# Development automations for testing Systant integration +[] \ No newline at end of file diff --git a/dev-config/configuration.yaml b/dev-config/configuration.yaml new file mode 100644 index 0000000..0fc89d9 --- /dev/null +++ b/dev-config/configuration.yaml @@ -0,0 +1,47 @@ +# Home Assistant Development Configuration for Systant Integration + +homeassistant: + name: Systant Development + latitude: 0 + longitude: 0 + elevation: 0 + unit_system: metric + time_zone: UTC + +# Enable configuration UI +config: + +# Enable frontend +frontend: + themes: !include_dir_merge_named themes + +# Enable API +api: + +# Enable system health +system_health: + +# Enable mobile app support +mobile_app: + +# MQTT Configuration (connect to local broker) +mqtt: + broker: localhost + port: 1883 + discovery: true + discovery_prefix: homeassistant + +# Enable logging +logger: + default: info + logs: + custom_components.systant: debug + homeassistant.components.mqtt: debug + +# Enable recorder with in-memory database for development +recorder: + db_url: "sqlite:///:memory:" + purge_keep_days: 1 + +# Enable default integrations +default_config: \ No newline at end of file diff --git a/dev-config/scenes.yaml b/dev-config/scenes.yaml new file mode 100644 index 0000000..491c356 --- /dev/null +++ b/dev-config/scenes.yaml @@ -0,0 +1,2 @@ +# Development scenes for testing Systant integration +[] \ No newline at end of file diff --git a/dev-config/scripts.yaml b/dev-config/scripts.yaml new file mode 100644 index 0000000..dcff63e --- /dev/null +++ b/dev-config/scripts.yaml @@ -0,0 +1,2 @@ +# Development scripts for testing Systant integration +{} \ No newline at end of file diff --git a/flake.nix b/flake.nix index 4c7ae87..b982862 100644 --- a/flake.nix +++ b/flake.nix @@ -41,23 +41,33 @@ python311Packages.pip python311Packages.ipython python311Packages.pytest - python311Packages.homeassistant python311Packages.pytest-homeassistant-custom-component python311Packages.black python311Packages.isort python311Packages.flake8 python311Packages.mypy + + # Home Assistant for development + home-assistant + mosquitto ]; shellHook = '' echo "Systant development environment loaded" echo "Elixir: $(elixir --version | head -1)" echo "Python: $(python --version)" - echo "Available tools: pytest, black, isort, flake8, mypy" + echo "Home Assistant: $(hass --version)" + echo "" + echo "Available tools: pytest, black, isort, flake8, mypy, mosquitto" echo "" echo "Directories:" echo " server/ - Elixir systant daemon" echo " home-assistant-integration/ - Home Assistant custom integration" + echo " dev-config/ - Home Assistant development configuration" + echo "" + echo "Commands:" + echo " hass --config ./dev-config - Start HA dev instance" + echo " mosquitto - Start MQTT broker for testing" ''; }; packages = { diff --git a/server/dev-config/custom_components/systant b/server/dev-config/custom_components/systant new file mode 120000 index 0000000..3092a89 --- /dev/null +++ b/server/dev-config/custom_components/systant @@ -0,0 +1 @@ +../../home-assistant-integration/custom_components/systant \ No newline at end of file