mirror of
https://github.com/NickoScope/nickol-knx-mcp.git
synced 2026-09-29 19:31:12 +02:00
Design-time MCP server that reads .knxproj (read-only), validates naming/DPT/status, and generates Home Assistant KNX YAML + ETS-importable group addresses (XML/CSV). No live bus access — confined-workspace writes only. Includes: 12 MCP tools, end-to-end smoke test, MIT license, English-first README (+ Russian), CONTRIBUTING with a real-project test call, SECURITY policy, CHANGELOG, GitHub Actions CI (Python 3.10–3.12), and issue/PR templates. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.6 KiB
3.6 KiB
ETS / KNX Assistant — project rules
This file is the design playbook for working on this KNX project with the
nickol-knx MCP server. Claude Code loads it automatically as project context.
Apply these rules when reading the .knxproj, generating Home Assistant config,
or producing ETS group-address exports.
Hard safety rules
- Never propose writing to a live KNX bus. The
nickol-knxserver has no bus access; keep it that way. Live control happens only through the Home Assistant layer, and only when the user explicitly asks. - Always generate a Markdown report (
project_report) and let the user read it before any import into ETS or deploy into Home Assistant. - All generated files go into the Git-tracked workspace. Commit before and after changes so every step is reversible.
Two-layer architecture
- KNX (ETS) owns foundational logic and runs autonomously. The integrator
programs it. Treat the
.knxprojas the source of truth for addresses + DPTs. - Home Assistant is the upper smart layer (automations, templates). HA must read real device state, never assume it.
Group address structure (3-level Main/Middle/Sub)
- Main group = function domain. Suggested split:
0 Central/Scenes · 1 Lighting · 2 Shutters/Blinds · 3 HVAC · 4 Sensors · 5 Energy · 6 Diagnostics · 7 Reserve. - Middle group = sub-function or zone (e.g. Switch / Dimming / Status / Position).
- Keep commands and status in distinct, predictable middle groups (e.g.
command in
.../0/..., feedback in.../4/...). The pairing engine matches by name tokens, so consistent naming matters more than adjacency. - Reserve address space in every range; never pack ranges 100%.
Command / status pairs (the most important rule)
- Every controllable actuator must have a status object. A switch needs a
state GA; a dimmer needs a brightness-state GA; a blind needs position + position
state.
check_missing_statusflags anything without one. - HA entities must have a
state_address(or*_state_address) wherever the KNX device can report it. No status = HA shows stale/guessed state.
DPT discipline
- Every GA must have a DPT set. Missing DPT is a hard error (
check_dpt): HA cannot decode it. - Same logical name → same DPT. Inconsistent DPTs across same-named GAs are a bug.
- Common DPTs: switch
1.001, status1.011, up/down1.008, stop1.010, dimming3.007, brightness/position5.001, temperature9.001, humidity9.007, CO₂/ppm9.008, lux9.004, energy kWh13.013, power W14.056, scene17.001/18.001, HVAC mode20.102.
Naming
- Names encode zone + function (e.g. "Kitchen ceiling light switch",
"Bedroom blind position status"). The status keyword (
status/state/статус/Rückmeldung) is what lets the engine pair feedback to its command. - No empty names, no duplicates. Main and middle ranges get descriptive names.
Category separation
Keep these domains in their own ranges and HA platforms: lighting, dimming, shutters, HVAC, sensors, scenes, energy, diagnostics.
KNX Secure
- When KNX Data Secure / IP Secure is enabled, secure tunneling needs the ETS
Keyring export (
.knxkeys). Exports from this tool carry theSecurityflag per GA; the keyring itself is handled in ETS/HA, never by this server.
Typical workflow
load_projectthe.knxproj.analyze_all→ fix 🔴 errors in ETS, add missing status GAs.project_report→ human review.generate_ets_group_addresses(xml) → import into ETS for any new GAs.generate_ha_package→ review YAML → deploy to Home Assistant.- Commit every artifact to Git.