energy
/energy
Analizuje dane energetyczne Home Assistant: zużycie, produkcję solarną, baterię i koszty sieci, oraz bezpiecznie edytuje źródła panelu Energy przez HA NOVA Relay.
- Autor
- markusleben ↗
- Repozytorium
- ha-nova ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 27.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Analizuje dane energetyczne Home Assistant: zużycie, produkcję solarną, baterię i koszty sieci, oraz bezpiecznie edytuje źródła panelu Energy przez HA NOVA Relay.
Oryginalny opis (EN)
Use when analyzing Home Assistant energy data — consumption, solar production, battery, grid costs, per-device usage — or safely editing Energy dashboard sources and tracked devices through HA NOVA Relay.
Jak działa
- Scope
- Bootstrap (once per session)
- Relay Contract
- Flow
- Error Handling
- Output Format
- Safety
Podgląd SKILL.md
---
name: energy
description: Use when analyzing Home Assistant energy data — consumption, solar production, battery, grid costs, per-device usage — or safely editing Energy dashboard sources and tracked devices through HA NOVA Relay.
license: MIT
compatibility: Requires the ha-nova CLI (run 'ha-nova setup' first) and the HA NOVA Relay in Home Assistant (App, or standalone container on Container/Core).
---
# HA NOVA Energy
## Scope
Analysis (read-only):
- energy config overview + misconfiguration triage (`energy/validate`)
- consumption/production/cost reports over bounded periods
- per-device ranking and cost (fixed or dynamic prices)
- solar/battery/grid KPIs: self-sufficiency, self-consumption, battery round-trip
- period comparisons (previous period, same period last year)
Config (gated writes):
- add/update/remove energy sources and tracked devices via `energy/save_prefs`
Not in scope:
- dashboard cards/views (`ha-nova:dashboard`)
- generic entity history/logbook (`ha-nova:history`)
- statistics repair (sum spikes, orphaned statistics): `ha-nova:maintenance`
- creating sensors or integrations that produce new energy data (energy sensor from a power sensor → `ha-nova:helper`, type `integration`)
## Bootstrap (once per session)
Read and follow `../ha-nova/session-bootstrap.md`.
Verify relay CLI: `ha-nova relay health`
If this fails: `ha-nova setup`
## Relay Contract
File-based requests: `ha-nova relay ws --data-file <payload-file>`; `--out <result-file>` for large responses. WS body: `.data` (`../ha-nova/relay-api.md` → Standard Envelope).
Schemas, KPI formulas, and analysis recipes: `../energy/energy-reference.md` — read it before any config write or KPI computation.
## Flow
### Overview
WS `{"type":"energy/get_prefs"}` → sources + tracked devices. Error `ERR_NOT_FOUND` ("No prefs") means the dashboard was never configured — offer initial setup instead of failing. Report grouped: sources first (grid/solar/battery/gas/water), then devices (count + notable entries). Run WS `{"type":"energy/validate"}` in the same pass; its issue lists are parallel to config order — map every issue to its source/device and name the concrete fix (issue table in the reference).
### Analysis
Resolve statistic IDs from prefs, then query `recorder/statistics_during_period` with `types:["change"]` and `units:{"energy":"kWh"}` over a bounded window (default: last 30 days). Follow the statistics contract in the reference exactly: HA-local day boundaries (weeks start Monday), ms-epoch timestamps, missing buckets count as 0, negative change is legal, `5minute` period only reaches back ~10 days.
Compute KPIs with the formulas in the reference so numbers match the HA UI; label documented approximations as such. Present cost figures as estimates — HA cost math never equals the utility bill (standing charges, VAT, official metering).
Never: diff raw `total_increasing` states (use statistics `change`), report peak watts from energy-only statistics (only hourly averages exist — say so), present a partial day/month as a complete period (label it and compare like-for-like), or rebuild an EV manager's session history (evcc and similar expose their own statistics entities — read those).
### Config edit (read → merge → save)
1. Fresh `energy/get_prefs` immediately before composing the save — never reuse an earlier read.
2. Detect the grid schema generation from the data (`flow_from` present = legacy nested; flat keys = HA 2026.3+). Emit the same generation; never mix. With no existing grid source to detect from, pick by HA version (`GET /api/config` → `version`; 2026.3+ = flat, else legacy). Preserve every field you do not edit verbatim, including unknown keys (`power_config`, `stat_soc`, `name`).
3. Mutate the returned list. `save_prefs` replaces the entire list for every key present — send only the top-level keys you touched, each as its complete list (canonical payload in the reference).
4. Preview the planned change: the exact entries added/changed/removed plus the count invariant (count before ± changes = count after). Say explicitly: removing a device stops tracking only — its recorded statistics stay.
5. End the turn with this preview; confirmation binds to it (context skill → Active Preview Confirmation): natural for a single add/change/remove; a save that empties or wholesale-replaces a list on a configured instance is destructive — one-time code (context skill → Confirmation Tiers). Before any save that REMOVES entries (a single source/device removal included) or empties/wholesale-replaces a list, capture the auto config snapshot of the fresh pre-save `get_prefs` read (category `energy`, fixed name `auto-prefs` — the prefs are one document without item ids; `../ha-nova/config-snapshots.md`; on capture failure follow its capture-failure stop). Then run the drift check before applying (`../ha-nova/write-safety.md` → Drift check before apply): re-read `get_prefs` immediately before the save and compare it against the basis this preview was composed from. On first-time setup the basis is absence: a second `ERR_NOT_FOUND` means nothing changed and the save proceeds, while prefs that exist now expire the confirmation. On any other foreign change STOP — the confirmation expired, recompose and preview again. `save_prefs` replaces whole lists with no locking, so a source another client added in the meantime would vanish without a trace. Then WS `energy/save_prefs` (fails unless the App's configured HA token has admin rights).
6. Verify: re-read `get_prefs` (the save response echoes the new prefs — still re-read), confirm the invariant and that every untouched entry is deep-equal to the fresh pre-save read, then run `energy/validate` — a successful save does NOT prove the config works (dangling statistic IDs are accepted silently). Mention that other open dashboard tabs need a reload.
Initial setup after `ERR_NOT_FOUND`: treat every list as empty — compose only the keys being populated (count before = 0) and continue at step 4.
Write guards (schema details in the reference):
- every grid source needs `cost_adjustment_day` (default `0`); at most one of `entity_energy_price`/`number_energy_price` per direction
- never set price fields on an external statistic (`:` in the ID) unless `stat_cost` is already set — HA 2026.4+ rejects the save
- never invent `stat_cost` — leave it `null` with a price field set and HA creates the cost sensor itself; resolve actual cost statistics via `energy/info` → `cost_sensors`
- `included_in_stat` must reference a `stat_consumption` present in the same list, without cycles — HA does not validate this
- referenced statistics must exist (`recorder/list_statistic_ids`), should belong to a live entity (validate reports `entity_not_defined` otherwise), and must meet the sensor prerequisites in the issue table
## Error Handling
- `ERR_NOT_FOUND` on `get_prefs`: unconfigured dashboard, not a failure.
- Save rejected: report HA's message verbatim; re-read prefs before any retry — another client may have written meanwhile.
- Full relay error taxonomy: `../ha-nova/relay-api.md` → Error Handling.
## Output Format
Apply `../ha-nova/output-rules.md`: plain words, HA names verbatim; unless asked or names clash, no ids, "entity", modes, Relay/HA URLs, snapshots, raw JSON. Previews, deletes, and results use the Cards defined there (`../ha-nova/output-cards.md`).
- `Energy` / `Status`
- `Planned change`
- `Options`
- `Verification`
- `Next step`
Use stable localized slot labels in this order; omit empty slots. Analysis answers render the Report shape; rankings render the List Frame (output-cards.md) — never raw JSON.
## Safety
- Preview before write. The only exception is a call that `ha-nova call` itself executed as `tier: ordinary`; everything else waits for the user's confirmation of the shown preview. High-consequence actions (e.g. unlocking or opening a lock, opening a gate, garage, or entry door, disarming the alarm — also through a scene or script) and deletes or other destructive operations need the user's window click or phone tap, else their one-time code from HA NOVA; "yes" or any other reply is invalid.
- Confirmation binds to the displayed preview; any target, payload, endpoint, or scope change voids it (context skill → Active Preview Confirmation).
- Relay a plan's `say` in full, localized; never drop or shorten sentences.
- Anything before the preview ("do it", answers to questions) never confirms it; only a reply to the preview does.
- Never guess entity, service, or config IDs — resolve them or ask.
- Home Assistant is reached exclusively through the `ha-nova` CLI.
- Any HA write this skill does not cover: STOP, invoke `ha-nova:fallback` first; never probe unfamiliar write endpoints.
- Drafts follow `../ha-nova/smallest-solution.md`: the complete requested outcome in the simplest safe design, nothing speculative.
- Config writes: preview + confirmation per save (natural for single edits; one-time code for empty/wholesale-replace saves — step 5); verify by read-back + validate.
- No update-revert — recovery after an entry-removing save is the `auto-prefs` config snapshot (restore = corrective `save_prefs` of the loaded document, `../ha-nova/config-snapshots.md`); otherwise a corrective save or HA Backups (see `../ha-nova/write-safety.md`).
- Analysis flows are strictly read-only; never call `save_prefs` while answering an analysis question.
Pliki w paczce (2)
- SKILL.md 9 KB
- energy-reference.md 10 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · markusleben/ha-nova | 100 | MIT |
| peterbamuhigire/proposal-skills | 100 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki d774a6851079 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100scene
Odczytuje, tworzy, zmienia i usuwa sceny Home Assistant w magazynie przez HA NOVA Relay. - 100calendar
Wyświetla, odczytuje, tworzy, aktualizuje i usuwa wydarzenia kalendarza Home Assistant przez HA NOVA Relay. - 90energy-systems
Analizuje systemy energetyczne: potencjał odnawialnych źródeł, modele sieci, optymalizację magazynów energii i ocenę techniczno-ekonomiczną. - 100pilot-energy-grid-optimizer-setup
Wdraża system optymalizacji sieci energetycznej z czterema agentami: monitoring, prognozowanie, optymalizacja i sterowanie urządzeniami, w tym prognozy popytu i harmonogram baterii. - 90ha-statistics-repair
Naprawia lub uzupełnia długoterminowe statystyki Home Assistant po błędach liczników, bez psucia panelu energii. - 100smart-grid-telemetry-iot
Zbiera, przetwarza i analizuje telemetrię IoT inteligentnych sieci energetycznych z paneli PV, wiatru, magazynów BESS i liczników, łącząc pakiety Modbus TCP i IEC 61850 oraz licząc stan naładowania.