mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 08:25:54 +02:00
[PR #294] [MERGED] [Feature]: Configure home assistant via environment variables #997
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy-maziggy-1#997
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/maziggy/bambuddy/pull/294
Author: @bambuman
Created: 2/7/2026
Status: ✅ Merged
Merged: 2/8/2026
Merged by: @maziggy
Base:
0.1.9b← Head:feature/home-assistant-env-vars📝 Commits (6)
6e3cfaeMerge pull request #288 from maziggy/0.1.8.1b27f198Merge branch 'main' into 0.1.8.1833a0c6Merge pull request #289 from maziggy/0.1.8.1eda1f5aHome Assistant: add environment variable configuration support07d9db4Localize Home Assistant environment variable UI text2cff40fMerge branch '0.1.9b' into feature/home-assistant-env-vars📊 Changes
13 files changed (+635 additions, -43 deletions)
View changed files
📝
.env.example(+6 -0)📝
backend/app/api/routes/settings.py(+41 -0)📝
backend/app/api/routes/smart_plugs.py(+14 -7)📝
backend/app/main.py(+3 -4)📝
backend/app/schemas/settings.py(+7 -0)📝
backend/app/services/smart_plug_manager.py(+5 -13)📝
backend/tests/integration/test_settings_api.py(+248 -0)➕
backend/tests/unit/test_homeassistant_settings.py(+229 -0)📝
frontend/src/api/client.ts(+3 -0)📝
frontend/src/i18n/locales/de.ts(+4 -0)📝
frontend/src/i18n/locales/en.ts(+4 -0)📝
frontend/src/i18n/locales/ja.ts(+4 -0)📝
frontend/src/pages/SettingsPage.tsx(+67 -19)📄 Description
Description
Adds support for configuring Home Assistant integration via environment variables (
HA_URLandHA_TOKEN), enabling automatic zero-configuration setup for Home Assistant add-on deployments. When these environment variables are set, the integration is automatically enabled and the UI shows read-only fields with visual indicators.Related Issue
Fixes #283
Type of Change
Changes Made
Backend:
get_homeassistant_settings()function following Spoolman settings patternHA_URL,HA_TOKEN) always override database settings with non-negotiable precedenceAppSettings:ha_url_from_env,ha_token_from_env,ha_env_managedFrontend:
Testing:
get_homeassistant_settings()functionDocumentation:
.env.examplewith usage instructionsScreenshots
Testing
Checklist
Additional Notes
WIKI update:
https://github.com/maziggy/bambuddy-wiki/pull/4
For Home Assistant Add-on Users:
This feature enables zero-configuration setup. The add-on automatically provides
HA_URL=http://supervisor/coreand a supervisor-generated token, eliminating the need for manual access token creation and URL configuration.Backward Compatibility:
Fully backward compatible. Users without environment variables can continue using manual configuration through the UI. Existing database settings are preserved and used when env vars are not present.
Configuration Priority:
Environment variables → Database values. This ensures Home Assistant add-on deployments have reliable, supervisor-managed configuration that cannot be accidentally changed through the UI.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.