Guidance for AI coding agents working on this repository. Human contributors: see CONTRIBUTING.
A Home Assistant custom integration (distributed through HACS) that reads Omnik
solar inverters, and compatible brands, over the local network. Domain:
omnik_inverter. The inverter communication lives in the
omnikinverter
library, which is maintained in another repository: fix library issues there,
not with workarounds here.
custom_components/omnik_inverter/
__init__.py setup, unload, registry migrations, inverter device
config_flow.py user (JS/JSON/HTML/TCP), reconfigure and options flow
coordinator.py DataUpdateCoordinator polling inverter and Wi-Fi module
models.py base entity and device info
sensor.py, binary_sensor.py, diagnostics.py
strings.json, translations/{en,nl,de}.json, icons.json, brand/
tests/ pytest-homeassistant-custom-component tests
uv sync # create .venv with Home Assistant and dev tools
uv run prek install # git hook running all checks on commit
uv run prek run --all-files # Ruff, mypy, pylint, codespell, yamllint, ...
uv run pytest # tests; CI requires 90% coverageRun all hooks and tests before committing. The hooks refuse commits to main;
work on a branch.
- Python 3.14.2+ and Home Assistant 2026.10.0+ (
hacs.json, README). Only raise the minimum on purpose and update both. pytest-homeassistant-custom-componentpins the Home Assistant version used for development, typing and tests.tests-beta.yamltests weekly against the Home Assistant beta.- The manifest pins
omnikinverter==1.0.0;pyproject.tomluses the same.
- Typing: mypy runs in strict mode from
pyproject.tomlagainst the real Home Assistant types. Useprobatiofor schemas (Home Assistant's validation library since 2026.9), notvoluptuous. - Entities:
_attr_has_entity_name = Truewith atranslation_key; never setentity_id. Icons belong inicons.json. - Translations: Home Assistant loads
translations/*.jsonfor custom integrations. When changingstrings.json, updateen,nlanddetoo. - Devices: the Wi-Fi module is a child device (
ChildDeviceInfo) of the inverter, whichasync_setup_entryregisters first. - Unique IDs:
slugify(f"{entry_id}_{service}_{key}"). Users keep their entities and history only while unique IDs stay stable; when one has to change, migrate it in_async_migrate_entitiesand test the migration. - Reloading: use
OptionsFlowWithReloadandasync_update_reload_and_abort. Do not add a config entry update listener next to these; Home Assistant 2026.12 rejects that combination. - Diagnostics: redact credentials, serial numbers and IP addresses.
tests/conftest.pymocksOmnikInverter.inverter()and.device(); no test talks to a real inverter.conftest.pyimportscustom_components.omnik_inverterup front, because pytest-homeassistant-custom-component ships its owncustom_componentspackage. Keep that import.- Add a test for every bug fix that fails without the fix.
- Every pull request needs one of these labels:
breaking-change,bugfix,hotfix,documentation,enhancement,refactor,performance,new-feature,maintenance,ci,dependencies,skip-changelog. - Release Drafter derives the next version from the labels
(
breaking-change→ major). Bumpversioninmanifest.jsonandpyproject.tomlto match before a release. - Renovate keeps dependencies up to date and automerges minor and patch updates.