From 490f92935e9432af27ca3fe564b5168ab8dd4339 Mon Sep 17 00:00:00 2001 From: dev Date: Sat, 25 Apr 2026 23:41:02 +0200 Subject: [PATCH 1/4] feat: add uv-based project with pytest and CI workflow - Add pyproject.toml and uv.lock for Python project with uv - Add src/__init__.py with add(), multiply(), greet() functions - Add tests/test_example.py with unit tests - Add commit-message skill for Conventional Commits - Add Gitea Actions workflow to run pytest --- .gitea/workflows/test.yaml | 18 +++++-- .opencode/skills/commit-message.md | 59 ++++++++++++++++++++++ pyproject.toml | 14 ++++++ src/__init__.py | 13 +++++ tests/test_example.py | 17 +++++++ uv.lock | 78 ++++++++++++++++++++++++++++++ 6 files changed, 194 insertions(+), 5 deletions(-) create mode 100644 .opencode/skills/commit-message.md create mode 100644 pyproject.toml create mode 100644 src/__init__.py create mode 100644 tests/test_example.py create mode 100644 uv.lock diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index c8fe950..66bf322 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -9,8 +9,16 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Run test - run: | - echo "Hello from Gitea Actions!" - echo "Testing runner..." - echo "Done!" \ No newline at end of file + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Install dependencies + run: uv sync --extra test + + - name: Run tests + run: uv run pytest tests/ -v \ No newline at end of file diff --git a/.opencode/skills/commit-message.md b/.opencode/skills/commit-message.md new file mode 100644 index 0000000..91ef296 --- /dev/null +++ b/.opencode/skills/commit-message.md @@ -0,0 +1,59 @@ +# skill: commit-message + +Follow these commit message conventions for all git commits: + +## Format + +``` +(): + +[optional body] + +[optional footer(s)] +``` + +## Types + +| Type | Description | +|------|------------| +| `feat` | New feature | +| `fix` | Bug fix | +| `docs` | Documentation only | +| `style` | Code style (formatting, semicolons) | +| `refactor` | Code change that neither fixes nor adds | +| `test` | Adding or updating tests | +| `chore` | Maintenance, deps, build changes | + +## Rules + +1. Use imperative: "add" not "added" or "adds" +2. Limit subject line to 50 chars +3. Capitalize first letter of description +4. No period at end of subject +5. Use scope (module/file) when applicable + +## Breaking Changes + +If change breaks backward compatibility: +- Add `BREAKING CHANGE:` in footer +- Use `!` after type: `feat!:` + +## Examples + +``` +feat(auth): add login endpoint + +fix(api): resolve null pointer in user response + +docs(readme): update installation steps + +feat!: migrate to v2 API + +BREAKING CHANGE: auth header format changed +``` + +## When to Write Body + +- Explanation of "what" and "why" (not "how") +- More detail than fits in subject line +- References to issues/PRs \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d1539fb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[project] +name = "explore-agentic" +version = "0.1.0" +description = "A sample Python project" +requires-python = ">=3.11" +dependencies = [] + +[project.optional-dependencies] +test = ["pytest>=8.0.0"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = ["test_*.py"] +python_functions = ["test_*"] \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..3e7cef6 --- /dev/null +++ b/src/__init__.py @@ -0,0 +1,13 @@ +def add(a: int, b: int) -> int: + """Add two numbers together.""" + return a + b + + +def multiply(a: int, b: int) -> int: + """Multiply two numbers together.""" + return a * b + + +def greet(name: str) -> str: + """Return a greeting message.""" + return f"Hello, {name}!" \ No newline at end of file diff --git a/tests/test_example.py b/tests/test_example.py new file mode 100644 index 0000000..aeaabf4 --- /dev/null +++ b/tests/test_example.py @@ -0,0 +1,17 @@ +import pytest +from src import add, multiply, greet + + +def test_add(): + assert add(1, 2) == 3 + assert add(-1, 1) == 0 + + +def test_multiply(): + assert multiply(2, 3) == 6 + assert multiply(0, 5) == 0 + + +def test_greet(): + assert greet("World") == "Hello, World!" + assert greet("") == "Hello, !" \ No newline at end of file diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..a629489 --- /dev/null +++ b/uv.lock @@ -0,0 +1,78 @@ +version = 1 +revision = 3 +requires-python = ">=3.11" + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "explore-agentic" +version = "0.1.0" +source = { virtual = "." } + +[package.optional-dependencies] +test = [ + { name = "pytest" }, +] + +[package.metadata] +requires-dist = [{ name = "pytest", marker = "extra == 'test'", specifier = ">=8.0.0" }] +provides-extras = ["test"] + +[[package]] +name = "iniconfig" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" }, +] + +[[package]] +name = "packaging" +version = "26.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d7/f1/e7a6dd94a8d4a5626c03e4e99c87f241ba9e350cd9e6d75123f992427270/packaging-26.2.tar.gz", hash = "sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661", size = 228134, upload-time = "2026-04-24T20:15:23.917Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/df/b2/87e62e8c3e2f4b32e5fe99e0b86d576da1312593b39f47d8ceef365e95ed/packaging-26.2-py3-none-any.whl", hash = "sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e", size = 100195, upload-time = "2026-04-24T20:15:22.081Z" }, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, +] + +[[package]] +name = "pygments" +version = "2.20.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f", size = 4955991, upload-time = "2026-03-29T13:29:33.898Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176", size = 1231151, upload-time = "2026-03-29T13:29:30.038Z" }, +] + +[[package]] +name = "pytest" +version = "9.0.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/7d/0d/549bd94f1a0a402dc8cf64563a117c0f3765662e2e668477624baeec44d5/pytest-9.0.3.tar.gz", hash = "sha256:b86ada508af81d19edeb213c681b1d48246c1a91d304c6c81a427674c17eb91c", size = 1572165, upload-time = "2026-04-07T17:16:18.027Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d4/24/a372aaf5c9b7208e7112038812994107bc65a84cd00e0354a88c2c77a617/pytest-9.0.3-py3-none-any.whl", hash = "sha256:2c5efc453d45394fdd706ade797c0a81091eccd1d6e4bccfcd476e2b8e0ab5d9", size = 375249, upload-time = "2026-04-07T17:16:16.13Z" }, +] -- 2.47.3 From a84eea9b17a0180b4926a6291e237c68c2137819 Mon Sep 17 00:00:00 2001 From: dev Date: Sat, 25 Apr 2026 23:41:38 +0200 Subject: [PATCH 2/4] docs(readme): update project README --- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b2ae5b9..7fdf9bb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,56 @@ # explore-agentic -Agentic exploration project. \ No newline at end of file +Sample Python project with uv, pytest, and Gitea Actions CI/CD. + +## Setup + +```bash +# Install dependencies +uv sync + +# Activate virtual environment +source .venv/bin/activate +``` + +## Development + +```bash +# Install with test dependencies +uv sync --extra test + +# Run tests +uv run pytest tests/ -v +``` + +## CI/CD + +This project uses Gitea Actions for CI. The workflow runs on push and pull requests. + +Workflow: `.gitea/workflows/test.yaml` + +## OpenCode Configuration + +This project uses OpenCode with custom MCP servers and skills. + +### MCP Servers + +- **context7**: Documentation lookup +- **gitea**: Repository interaction +- **sentry**: Error tracking (requires API key) + +### Skills + +- **commit-message**: Conventional Commits format + +## Project Structure + +``` +. +├── src/ # Source code +├── tests/ # Unit tests +├── .gitea/workflows/ # CI/CD workflows +├── .opencode/ # OpenCode config +│ └── skills/ # Custom skills +├── pyproject.toml # uv project config +└── uv.lock # Locked dependencies +``` \ No newline at end of file -- 2.47.3 From 219308f6a0285f1bf7c9a632078537ce632fca51 Mon Sep 17 00:00:00 2001 From: dev Date: Sun, 26 Apr 2026 09:59:12 +0200 Subject: [PATCH 3/4] fix(ci): use pip to install uv instead of setup-uv action --- .gitea/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index 66bf322..ef2bbbc 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: python-version: '3.11' - name: Install uv - uses: astral-sh/setup-uv@v4 + run: pip install uv - name: Install dependencies run: uv sync --extra test -- 2.47.3 From 3effd47453d6e4b9719a4c1c3f5c1025632ecac8 Mon Sep 17 00:00:00 2001 From: dev Date: Sun, 3 May 2026 13:48:06 +0200 Subject: [PATCH 4/4] wip --- .opencode/opencode.json | 6 + .opencode/skills/commit-message.md | 59 ---- AGENTS.md | 27 +- automations.yaml | 62 +++++ automations_waschmaschine.yaml | 20 ++ cron | 5 + ha_areas_config.yaml | 136 ++++++++++ ha_dashboard_complete.yaml | 281 +++++++++++++++++++ lovelace_uebersicht.yaml | 418 +++++++++++++++++++++++++++++ opencode.json | 4 + 10 files changed, 954 insertions(+), 64 deletions(-) create mode 100644 .opencode/opencode.json delete mode 100644 .opencode/skills/commit-message.md create mode 100644 automations.yaml create mode 100644 automations_waschmaschine.yaml create mode 100644 cron create mode 100644 ha_areas_config.yaml create mode 100644 ha_dashboard_complete.yaml create mode 100644 lovelace_uebersicht.yaml create mode 100644 opencode.json diff --git a/.opencode/opencode.json b/.opencode/opencode.json new file mode 100644 index 0000000..c997c03 --- /dev/null +++ b/.opencode/opencode.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://opencode.ai/config.json", + "plugin": [ + "list" + ] +} \ No newline at end of file diff --git a/.opencode/skills/commit-message.md b/.opencode/skills/commit-message.md deleted file mode 100644 index 91ef296..0000000 --- a/.opencode/skills/commit-message.md +++ /dev/null @@ -1,59 +0,0 @@ -# skill: commit-message - -Follow these commit message conventions for all git commits: - -## Format - -``` -(): - -[optional body] - -[optional footer(s)] -``` - -## Types - -| Type | Description | -|------|------------| -| `feat` | New feature | -| `fix` | Bug fix | -| `docs` | Documentation only | -| `style` | Code style (formatting, semicolons) | -| `refactor` | Code change that neither fixes nor adds | -| `test` | Adding or updating tests | -| `chore` | Maintenance, deps, build changes | - -## Rules - -1. Use imperative: "add" not "added" or "adds" -2. Limit subject line to 50 chars -3. Capitalize first letter of description -4. No period at end of subject -5. Use scope (module/file) when applicable - -## Breaking Changes - -If change breaks backward compatibility: -- Add `BREAKING CHANGE:` in footer -- Use `!` after type: `feat!:` - -## Examples - -``` -feat(auth): add login endpoint - -fix(api): resolve null pointer in user response - -docs(readme): update installation steps - -feat!: migrate to v2 API - -BREAKING CHANGE: auth header format changed -``` - -## When to Write Body - -- Explanation of "what" and "why" (not "how") -- More detail than fits in subject line -- References to issues/PRs \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index 0372693..94f44aa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,8 +1,25 @@ # AGENTS.md -This is a new/empty repository. No build, test, or lint commands configured yet. +## Commands -When adding code: -- Add a `README.md` with setup instructions -- Add `package.json` or similar manifest with scripts -- Add `AGENTS.md` guidance once the project has real structure \ No newline at end of file +```bash +# Install dependencies +uv sync + +# Install with test deps +uv sync --extra test + +# Run tests +uv run pytest tests/ -v +``` + +## Project Structure + +- `src/` - Source code +- `tests/` - Unit tests +- `.gitea/workflows/` - CI/CD workflows (Gitea Actions) + +## Skills + +Custom skills stored at `~/.agents/skills/*/SKILL.md`: +- `commit-message` - Conventional Commits format \ No newline at end of file diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..7ad8810 --- /dev/null +++ b/automations.yaml @@ -0,0 +1,62 @@ +# Home Assistant Automations - Improvements +# Copy these to your automations.yaml file + +- id: waschmaschine_fertig + alias: "Waschmaschine - Fertig-Benachrichtigung" + description: "Sendet Benachrichtigung wenn Waschmaschine fertig (via Leistung = 0W)" + mode: single + triggers: + - trigger: state + entity_id: sensor.waschmaschine_steckdose_leistung + to: "0" + condition: + - condition: state + entity_id: switch.waschmaschine_steckdose + state: "on" + action: + - action: persistent_notification.create + data: + message: "Die Waschmaschine ist fertig! Zeit zum Aufhängen der Wäsche." + title: "Waschmaschine ✅" + - action: tts.google_translate_say + data: + entity_id: media_player.tagesprophet + message: "Die Waschmaschine ist fertig" + language: de + +- id: backup_erfolgreich + alias: "Backup - Erfolgreich-Benachrichtigung" + description: "Benachrichtigung nach erfolgreichem Backup" + mode: single + triggers: + - trigger: state + entity_id: + - event.backup_automatic_backup + to: "completed" + actions: + - action: persistent_notification.create + metadata: {} + data: + message: "✅ Backup erfolgreich abgeschlossen um {{ now() }}" + title: "Home Assistant Backup" + +- id: backup_fehlgeschlagen + alias: "Backup - Fehlgeschlagen-Benachrichtigung" + description: "Benachrichtigung wenn Backup fehlschlägt" + mode: single + triggers: + - trigger: state + entity_id: + - event.backup_automatic_backup + to: "failed" + actions: + - action: persistent_notification.create + metadata: {} + data: + message: "❌ Backup fehlgeschlagen! Grund: {{ state_attr('event.backup_automatic_backup', 'failed_reason') }}" + title: "Home Assistant Backup - FEHLER" + - action: tts.google_translate_say + data: + entity_id: media_player.tagesprophet + message: "Das Backup ist fehlgeschlagen. Bitte überprüfe das System" + language: de \ No newline at end of file diff --git a/automations_waschmaschine.yaml b/automations_waschmaschine.yaml new file mode 100644 index 0000000..5ff9ba4 --- /dev/null +++ b/automations_waschmaschine.yaml @@ -0,0 +1,20 @@ +- id: waschmaschine_fertig + alias: "Waschmaschine - Fertig-Benachrichtigung" + description: "Sendet eine Benachrichtigung wenn die Waschmaschine fertig ist" + triggers: + - trigger: state + entity_id: switch.waschmaschine_steckdose + from: "on" + to: "off" + actions: + - action: notify.persistent_notification + metadata: {} + data: + message: "Die Waschmaschine ist fertig! 🎉" + title: "Waschmaschine" + - action: tts.cloud_say + metadata: {} + data: + entity_id: media_player.tagesprophet + message: "Die Waschmaschine ist fertig" + language: de-DE \ No newline at end of file diff --git a/cron b/cron new file mode 100644 index 0000000..9cd9bb6 --- /dev/null +++ b/cron @@ -0,0 +1,5 @@ +# Daily at 4:00 AM - sync with 3-version retention +0 4 * * * root BACKUP_DATE=$(date +\%Y-\%m-\%d) && rsync -avz -e "ssh -i /root/.ssh/id_vps -p 22" /var/lib/vz/dump/ root@159.195.46.59:/backups/homelab/$BACKUP_DATE/ >> /var/log/pve-backup-sync.log 2>&1 + +# Cleanup: keep last 3 versions (runs after sync) +0 5 * * * root ssh -i /root/.ssh/id_vps -p 22 root@159.195.46.59 "cd /backups/homelab && ls -td 2*/ | tail -n +4 | xargs -r rm -rf" 2>&1 \ No newline at end of file diff --git a/ha_areas_config.yaml b/ha_areas_config.yaml new file mode 100644 index 0000000..00a6f92 --- /dev/null +++ b/ha_areas_config.yaml @@ -0,0 +1,136 @@ +# Areas Configuration Helper +# Add to configuration.yaml or create manually via HA UI + +# Alternative: Create areas manually via Home Assistant UI: +# Settings → Areas & Zones → Add Area + +# Note: Areas must be created via UI as of HA 2025.x +# This file serves as documentation for the recommended structure + +areas: + # Recommended areas for your setup + - name: Wohnzimmer + icon: mdi:sofa + picture: + # Entities to assign later: light.*, cover.*, media_player.*, vacuum.* + + - name: Schlafzimmer + icon: mdi:bed + + - name: Küche + icon: mdi:kitchen + + - name: Badezimmer + icon: mdi:shower + + - name: Technikraum + icon: mdi:server + + - name: Arbeitszimmer + icon: mdi:desk + +# Labels configuration +labels: + - name: Energy + color: "#F1C40F" + + - name: Climate + color: "#3498DB" + + - name: Media + color: "#9B59B6" + + - name: Power + color: "#E74C3C" + + - name: Appliances + color: "#2ECC71" + + - name: Vacuum + color: "#E67E22" + +# Rename helpers - recommended entity customizations +# Add to customize.yaml in your HA config + +assistant: + name: Assistant + entity_id: media_player.assistent + +home: + entity_id: zone.home + +# Entity renames (friendly_name overrides) +# Copy to customize.yaml +sensor: + sensor.waschmaschine_steckdose_leistung: + friendly_name: "Waschmaschine Leistung" + sensor.pc_setup_leistung: + friendly_name: "PC Leistung" + sensor.tv_anlage_leistung: + friendly_name: "TV Leistung" + sensor.all_standby_energy: + friendly_name: "Gesamtverbrauch Standby" + sensor.all_standby_power: + friendly_name: "Aktuelle Leistung" + sensor.electricity_maps_co2_intensitat: + friendly_name: "CO2 Intensität" + sensor.electricity_maps_anteil_fossiler_energietrager: + friendly_name: "Anteil fossile Energie" + +light: + light.wohnzimmerlichter: + friendly_name: "Wohnzimmer Decke" + light.led_streifen: + friendly_name: "TV Hintergrund" + light.innr_fl_120_c_licht: + friendly_name: "Wohnzimmer Tischlampe" + light.leselampe: + friendly_name: "Leselampe" + light.whisky_lampe: + friendly_name: "Nachttischlampe" + light.spiegellicht: + friendly_name: "Spiegellicht" + +cover: + cover.rollos: + friendly_name: "Wohnzimmer Rollos" + cover.lumi_lumi_curtain_acn002_abdeckung: + friendly_name: "Fenster Rollos" + +switch: + switch.waschmaschine_steckdose: + friendly_name: "Waschmaschine" + switch.dobby_einschalter: + friendly_name: "Geschirrspüler" + switch.tv_anlage_steckdose: + friendly_name: "TV Strom" + switch.pc_setup_steckdose: + friendly_name: "PC Strom" + switch.server: + friendly_name: "Server" + switch.3d_drucker_steckdose: + friendly_name: "3D-Drucker" + +vacuum: + vacuum.niles: + friendly_name: "Saugroboter Niles" + +media_player: + media_player.tagesprophet: + friendly_name: "Wohnzimmer Sonos" + media_player.assistent: + friendly_name: "Multiroom Speaker" + media_player.tagesprophet_2: + friendly_name: "Wohnzimmer Sonos 2" + +sensor: + sensor.brother_mfc_l2750dw_series: + friendly_name: "Drucker" + sensor.dobby_betriebszustand: + friendly_name: "Geschirrspüler Status" + +todo: + todo.einkaufsliste_2: + friendly_name: "Einkaufsliste" + todo.kallstadt: + friendly_name: "Kallstadt Liste" \ No newline at end of file diff --git a/ha_dashboard_complete.yaml b/ha_dashboard_complete.yaml new file mode 100644 index 0000000..1c8c0d8 --- /dev/null +++ b/ha_dashboard_complete.yaml @@ -0,0 +1,281 @@ +# Home Assistant Dashboard - Complete Implementation Guide + +## Phase 1: Required Add-ons Installation + +### 1.1 Install HACS (if not installed) + +**Method A - Via Home Assistant UI:** +1. Go to **Settings** → **Add-ons** +2. Click **ADD-ON STORE** (bottom right) +3. Search for **"HACS"** or use: https://my.home-assistant.io/redirect/hacs +4. Install and start HACS +5. Complete GitHub authorization + +**Method B - Via SSH (alternative):** +```bash +wget -q -O /config/custom_components.zip https://github.com/hacs/integration/releases/latest/download/hacs.zip +unzip -o /config/custom_components.zip -d /config/ +rm /config/custom_components.zip +# Restart Home Assistant +``` + +--- + +### 1.2 Install Recommended Add-ons via HACS + +Open HACS → Frontend →搜索并安装: + +| Add-on | Version | Purpose | +|-------|---------|---------| +| **Mushroom** | Latest | Beautiful card templates | +| **button-card** | Latest | Customizable buttons | +| **card-mod** | Latest | CSS styling | +| **layout-card** | Latest | Advanced grids | +| **mini-graph-card** | Latest | Sparkline graphs | + +After installation: +1. **Settings** → **System** → **Restart Home Assistant** +2. Clear browser cache (Ctrl+Shift+R) + +--- + +## Phase 2: Area Configuration + +### 2.1 Create Areas (via UI) + +Go to **Settings** → **Areas & Zones** → **Add Area**: + +| Area Name | Icon | Entities to Add | +|----------|------|-----------------| +| **Wohnzimmer** | sofa | lights, covers, media_player | +| **Schlafzimmer** | bed | lights, climate | +| **Küche** | kitchen | dishwasher, todo | +| **Badezimmer** | shower | lights, washer | +| **Technikraum** | server | server, sensors | +| **Arbeitszimmer** | desk | pc, printer | + +--- + +## Phase 3: Device Naming Guide + +### Recommended Renames (Entity ID → Friendly Name) + +| Current | Rename To | Area | +|---------|----------|------| +| `light.wohnzimmerlichter` | Wohnzimmer Decke | Wohnzimmer | +| `light.led_streifen` | TV Hintergrund | Wohnzimmer | +| `light.innr_fl_120_c_licht` | Wohnzimmer Tischlampe | Wohnzimmer | +| `cover.rollos` | Wohnzimmer Rollos | Wohnzimmer | +| `cover.lumi_lumi_curtain_acn002` | Fenster Rollos | Wohnzimmer | +| `media_player.tagesprophet` | Wohnzimmer Sonos | Wohnzimmer | +| `switch.tv_anlage_steckdose` | TV Strom | Wohnzimmer | +| `light.leselampe` | Leselampe | Schlafzimmer | +| `light.whisky_lampe` | Nachttischlampe | Schlafzimmer | +| `switch.dobby_einschalter` | Geschirrspüler | Küche | +| `switch.dobby_extra_trocken` | Spüler Extra Trocken | Küche | +| `switch.dobby_halbe_beladung` | Spüler Halbe Ladung | Küche | +| `switch.dobby_hygiene` | Spüler Hygiene+ | Küche | +| `light.spiegellicht` | Spiegellicht | Badezimmer | +| `switch.waschmaschine_steckdose` | Waschmaschine | Badezimmer | +| `sensor.waschmaschine_steckdose_leistung` | Waschmaschine Leistung | Badezimmer | +| `switch.server` | Server | Technikraum | +| `switch.3d_drucker_steckdose` | 3D-Drucker | Technikraum | +| `switch.pc_setup_steckdose` | PC Strom | Arbeitszimmer | +| `sensor.pc_setup_leistung` | PC Leistung | Arbeitszimmer | +| `sensor.brother_mfc_l2750dw_series` | Drucker | Arbeitszimmer | +| `sensor.niles_*` | Niles (various) | Wohnzimmer | +| `vacuum.niles` | Saugroboter | Wohnzimmer | + +--- + +## Phase 4: Label Configuration + +Create labels in **Settings** → **Labels**: + +| Label | Color | Entities | +|-------|-------|----------| +| **Energy** | Yellow | power sensors | +| **Climate** | Blue | temp/humidity | +| **Media** | Purple | media players | +| **Power** | Red | switches | +| **Appliances** | Green | washer/dishwasher | +| **Vacuum** | Orange | vacuum | + +--- + +## Phase 5: Dashboard YAML + +### Complete Dashboard Configuration + +Copy the following to your `dashboards/uebersicht.yaml` or create via UI: + +```yaml +title: Übersicht +theme: minimal-light +icon: mdi:home-variant +views: + # === MAIN VIEW === + - title: Übersicht + icon: mdi:home-variant + cards: + # Header Row - Weather, Time, Quick Actions + - type: custom:mushroom-chips-card + chips: + - type: weather + entity: weather.forecast_home + - type: template + icon: mdi:clock-outline + value: "{{ now().strftime('%H:%M') }}" + - type: template + icon: mdi:thermometer + value: "{{ states('sensor.thermometer_temperatur') }}°C" + - type: template + icon: mdi:account-group + value: "{{ states('zone.home') | int }} zu Hause" + entity: zone.home + + # Row 1: Main Room Cards + - type: grid + columns: 2 + cards: + # Wohnzimmer Card + - type: custom:mushroom-entity-card + entity: light.wohnzimmerlichter + name: Wohnzimmer + icon: mdi:sofa + tap_action: + action: navigate + navigation_path: /wiewohnzimmer + features: + - type: light-brightness + + # Küche Card + - type: custom:mushroom-entity-card + entity: todo.einkaufsliste_2 + name: Küche + icon: mdi:kitchen + tap_action: + action: navigate + navigation_path: /view/kueche + + # Row 2: Climate & Appliances + - type: grid + columns: 2 + cards: + # Climate Card + - type: custom:mushroom-climate-card + entity: sensor.thermometer_temperatur + name: Innenraum + icon: mdi:thermometer + show_temperature_control: false + + # Waschmaschine + - type: custom:mushroom-entity-card + entity: switch.waschmaschine_steckdose + name: Waschmaschine + icon: mdi:washing-machine + tap_action: + action: toggle + attributes: + power: sensor.waschmaschine_steckdose_leistung + + # Geschirrspüler + - type: custom:mushroom-entity-card + entity: switch.dobby_einschalter + name: Geschirrspüler + icon: mdi:dishwasher + tap_action: + action: toggle + attributes: + state: sensor.dobby_betriebszustand + + # Saugroboter + - type: custom:mushroom-vacuum-card + entity: vacuum.niles + name: Niles + icon: mdi:robot-vacuum + + # Row 3: Energy Monitoring + - type: custom:mini-graph-card + entities: + - sensor.pc_setup_leistung + - sensor.tv_anlage_leistung + - sensor.waschmaschine_steckdose_leistung + name: Aktueller Verbrauch + hours_to_show: 24 + update_interval: 30 + + # Row 4: System Status + - type: grid + columns: 3 + cards: + # Backup Status + - type: custom:mushroom-entity-card + entity: event.backup_automatiches_backup + name: Backup + icon: mdi:backup-restore + + # Printer + - type: custom:mushroom-entity-card + entity: sensor.brother_mfc_l2750dw_series + name: Drucker + icon: mdi:printer + + # Server + - type: custom:mushroom-entity-card + entity: switch.server + name: Server + icon: mdi:server + + # === ENERGY VIEW === + - title: Energie + icon: mdi:flash + cards: + - type: grid + columns: 2 + cards: + - type: gauge + name: Aktueller Verbrauch + entity: sensor.all_standby_power + min: 0 + max: 500 + unit: W + + - type: statistic + name: Heute (kWh) + entity: sensor.pc_setup_energie_kwh + stat_type: change + period: day + + - type: history-graph + entities: + - sensor.pc_setup_leistung + - sensor.tv_anlage_leistung + - sensor.waschmaschine_steckdose_leistung + name: Verbrauch Over Time + + # === SYSTEM VIEW === + - title: System + icon: mdi:cog + cards: + - type: grid + columns: 2 + cards: + - type: entity + entity: sensor.backup_nachstes_geplantes_automatiches_backup + name: Nächster Backup + + - type: entity + entity: sensor.backup_letztes_erfolgreiches_automatiches_backup + name: Letzter Backup + + - type: entity + entity: update.home_assistant_core_update + name: HA Update + + - type: entities + name: WLAN Status + entities: + - binary_sensor.archer_ax55_wan_status + - sensor.archer_ax55_download_geschwindigkeit + - sensor.archer_ax55_upload_geschwindigkeit \ No newline at end of file diff --git a/lovelace_uebersicht.yaml b/lovelace_uebersicht.yaml new file mode 100644 index 0000000..a6d2cc5 --- /dev/null +++ b/lovelace_uebersicht.yaml @@ -0,0 +1,418 @@ +# ============================================================================= +# Home Assistant Dashboard - OVERSICHT +# A modern, minimal-light dashboard with full energy monitoring +# ============================================================================= +# Installation: Copy content to your dashboards YAML or configure via UI +# ============================================================================= + +title: Übersicht +theme: frontend +icon: mdi:home-variant + +# Cache config for performance +stack: + horizontal: false + +# Views (tabs) +views: + # ----------------------------------------------------------------------------- + # VIEW 1: UBERSICHT (Main Dashboard) + # ----------------------------------------------------------------------------- + - title: Übersicht + icon: mdi:home-variant + path: overview + badges: + - entity: zone.home + name: Zu Hause + - entity: weather.forecast_home + name: Wetter + - entity: sensor.thermometer_temperatur + name: Temperatur + - entity: sensor.electricity_maps_anteil_fossiler_energietrager + name: CO2 + + cards: + # ------------------------------------------------------------------------- + # ROW 0: Header (Weather + Time + Quick Stats) - Custom: Mushroom Chips + # ------------------------------------------------------------------------- + - type: custom:mushroom-chips-card + chips: + - type: weather + entity: weather.forecast_home + show-label: true + - type: template + icon: mdi:thermometer + value: "{{ states('sensor.thermometer_temperatur') }}°" + - type: template + icon: mdi:water-percent + value: "{{ states('sensor.thermometer_luftfeuchtigkeit') }}%" + - type: template + icon: mdi:account-group-outline + value: "{{ states('zone.home') | int }} Pers." + - type: template + icon: mdi:flash + value: "{{ states('sensor.all_standby_power') | round(0) }}W" + + # ------------------------------------------------------------------------- + # ROW 1: Living Room + Kitchen (2 columns) + # ------------------------------------------------------------------------- + - type: grid + columns: 2 + square: true + cards: + # --- Wohnzimmer Tile --- + - type: tile + entity: light.wohnzimmerlichter + name: Wohnzimmer + icon: mdi:ceiling-light + show_state: true + tap_action: + action: call-service + service: light.turn_on + service_data: + entity_id: light.wohnzimmerlichter + longPress_action: + action: navigate + navigation_path: /lovelace/wohnzimmer + features: + - type: light-brightness + - type: light-color-temp + + # --- Küche / Einkaufsliste Tile --- + - type: tile + entity: todo.einkaufsliste_2 + name: Einkaufsliste + icon: mdi:cart + show_state: true + tap_action: + action: navigate + navigation_path: /lovelace/kueche + + # ------------------------------------------------------------------------- + # ROW 2: Climate + Media (2 columns) + # ------------------------------------------------------------------------- + - type: grid + columns: 2 + square: true + cards: + # --- Temperature Card --- + - type: tile + entity: sensor.thermometer_temperatur + name: Innenraum + icon: mdi:thermometer + show_state: true + state_content: "{{ states('sensor.thermometer_temperatur') }}°C / {{ states('sensor.thermometer_luftfeuchtigkeit') }}%" + + # --- Vacuum Status --- + - type: tile + entity: vacuum.niles + name: Niles + icon: mdi:robot-vacuum + show_state: true + + # ------------------------------------------------------------------------- + # ROW 3: Lights Quick Control (Grid - 4 columns) + # ------------------------------------------------------------------------- + - type: grid + columns: 4 + square: false + cards: + - type: button + entity: light.wohnzimmerlichter + name: Decke + icon: mdi:ceiling-light + tap_action: + action: toggle + - type: button + entity: light.led_streifen + name: TV Licht + icon: mdi:television + tap_action: + action: toggle + - type: button + entity: cover.rollos + name: Rollos + icon: mdi:blinds + tap_action: + action: toggle + - type: button + entity: scene.fernsehabend + name: Film + icon: mdi:movie + tap_action: + action: activate + + # ------------------------------------------------------------------------- + # ROW 4: Appliances (2 columns) + # ------------------------------------------------------------------------- + - type: grid + columns: 2 + square: true + cards: + # --- Waschmaschine --- + - type: tile + entity: switch.waschmaschine_steckdose + name: Waschmaschine + icon: mdi:washing-machine + show_state: true + tap_action: + action: toggle + attributes: + Leistung: sensor.waschmaschine_steckdose_leistung + + # --- Geschirrspüler --- + - type: tile + entity: switch.dobby_einschalter + name: Geschirrspüler + icon: mdi:dishwasher + show_state: true + tap_action: + action: toggle + + # ------------------------------------------------------------------------- + # ROW 5: Energy - Current Usage (Full width) + # ------------------------------------------------------------------------- + - type: grid + columns: 3 + square: false + cards: + # --- PC Power --- + - type: tile + entity: sensor.pc_setup_leistung + name: PC + icon: mdi:desktop-tower-monitor + show_state: true + state_content: "{{ states('sensor.pc_setup_leistung') | round(1) }}W" + + # --- TV Power --- + - type: tile + entity: sensor.tv_anlage_leistung + name: TV + icon: mdi:television + show_state: true + state_content: "{{ states('sensor.tv_anlage_leistung') | round(1) }}W" + + # --- Waschmaschine Power --- + - type: tile + entity: sensor.waschmaschine_steckdose_leistung + name: Waschmaschine + icon: mdi:washing-machine + show_state: true + state_content: "{{ states('sensor.waschmaschine_steckdose_leistung') | round(1) }}W" + + # ------------------------------------------------------------------------- + # ROW 6: Server & Network (2 columns) + # ------------------------------------------------------------------------- + - type: grid + columns: 2 + square: true + cards: + # --- Server --- + - type: tile + entity: switch.server + name: Server + icon: mdi:server + show_state: true + tap_action: + action: toggle + + # --- Network Status --- + - type: tile + entity: binary_sensor.archer_ax55_wan_status + name: Netzwerk + icon: mdi:router-wireless + show_state: true + state_content: "{{ states('binary_sensor.archer_ax55_wan_status') }} | {{ states('sensor.archer_ax55_download_geschwindigkeit') | round(0) }} Mbps" + + # ----------------------------------------------------------------------------- + # VIEW 2: ENERGIE (Energy Monitoring) + # ----------------------------------------------------------------------------- + - title: Energie + icon: mdi:flash + path: energie + + cards: + # Current Overview - 2x2 grid + - type: grid + columns: 2 + square: true + cards: + # Total Power Now + - type: gauge + name: Aktuelle Leistung + entity: sensor.all_standby_power + min: 0 + max: 1000 + unit: W + detail: 1 + + # Today's Usage + - type: sensor + entity: sensor.pc_setup_energie_kwh + name: PC heute + icon: mdi:desktop-tower-monitor + graph: line + + # TV Usage + - type: sensor + entity: sensor.tv_anlage_energie_kwh + name: TV heute + icon: mdi:television + graph: line + + # Waschmaschine Usage + - type: sensor + entity: sensor.waschmaschine_steckdose_summe_verbraucht + name: Waschmaschine gesamt + icon: mdi:washing-machine + graph: line + + # Historical Graph + - type: history-graph + title: Verbrauch (24h) + entities: + - sensor.pc_setup_leistung + - sensor.tv_anlage_leistung + - sensor.waschmaschine_steckdose_leistung + - sensor.3d_drucker_steckdose_leistung + hours_to_show: 24 + + # Energy Mix + - type: grid + columns: 2 + cards: + - type: sensor + entity: sensor.electricity_maps_anteil_fossiler_energietrager + name: Fossiler Anteil + icon: mdi:factory + unit: "%" + graph: line + + - type: sensor + entity: sensor.electricity_maps_co2_intensitat + name: CO2 Intensität + icon: mdi:molecule-co2 + unit: g/kWh + graph: line + + # ----------------------------------------------------------------------------- + # VIEW 3: GERATE (Devices) + # ----------------------------------------------------------------------------- + - title: Geräte + icon: mdi:devices + path: gerate + + cards: + # All Lights + - type: entities + title: Lichter + show_header_toggle: true + entities: + - light.wohnzimmerlichter + - light.led_streifen + - light.innr_fl_120_c_licht + - light.leselampe + - light.whisky_lampe + - light.spiegellicht + + # All Switches (Power) + - type: entities + title: Steckdosen + show_header_toggle: true + entities: + - switch.server + - switch.waschmaschine_steckdose + - switch.dobby_einschalter + - switch.tv_anlage_steckdose + - switch.pc_setup_steckdose + - switch.3d_drucker_steckdose + - switch.stereoanlage_steckdose + + # Covers + - type: entities + title: Rollos & Jalousien + show_header_toggle: true + entities: + - cover.rollos + - cover.lumi_lumi_curtain_acn002_abdeckung + + # Media Players + - type: entities + title: Media Player + show_header_toggle: true + entities: + - media_player.tagesprophet + - media_player.tagesprophet_2 + - media_player.assistent + + # ----------------------------------------------------------------------------- + # VIEW 4: SYSTEM + # ----------------------------------------------------------------------------- + - title: System + icon: mdi:cog + path: system + + cards: + # Backup Status + - type: entities + title: Backup + entities: + - entity: sensor.backup_backup_manager_zustand + name: Status + - entity: sensor.backup_letztes_erfolgreiches_automatiches_backup + name: Letztes erfolgreiches Backup + - entity: sensor.backup_nachstes_geplantes_automatiches_backup + name: Naechstes geplantes Backup + + # Updates + - type: entities + title: Updates + entities: + - entity: update.home_assistant_core_update + name: Home Assistant + - entity: update.home_assistant_operating_system_update + name: OS + - entity: update.hacs_update + name: HACS + + # Printer Status + - type: entities + title: Drucker + entities: + - entity: sensor.brother_mfc_l2750dw_series + name: Status + - entity: sensor.brother_mfc_l2750dw_verbleibender_schwarz_toner + name: Schwarz + + # Vacuum Stats + - type: entities + title: Saugroboter + entities: + - entity: sensor.niles_status + name: Status + - entity: sensor.niles_cleaning_time + name: Letzte Reinigung + - entity: sensor.niles_cleaned_area + name: Gereinigte Flaeche + - entity: sensor.niles_total_cleaning_time + name: Gesamtzeit + - entity: sensor.niles_battery_level + name: Akku + + # ----------------------------------------------------------------------------- + # VIEW 5: TODO (Shopping Lists) + # ----------------------------------------------------------------------------- + - title: Listen + icon: mdi:format-list-checks + path: listen + + cards: + # Einkaufsliste + - type: todo-list + title: Einkaufsliste + entity: todo.einkaufsliste_2 + + # Kallstadt + - type: todo-list + title: Kallstadt + entity: todo.kallstadt \ No newline at end of file diff --git a/opencode.json b/opencode.json new file mode 100644 index 0000000..eaac61b --- /dev/null +++ b/opencode.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://opencode.ai/config.json", + "plugin": ["opencode-vibeguard"] +} \ No newline at end of file -- 2.47.3