node-red-contrib-knx-ultimate 6.3.22 → 6.3.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/examples/IoT Bridge - Modbus Flex Adapter.json +361 -0
  3. package/examples/KNX AI - Telegrambot Direct Chat.json +1 -17
  4. package/nodes/knxUltimate-config.js +13 -4
  5. package/nodes/knxUltimateAI.html +142 -15
  6. package/nodes/knxUltimateAI.js +734 -163
  7. package/nodes/knxUltimateIoTBridge.html +349 -20
  8. package/nodes/knxUltimateIoTBridge.js +474 -44
  9. package/nodes/locales/de/knxUltimateAI.html +26 -8
  10. package/nodes/locales/de/knxUltimateAI.json +11 -1
  11. package/nodes/locales/de/knxUltimateIoTBridge.html +28 -2
  12. package/nodes/locales/de/knxUltimateIoTBridge.json +20 -2
  13. package/nodes/locales/en/knxUltimateAI.html +26 -8
  14. package/nodes/locales/en/knxUltimateAI.json +11 -1
  15. package/nodes/locales/en/knxUltimateIoTBridge.html +28 -2
  16. package/nodes/locales/en/knxUltimateIoTBridge.json +20 -2
  17. package/nodes/locales/es/knxUltimateAI.html +26 -8
  18. package/nodes/locales/es/knxUltimateAI.json +11 -1
  19. package/nodes/locales/es/knxUltimateIoTBridge.html +28 -2
  20. package/nodes/locales/es/knxUltimateIoTBridge.json +20 -2
  21. package/nodes/locales/fr/knxUltimateAI.html +26 -8
  22. package/nodes/locales/fr/knxUltimateAI.json +11 -1
  23. package/nodes/locales/fr/knxUltimateIoTBridge.html +28 -2
  24. package/nodes/locales/fr/knxUltimateIoTBridge.json +20 -2
  25. package/nodes/locales/it/knxUltimateAI.html +26 -8
  26. package/nodes/locales/it/knxUltimateAI.json +11 -1
  27. package/nodes/locales/it/knxUltimateIoTBridge.html +28 -2
  28. package/nodes/locales/it/knxUltimateIoTBridge.json +20 -2
  29. package/nodes/locales/zh-CN/knxUltimateAI.html +26 -8
  30. package/nodes/locales/zh-CN/knxUltimateAI.json +11 -1
  31. package/nodes/locales/zh-CN/knxUltimateIoTBridge.html +28 -2
  32. package/nodes/locales/zh-CN/knxUltimateIoTBridge.json +20 -2
  33. package/nodes/plugins/knxUltimateAI-vue/assets/app.css +1 -1
  34. package/nodes/plugins/knxUltimateAI-vue/assets/app.js +4 -4
  35. package/nodes/utils/knxAiChatContext.js +181 -84
  36. package/nodes/utils/knxAiEventHistory.js +275 -0
  37. package/package.json +3 -3
  38. package/resources/KNXAIChatAdapterMappings.js +14 -12
@@ -25,9 +25,13 @@ Dauert die Verarbeitung länger als 1,2 Sekunden, sendet Ausgang 3 sofort die lo
25
25
 
26
26
  Anfragen an Ollama und Bionic LM Studio verwenden automatisch ein Mindest-Timeout von 10 Minuten; Cloud-Anbieter behalten mindestens 2 Minuten. Im Editor muss kein Timeout-Feld gepflegt werden. Wird selbst das lokale Limit erreicht, meldet KNX AI, dass das Modell die Antwort nicht abgeschlossen hat, und empfiehlt einen neuen Versuch oder einen kleineren Prompt-Kontext.
27
27
 
28
+ Für lokale Anbieter lässt sich mit **Chat-Kontextmenge** ausdrücklich zwischen 4K, 8K und 16K wählen; 16K bleibt der Standard. Die Auswahl begrenzt KNX-, Speicher-, Node-RED-Projekt- und Adapterdaten proportional, während der vollständige Werkzeugvertrag des Agenten erhalten bleibt. Fähigkeiten werden niemals anhand von Formulierungen, Schlüsselwörtern oder sprachlichen Intents aktiviert oder deaktiviert.
29
+
28
30
  Der Node-Status im Canvas ist bewusst ausschließlich für die letzte eingehende Anfrage und den lokalisierten Zustand „Ich denke nach…“ während der LLM-Ausführung reserviert. KNX-Telegramme, Gateway-Aktualisierungen, Verkehrsraten, Bereitschaftsmeldungen und technische Ergebnisse überschreiben ihn nie; sie bleiben über Ausgänge, Logs und Assistentendaten verfügbar.
29
31
 
30
- Jede Ask-/Chat-Sitzung speichert ihre letzten 8 Gesprächsschritte und bis zu 20 ausdrücklich langfristige Anweisungen, getrennt nach `msg.knxAi.sessionId`, `msg.sessionId` oder erkannter Telegram-Chat-ID. Aufforderungen wie „Merk dir, den Begriff unknown nicht zu verwenden“ werden dauerhaft gespeichert. Alle KNX-AI-Nodes mit demselben Speicher teilen diesen Kontext live und laden ihn nach einem Node-RED-Neustart aus `knxultimatestorage/knxai/memory/knxai-chat-context.md`. Die atomar geschriebene Datei ist auf 50 Sitzungen und 512 KB begrenzt. Bei aktiviertem KNX-Steuern Ausgang 3 mit dem Chat-Sender und Ausgang 4 mit einem KNX-Ultimate-Node im **Universalmodus** verbinden. Bei aktiver Bestätigung zeigt die erste Antwort GA, DPT und Payload, ohne Schreiboperationen auszugeben; dieselbe Sitzung muss innerhalb von 5 Minuten `BESTÄTIGEN` oder `ABBRECHEN` antworten. Eine neue Anfrage ersetzt einen älteren Plan. Jeder bestätigte Befehl enthält `msg.destination`, `msg.dpt`, `msg.payload` und `msg.event = "GroupValue_Write"`.
32
+ Jede Ask-/Chat-Sitzung speichert ihre letzten 8 Gesprächsschritte und bis zu 20 vom Modell ausgewählte langfristige Anweisungen, getrennt nach `msg.knxAi.sessionId`, `msg.sessionId` oder erkannter Telegram-Chat-ID. Das Modell entscheidet semantisch über das strukturierte Gedächtniswerkzeug, was aus einem Gespräch gespeichert oder vergessen werden soll; es gibt keine sprachliche Schlüsselwort- oder Intent-Liste. Alle KNX-AI-Nodes mit demselben Speicher teilen diesen Kontext live und laden ihn nach einem Node-RED-Neustart aus `knxultimatestorage/knxai/memory/knxai-chat-context.knxctx`. Die atomar geschriebene Datei ist auf 50 Sitzungen und 512 KB begrenzt. Bei aktiviertem KNX-Steuern Ausgang 3 mit dem Chat-Sender und Ausgang 4 mit einem KNX-Ultimate-Node im **Universalmodus** verbinden. Bei aktiver Bestätigung zeigt die erste Antwort GA, DPT und Payload, ohne Schreiboperationen auszugeben; dieselbe Sitzung muss innerhalb von 5 Minuten `BESTÄTIGEN` oder `ABBRECHEN` antworten. Eine neue Anfrage ersetzt einen älteren Plan. Jeder bestätigte Befehl enthält `msg.destination`, `msg.dpt`, `msg.payload` und `msg.event = "GroupValue_Write"`.
33
+ Der aktuelle Sitzungsspeicher steht unmittelbar neben der aktuellen Anfrage, damit lokale Modelle vom Benutzer angegebene Fakten wie bevorzugten Namen oder Sprache auch in einem großen KNX-Prompt behalten. Das Modell kann dauerhafte Fakten, Vorlieben und Anweisungen über `memoryActions` speichern; dies bleibt eine semantische Werkzeugwahl ohne Phrasenklassifizierer oder Intent-Routing. Zugangsdaten, Sicherheitscodes und API-Schlüssel dürfen niemals gelernt werden.
34
+
31
35
  Bei DPT-1.xxx-Schreibvorgängen werden die sicheren KI-Entsprechungen `true`/`false`, `1`/`0` und `on`/`off` vor der lokalen Validierung und Ausgabe in echte Boolesche Werte normalisiert.
32
36
 
33
37
  ### Aktuelle KNX-Lesewerte
@@ -42,24 +46,38 @@ Solange ein Plan aussteht, enthält Ausgang 3 `msg.knxAi.confirmationRequest`. D
42
46
  ### Chat-Adapter-Vorlagen
43
47
  Der Tab **Chat-Adapter** lädt seine auswählbaren Zuordnungen aus `resources/KNXAIChatAdapterMappings.js`. Die Auswahl einer Vorlage installiert intern zwei vordefinierte synchrone JavaScript-Zuordnungen: eine vor der Verarbeitung des Eingangs durch KNX AI und eine vor der Ausgabe an Ausgang 3. Die Zuordnungen bleiben im Editor verborgen. Syntax- und Laufzeitfehler werden abgefangen und gemeldet, ohne Node-RED anzuhalten.
44
48
 
45
- Die enthaltene Vorlage **windkh/node-red-contrib-telegrambot** folgt dem Receiver-/Sender-Vertrag des Pakets. Verbinden Sie einen `telegram receiver` direkt mit KNX AI und Ausgang 3 direkt mit einem `telegram sender`. Für Inline-Bestätigungsschaltflächen verbinden Sie zusätzlich einen als `callback_query` konfigurierten `telegram event` mit demselben KNX-AI-Eingang. Die Eingangszuordnung liest `msg.payload.content`, `msg.payload.chatId` und die Telegram-Sprache. Die Ausgangszuordnung erstellt `msg.payload.chatId`, `type` und `content` und ergänzt bei ausstehender Schreibbestätigung `options.reply_markup` aus `msg.knxAi.confirmationRequest`. Das Telegram-Paket bleibt eine separate optionale Abhängigkeit.
49
+ Die enthaltene Vorlage **windkh/node-red-contrib-telegrambot** folgt dem Receiver-/Sender-Vertrag des Pakets. Verbinden Sie einen `telegram receiver` direkt mit KNX AI und Ausgang 3 direkt mit einem `telegram sender`. Die Bestätigung verwendet eine einmalige Telegram-Antworttastatur: Ein Klick auf **Bestätigen** oder **Abbrechen** sendet eine normale lokalisierte Nachricht über denselben Receiver zurück, daher sind weder ein `telegram event` noch eine Callback-Verkabelung erforderlich. Alte `callback_query`-Nachrichten werden weiterhin akzeptiert. Die Eingangszuordnung liest `msg.payload.content`, `msg.payload.chatId` und die Telegram-Sprache. Die Ausgangszuordnung erstellt `msg.payload.chatId`, `type` und `content` und ergänzt bei ausstehender Schreibbestätigung `options.reply_markup` aus `msg.knxAi.confirmationRequest`. Das Telegram-Paket bleibt eine separate optionale Abhängigkeit.
46
50
 
47
51
  Die enthaltene Vorlage **RedBot / node-red-contrib-chatbot (Telegram)** folgt dem gemeinsamen RedBot-Nachrichtenformat. Verbinden Sie `chatbot-telegram-receive` direkt mit KNX AI und Ausgang 3 direkt mit `chatbot-telegram-send`; ein separater Callback-Node ist nicht erforderlich, da RedBot Postbacks von Inline-Schaltflächen in normale Eingangsnachrichten umwandelt. Die Eingangszuordnung liest `transport`, `chatId`, `type`, `content` und die Telegram-Sprache. Die Ausgangszuordnung bewahrt die RedBot-Trackingdaten `originalMessage`, `chat`, `api` und `client` und erzeugt anschließend entweder einen `message`-Payload oder einen `inline-buttons`-Payload mit `postback`-Aktionen zur Bestätigung. RedBot bleibt eine separate optionale Abhängigkeit.
48
52
 
49
53
  ### Automatisch erkannte Kamera-Adapter
50
54
  Installierte Kamerapakete können KNX AI zur Laufzeit einen Kamera-Adapter bereitstellen. Es gibt weder eine Auswahl noch einen Kamera-Node, der mit KNX AI verbunden werden muss: verfügbare Adapter, Controller und Kameras werden automatisch erkannt und in den Chat-Kontext aufgenommen. `node-red-contrib-unifi-ultimate` ist der erste unterstützte Anbieter; weitere Pakete wie `hikvision-ultimate` können sich über denselben herstellerneutralen Vertrag registrieren.
51
55
 
52
- Der Benutzer kann einen aktuellen Snapshot anfordern oder das Vision-Modell nach dem sichtbaren Inhalt fragen. Die Telegram- und RedBot-Vorlagen senden das Bild als natives Foto mit Bildunterschrift. Außerdem lassen sich dauerhafte Benachrichtigungen für Bewegung, das Überqueren einer intelligenten Linie oder das Betreten einer Einbruchs-/Verweilzone erstellen, optional auf erkannte Personen und eine genau benannte Linie oder Zone begrenzt. Diese Regeln werden in derselben Datei `knxai-chat-context.md` gespeichert und nach einem Neustart von Node-RED wiederhergestellt. UniFi-Ereignisse und Snapshot-Anfragen laufen direkt über den erkannten Anbieter; Ausgang 4 von KNX AI und zusätzliche Flow-Verkabelung sind nicht erforderlich.
56
+ Der Benutzer kann einen aktuellen Snapshot anfordern oder das Vision-Modell nach dem sichtbaren Inhalt fragen. Die Telegram- und RedBot-Vorlagen senden das Bild als natives Foto mit Bildunterschrift. Außerdem lassen sich dauerhafte Benachrichtigungen für Bewegung, das Überqueren einer intelligenten Linie oder das Betreten einer Einbruchs-/Verweilzone erstellen, optional auf erkannte Personen und eine genau benannte Linie oder Zone begrenzt. Diese Regeln werden in derselben Datei `knxai-chat-context.knxctx` gespeichert und nach einem Neustart von Node-RED wiederhergestellt. UniFi-Ereignisse und Snapshot-Anfragen laufen direkt über den erkannten Anbieter; Ausgang 4 von KNX AI und zusätzliche Flow-Verkabelung sind nicht erforderlich.
53
57
 
54
- Jedes von einem automatisch erkannten Adapter veröffentlichte Ereignis wird normalisiert und in eine tägliche Datei `YYYY-MM-DD.jsonl` unter `knxultimatestorage/knxai/adapter-history/<node-id>/` geschrieben. Das Archiv bewahrt 10 Tage auf, garantiert mehr als 24 Stunden Historie und speichert Ereignismetadaten, jedoch keine Snapshot-Bilder. Web-Assistent und alle CHAT-Kanäle fragen es zusammen mit dem täglichen KNX-Telegrammarchiv ab. Summen umfassen alle gespeicherten Zeilen; ausgewählte Details sind nur eine relevante Stichprobe.
58
+ Jedes von einem automatisch erkannten Adapter veröffentlichte Ereignis wird normalisiert und direkt im kompakten zeilenbasierten KNX-AI-Nativformat in eine tägliche Datei `YYYY-MM-DD.knxctx` unter `knxultimatestorage/knxai/adapter-history/<node-id>/` geschrieben. Das KNX-Telegrammarchiv verwendet dasselbe kompakte Format ohne zwischenzeitliche JSON-Serialisierung. Das Archiv bewahrt 10 Tage auf, garantiert mehr als 24 Stunden Historie und speichert Ereignismetadaten, jedoch keine Snapshot-Bilder. Vorhandene JSONL-Archive werden weder gelesen noch migriert. Summen umfassen alle gespeicherten Zeilen; ausgewählte Details sind nur eine relevante Stichprobe.
55
59
 
56
60
  ### Ansagen mit TTS Ultimate
57
61
  Wenn das optionale Paket `node-red-contrib-tts-ultimate` installiert ist, erscheint es unter den automatisch erkannten Adaptern. Die Auswahl listet alle `ttsultimate`-Nodes in sämtlichen Projekt-Flows mit Flow, Node-Name und konfiguriertem Player auf. Wählen Sie den Node für Chat-Ansagen aus und deployen Sie den Flow.
58
62
 
59
- Nur eine ausdrückliche Anfrage in der aktuellen Chat-Nachricht kann eine Ansage erzeugen. KNX AI sendet den exakten Text direkt als `msg.payload` mit `msg.topic = "knx_ai_announcement"` an den ausgewählten Node; eine Zwischenverkabelung im Flow ist nicht erforderlich. TTS Ultimate verwaltet anschließend den konfigurierten Sonos-Player, Stimme, Lautstärke, Hailing und Warteschlange. Persistenter Kontext, KI-Erziehung, Kamerainhalte und abgeleitete Ereignisse lösen niemals selbstständig Sprache aus.
63
+ Das Modell entscheidet anhand der aktuellen Anfrage, persistenter Chat-Anweisungen und der benutzerverwalteten KI-Erziehung, ob es diesen Adapter verwendet; es gibt weder einen Ansage-Intent noch eine Liste von Auslösephrasen. KNX-Werte, Adapterereignisse, Kamerainhalte und Archive bleiben Daten statt Anweisungen, während vertrauenswürdige Benutzervorgaben dem Modell den Umgang mit diesen Daten beibringen können. KNX AI sendet den gewählten Text direkt als `msg.payload` mit `msg.topic = "knx_ai_announcement"` an den ausgewählten Node. TTS Ultimate verwaltet anschließend Sonos-Player, Stimme, Lautstärke, Hailing und Warteschlange.
60
64
 
61
65
  ### Übersicht des Chat-Kontexts
62
- Der Node-Editor zeigt eine kompakte Karte mit den für den Chat verfügbaren Quellen: aktuellem KNX-Verkehr, ETS-Semantik und Node-RED-Projekt, Sitzungs- und Hausgedächtnis, KI-Erziehung und erkannten Kameras. Sie zeigt außerdem den maximalen operativen Kontext und die tatsächliche UTF-8-Größe des letzten Chat-Prompts; gemeldete Eingabe-Token des Anbieters werden exakt verwendet, andernfalls wird der Tokenwert als Schätzung gekennzeichnet. Außerdem werden `knxai-chat-context.md`, `knxai-home-memory.md` und `knxai-config-<node-id>.json` sowie das absolute Stammverzeichnis des KNX-Telegrammarchivs, das Node-spezifische Verzeichnis und das Tagesdateimuster `YYYY-MM-DD.jsonl` aufgeführt. Die Pfade werden zur Laufzeit aus dem tatsächlich verwendeten Datenverzeichnis des konfigurierten Gateways ermittelt.
66
+ Der Node-Editor zeigt eine kompakte Karte mit den für den Chat verfügbaren Quellen: aktuellem KNX-Verkehr, ETS-Semantik und Node-RED-Projekt, Sitzungs- und Hausgedächtnis, KI-Erziehung und erkannten Kameras. Sie zeigt außerdem den vom Benutzer gewählten maximalen operativen Kontext und die tatsächliche UTF-8-Größe des letzten Chat-Prompts; gemeldete Eingabe-Token des Anbieters werden exakt verwendet, andernfalls wird der Tokenwert als Schätzung gekennzeichnet. Außerdem werden `knxai-chat-context.knxctx`, `knxai-home-memory.md` und `knxai-config-<node-id>.json` sowie das absolute Stammverzeichnis des KNX-Telegrammarchivs, das Node-spezifische Verzeichnis und das Tagesdateimuster `YYYY-MM-DD.knxctx` aufgeführt. Die Pfade werden zur Laufzeit aus dem tatsächlich verwendeten Datenverzeichnis des konfigurierten Gateways ermittelt.
67
+
68
+ Das Modell erhält KNX-Lese-/Schreiboperationen, Kamera-Adapter, TTS-Ansagen und persistenten Speicher als strukturierte Werkzeuge. Es kann sie anhand der aktuellen Anfrage und vertrauenswürdiger gelernter Vorgaben semantisch auswählen und kombinieren, ohne sprachliches Intent-Routing. Die Laufzeit prüft nur Argumente, Adapterverfügbarkeit und Sicherheitsgrenzen; KNX-Schreibvorgänge behalten die lokale ETS-/DPT-Prüfung und die konfigurierte Bestätigung.
69
+
70
+ ### CHAT-Lernen bearbeiten und sichern
71
+ Die Registerkarte **Gespräche & Zuhause** in der Node-RED-Konfiguration von KNX AI enthält die Schaltfläche **KI-Chat-Lernen öffnen**. Sie öffnet die Vue-Weboberfläche für den aktuellen Node direkt in diesem Editor.
72
+
73
+ Öffnen Sie in der Vue-Weboberfläche **Einstellungen → KI-Chat-Lernen**, um die exakte gemeinsame Datei `knxai-chat-context.knxctx` und ihren absoluten Pfad anzuzeigen und zu bearbeiten. Die Datei kann kopiert, als Sicherung heruntergeladen oder aus einer anderen `.knxctx`-Datei wiederhergestellt werden. **Speicher neu initialisieren** ersetzt sie nach ausdrücklicher Bestätigung durch einen neuen leeren Kontext und löscht gespeicherte Sitzungen, Anweisungen, Kameraüberwachungen und ausstehende Chat-Bestätigungen in allen KNX-AI-Nodes desselben Speichers. Die nativen, tabulatorgetrennten Datensätze `KNXAI_CHAT_CONTEXT 3` sind maßgeblich und direkt bearbeitbar: `SESSION` enthält `INSTRUCTION`-, `TURN`- und `CAMERA_WATCH`-Datensätze bis `END_SESSION`. Beim Speichern werden diese Datensätze geprüft und begrenzt, die Datei atomar neu geschrieben und der aktive Kontext aller KNX-AI-Nodes im selben Speicher aktualisiert. Eine Revisionsprüfung verhindert, dass zwischenzeitlich geändertes Lernen überschrieben oder zurückgesetzt wird.
74
+
75
+ Nur das native V3-Format wird unterstützt. Frühere Markdown/JSON-V2- und Base64-V1-Dateien werden absichtlich weder gelesen noch importiert oder migriert; die alte `.md`-Datei bleibt unverändert und KNX AI beginnt mit einem neuen `.knxctx`-Kontext. Die Grenzen von 50 Sitzungen und 512 KB gelten weiterhin.
76
+
77
+ ### Gelernte Rollen für KNX-Gruppenadressen
78
+ Die Rolle `neutral` bedeutet anfängliche Ungewissheit und kein dauerhaftes Steuerungsverbot. Das Modell kann mit dem strukturierten Werkzeug `gaRoleActions` aus verbindlichen Hinweisen des Benutzers, persistenten Chat-Vorgaben, der KI-Erziehung oder einer eindeutigen ETS-Projektsemantik lernen, dass eine exakte ETS-Gruppenadresse ein Befehls-, Status- oder neutrales Objekt ist. Dafür sind weder Schlüsselwörter noch Rollen-Intents nötig; bei mehrdeutigen Belegen fragt das Modell nach, statt zu lernen.
79
+
80
+ Gelernte Rolle, Begründung und Beleg werden pro Node in `<userDir>/knxai/config/knxai-config-<node-id>.json` gespeichert und in das begrenzte semantische Hausgedächtnis synchronisiert. Eine als `command` gelernte Rolle kann bereits in derselben Antwort einen Schreibvorgang validieren und bleibt nach einem Neustart verfügbar; das Modell kann sie auch vergessen und die automatische Klassifizierung wiederherstellen. Das Lernen kann keine GA erfinden, ihren ETS-DPT ändern, die Payload-Prüfung umgehen oder die konfigurierte Schreibbestätigung überspringen.
63
81
 
64
82
  ## Durch KI-Erziehung gesteuerte proaktive Hausintelligenz und begrenztes Gedächtnis
65
83
  Aus ETS-Hierarchie, Namen, Rollen und DPTs erstellt der Node ein deterministisches semantisches Modell. Es gibt keinen separaten Schalter und keine erweiterten proaktiven Einstellungen. Eine Benachrichtigung wird nur bewertet, wenn das LLM aktiv ist und die **KI-Erziehung** sie ausdrücklich verlangt. Ausschließlich die Erziehung bestimmt Bedingungen, Offenzeit, Ruhezeiten und Wiederholung. Ohne eine ausdrückliche Regel oder bei fehlgeschlagener LLM-Auswertung wird nichts gesendet.
@@ -125,7 +143,7 @@ Hier sind alle Felder aufgeführt, wie sie im KNX-AI-Editor sichtbar sind.
125
143
  - **2) Install it**: lädt und installiert das Modell lokal (z. B. `llama3.1`).
126
144
  - Beim Refresh/Install versucht KNX AI zusätzlich, den Ollama-Server automatisch zu starten.
127
145
  - Bei Installationsfehlern mit Verbindungsproblem prüfen, ob Ollama läuft (Desktop-App oder `ollama serve`).
128
- - Der von `/api/show` gemeldete maximale Kontext dient nur zur Information. KNX AI sendet immer `num_ctx = 16384` (oder das kleinere Modellmaximum) und verwendet dieselbe relevanzbasierte semantische 16K-Ansicht. So wird keine übergroße KV-Cache-Zuweisung erzeugt, ohne Agentenfunktionen zu entfernen.
146
+ - Der von `/api/show` gemeldete maximale Kontext dient nur zur Information. KNX AI sendet das gewählte 4K-, 8K- oder 16K-Budget als `num_ctx` (oder das kleinere Modellmaximum) und begrenzt jede Kontextquelle proportional, ohne Agentenfunktionen zu entfernen.
129
147
  - Wenn Node-RED in Docker läuft, im Endpoint `host.docker.internal` statt `localhost` verwenden.
130
148
 
131
149
  ### Bionic LM Studio Schnellstart (lokal)
@@ -133,7 +151,7 @@ Hier sind alle Felder aufgeführt, wie sie im KNX-AI-Editor sichtbar sind.
133
151
  - Den LM-Studio-API-Server auf der Seite **Developer** oder mit `lms server start` starten.
134
152
  - Standard-Endpoint: `http://localhost:1234/v1/chat/completions`.
135
153
  - Mit **Refresh** alle von `/v1/models` bereitgestellten Modelle laden; ist kein Modell konfiguriert, wird das erste ausgewählt.
136
- - Ist ein Modell bereits geladen, behält KNX AI dessen aktive Kontextlänge bei. KNX AI lädt ein inaktives Bionic-Modell niemals über die Verwaltungs-API: Die erste Chat-Anfrage lässt Bionic das Modell per JIT mit den gespeicherten modellspezifischen Standardwerten laden. Unabhängig vom von Bionic gemeldeten Kontext begrenzt KNX AI den eigenen Prompt immer auf eine nach Relevanz ausgewählte semantische 16K-Ansicht; dadurch wird nicht der gesamte 131K-Datensatz gesendet, ohne Denk-, KNX-, Routinen-, Kamera- oder TTS-Funktionen zu entfernen.
154
+ - Ist ein Modell bereits geladen, behält KNX AI dessen aktive Kontextlänge bei. KNX AI lädt ein inaktives Bionic-Modell niemals über die Verwaltungs-API: Die erste Chat-Anfrage lässt Bionic das Modell per JIT mit den gespeicherten modellspezifischen Standardwerten laden. Unabhängig vom von Bionic gemeldeten Kontext verwendet KNX AI das gewählte 4K-, 8K- oder 16K-Prompt-Budget; Denk-, KNX-, Routinen-, Kamera- und TTS-Funktionen bleiben verfügbar.
137
155
  - Der API-Schlüssel ist optional, sofern die Authentifizierung in den LM-Studio-Servereinstellungen nicht aktiviert ist. In Docker `localhost` durch `host.docker.internal` ersetzen.
138
156
 
139
157
  ## Sicherheitshinweis
@@ -6,6 +6,7 @@
6
6
  "groupChatHome": "Gespräche & Zuhause",
7
7
  "detectedAdapters": "Automatisch erkannte Adapter",
8
8
  "chatContextOverview": "Übersicht des Chat-Kontexts",
9
+ "chatLearning": "KI-Chat-Lernen",
9
10
  "quickSetup": "Assistent einrichten",
10
11
  "llmConnection": "KI-Assistent-Verbindung",
11
12
  "chatAdapter": "Chat-Kanäle",
@@ -21,6 +22,7 @@
21
22
  "llmBaseUrl": "Endpoint URL",
22
23
  "llmApiKey": "API key",
23
24
  "llmModel": "Model",
25
+ "llmPromptContextTokens": "Chat-Kontextmenge",
24
26
  "llmSystemPrompt": "System prompt",
25
27
  "llmIncludeRaw": "Include raw payload hex",
26
28
  "llmAllowKnxCommands": "KI darf KNX-Zustände lesen und Aktoren steuern",
@@ -45,6 +47,11 @@
45
47
  "ollama": "Ollama (lokal)",
46
48
  "lmstudio": "Bionic LM Studio"
47
49
  },
50
+ "promptContext": {
51
+ "small": "Klein (4K, schneller)",
52
+ "medium": "Mittel (8K)",
53
+ "full": "Vollständig (16K)"
54
+ },
48
55
  "chatAdapter": {
49
56
  "none": "Kein Adapter"
50
57
  },
@@ -68,6 +75,7 @@
68
75
  "lmStudioContextFailed": "Der Modellkontext konnte nicht konfiguriert werden",
69
76
  "lmStudioContextCurrentlyLoaded": "derzeit geladen",
70
77
  "localContextBudget": "KNX-AI-Kontextbudget",
78
+ "promptContextHint": "Steuert die Menge an KNX-, Speicher-, Projekt- und Adapterkontext für lokale Modelle. Werkzeuge werden dadurch weder aktiviert noch deaktiviert; es gibt kein Intent-Routing.",
71
79
  "ollamaNotSupported": "Ollama local mode: API key not required. Default endpoint is http://localhost:11434/api/chat.",
72
80
  "ollamaNoModels": "No local Ollama model found. Install one or pick one from the library.",
73
81
  "installingOllamaModel": "Starting Ollama and installing model…",
@@ -87,6 +95,7 @@
87
95
  "ttsUltimateHint": "Explizite Ansagen aus dem Chat werden direkt an den ausgewählten Node gesendet; eine Flow-Verkabelung ist nicht erforderlich.",
88
96
  "chatContextLoading": "Zusammenfassung des Chat-Kontexts wird geladen…",
89
97
  "chatContextUnavailable": "Die Zusammenfassung des Chat-Kontexts ist vorübergehend nicht verfügbar.",
98
+ "chatLearningOpenHint": "Öffnet die Weboberfläche direkt im gemeinsamen CHAT-Lerneditor, um die persistente Datei anzuzeigen, zu bearbeiten, zu kopieren oder zu sichern.",
90
99
  "chatContextIntro": "Der Chat erhält diese Quellen automatisch. Die folgenden Pfade werden von dieser Node-RED-Installation tatsächlich verwendet.",
91
100
  "chatContextLimitLabel": "Maximaler operativer Kontext",
92
101
  "chatContextProviderManaged": "vom ausgewählten Anbieter/Modell verwaltet",
@@ -172,7 +181,8 @@
172
181
  "buttons": {
173
182
  "installOllamaModel": "2) Install it",
174
183
  "ollamaLibrary": "Model library",
175
- "downloadOllamaModel": "1) Download model"
184
+ "downloadOllamaModel": "1) Download model",
185
+ "openChatLearning": "KI-Chat-Lernen öffnen"
176
186
  }
177
187
  }
178
188
  }
@@ -45,7 +45,8 @@ Der Rest dieser Hilfe beschreibt den klassischen **IoT-Bridge**-Modus.
45
45
  ## Zuordnungsfelder
46
46
 
47
47
  - **Richtung** — wählen Sie KNX→IoT, IoT→KNX oder bidirektional.
48
- - **Kanaltyp** — MQTT verwendet das Target als Topic, REST als Basis-URL, Modbus als Registerkennung.
48
+ - **Kanaltyp** — MQTT verwendet das Target als Topic, REST als Basis-URL; bei Modbus ist **Target** die nullbasierte Protokolladresse (0–65535).
49
+ - **Modbus-Format / Unit-ID / Bereich / Datentyp** — wählen Sie für neue Zuordnungen **Mit Flex Write kompatibel** und danach Einheit, Speicherbereich sowie `bool`, `uint16` oder `int16`. Fehlt das Format, bleibt der alte Skalarvertrag aktiv, damit bestehende Flows weiter funktionieren.
49
50
  - **Skalierung & Offset** — werden für KNX→IoT angewandt; IoT→KNX nutzt die inverse Transformation.
50
51
  - **Template** — optionale Zeichenkette mit Platzhaltern `{{value}}`, `{{ga}}`, `{{label}}`, `{{target}}`, `{{type}}`, `{{isoTimestamp}}`.
51
52
  - **Timeout / Wiederholungen** — Informationsfelder im Output zur Steuerung von Retries und Zeitfenstern in nachfolgenden Nodes.
@@ -88,7 +89,32 @@ Der Rest dieser Hilfe beschreibt den klassischen **IoT-Bridge**-Modus.
88
89
 
89
90
  ### Modbus-Register-Sync
90
91
 
91
- - Kombinieren Sie den Bridge mit `modbus-flex-write`-Nodes aus `node-red-contrib-modbus`. Ausgang&nbsp;1 enthält die Modbus-Adresse in `msg.address` und den Wert in `msg.payload`.
92
+ Die Bridge ist ein Nachrichtenadapter für `node-red-contrib-modbus`; sie öffnet selbst keine TCP-/serielle Verbindung und fragt kein Gerät ab. Installieren Sie eine mit Ihrer Node-RED-Laufzeit kompatible Paketversion und verwenden Sie dann dessen Client- und Transport-Nodes.
93
+
94
+ |Bereich|Lesen|Schreiben|Zulässige Richtung|
95
+ |--|--|--|--|
96
+ | Coil | FC1 | FC5 | Beide Richtungen |
97
+ | Discrete Input | FC2 | — | Nur Modbus → KNX |
98
+ | Holding Register | FC3 | FC6 | Beide Richtungen |
99
+ | Input Register | FC4 | — | Nur Modbus → KNX |
100
+
101
+ Wählen Sie bei einer neuen Zuordnung `Format = Mit Flex Write kompatibel`. Für KNX → Modbus kann Ausgang&nbsp;1 direkt mit einem `modbus-flex-write`-Node verbunden werden und gibt Folgendes aus:
102
+
103
+ ```
104
+ msg.payload = {
105
+ value: 215,
106
+ fc: 6,
107
+ unitid: 1,
108
+ address: 9,
109
+ quantity: 1
110
+ }
111
+ ```
112
+
113
+ `address` ist immer nullbasiert: bezeichnet ein Gerätehandbuch ein Holding Register als `40010`, lautet seine Protokolladresse üblicherweise `9`; prüfen Sie die Konvention des Handbuchs. Die Bridge unterstützt pro Zuordnung ein Bit oder ein einzelnes 16-Bit-Register. Mehrere Wörter, 32-Bit-/Float-Werte und Byte-/Wortreihenfolge werden derzeit nicht verarbeitet.
114
+
115
+ Für Modbus → KNX verbinden Sie den Datenausgang eines `modbus-flex-getter`- oder `modbus-read`-Nodes mit dem Eingang der Bridge. Flex Getter stellt die Anfrage (`fc`, `unitid`, `address`, `quantity`) in `msg.modbusRequest` bereit; Modbus Read behält sie in `msg.input.payload`. Das zurückgegebene Werte-Array kann in `msg.payload` oder `msg.values` liegen. Die Bridge unterstützt beide Nachrichtenformen, ordnet alle von der Antwort abgedeckten Flex-Zuordnungen zu und verwendet das passende Array-Element. Aktivieren Sie **Keep Msg Properties** am Flex Getter. Skalierung und Offset folgen `raw = KNX × Skalierung + Offset`; eingehend wird die inverse Umrechnung angewendet.
116
+
117
+ `KNX-Werte beim Deploy lesen` liest nur KNX; planen Sie Modbus-Lesevorgänge im externen Modbus-Flow. Legacy-Zuordnungen (einschließlich solcher ohne `modbusMessageFormat`) geben weiterhin den bisherigen skalaren Payload mit `msg.address`/`msg.modbusFunction` auf oberster Ebene aus.
92
118
 
93
119
  ## Beispiel-Flow
94
120
 
@@ -79,6 +79,10 @@
79
79
  "target": "Ziel",
80
80
  "method": "HTTP-Methode",
81
81
  "modbusFunction": "Modbus-Funktion",
82
+ "modbusMessageFormat": "Modbus-Nachrichtenformat",
83
+ "modbusUnitId": "Unit-ID",
84
+ "modbusArea": "Modbus-Bereich",
85
+ "modbusDataType": "Datentyp",
82
86
  "scale": "Skalierung",
83
87
  "offset": "Offset",
84
88
  "timeout": "Zeitüberschreitung (ms)",
@@ -103,7 +107,7 @@
103
107
  "target": "Topic, URL oder Register",
104
108
  "target_mqtt": "Topic, z. B. knx/light/living",
105
109
  "target_rest": "https://example/api/endpoint",
106
- "target_modbus": "Register (z. B. 40001)",
110
+ "target_modbus": "Nullbasierte Adresse (z. B. 0)",
107
111
  "template": "{\"value\":{{value}}}",
108
112
  "property": "Optionale Eigenschaft/Pfad",
109
113
  "method": "POST",
@@ -114,7 +118,7 @@
114
118
  "default": "Ziel",
115
119
  "mqtt": "MQTT-Topic",
116
120
  "rest": "REST-URL",
117
- "modbus": "Modbus-Register"
121
+ "modbus": "Modbus-Adresse (nullbasiert)"
118
122
  },
119
123
  "method": {
120
124
  "default": "HTTP-Methode",
@@ -125,6 +129,20 @@
125
129
  "modbus": "Modbus-Funktion"
126
130
  }
127
131
  },
132
+ "modbus": {
133
+ "formatLegacy": "Legacy-Skalar-Nachricht",
134
+ "formatFlex": "Mit Flex Write kompatibel",
135
+ "areaCoil": "Coil (FC1 lesen / FC5 schreiben)",
136
+ "areaDiscreteInput": "Discrete Input (FC2 lesen, schreibgeschützt)",
137
+ "areaHoldingRegister": "Holding Register (FC3 lesen / FC6 schreiben)",
138
+ "areaInputRegister": "Input Register (FC4 lesen, schreibgeschützt)",
139
+ "dataTypeBool": "Boolesch",
140
+ "dataTypeUint16": "16 Bit ohne Vorzeichen",
141
+ "dataTypeInt16": "16 Bit mit Vorzeichen",
142
+ "zeroBasedHint": "Verwende die nullbasierte Protokolladresse (0–65535), nicht die in manchen Handbüchern angegebene 4xxxx-Referenz.",
143
+ "flexHint": "Flex gibt msg.payload = {value,fc,unitid,address,quantity} zur direkten Verbindung mit modbus-flex-write aus.",
144
+ "readOnlyHint": "Discrete Inputs und Input Register sind schreibgeschützt und können nur Modbus → KNX verwenden."
145
+ },
128
146
  "labels": {
129
147
  "outputKnxToIoT": "Strom KNX → IoT",
130
148
  "outputIoTToKnx": "Bestätigungen IoT → KNX",
@@ -25,9 +25,13 @@ If processing takes longer than 1.2 seconds, output 3 emits the localized interm
25
25
 
26
26
  Ollama and Bionic LM Studio requests automatically use a minimum timeout of 10 minutes; cloud providers retain a 2-minute minimum. There is no timeout field to maintain in the editor. If even the local limit is reached, KNX AI reports that the model did not finish and suggests retrying or reducing the prompt context.
27
27
 
28
+ For local providers, **Chat context amount** explicitly selects 4K, 8K or 16K; 16K remains the default. The choice proportionally bounds the KNX, memory, Node-RED project and adapter data supplied to the model while retaining the complete agent tool contract. It never enables or disables a capability from wording, keywords or linguistic intents.
29
+
28
30
  The node's canvas status is deliberately reserved for the latest incoming request and the localized “I’m thinking…” state while the LLM is running. KNX telegrams, gateway updates, traffic rates, ready messages and technical results never overwrite it; they remain available through the node outputs, logs and Assistant data.
29
31
 
30
- Every Ask/chat session keeps its last 8 turns and up to 20 explicit long-term instructions, separated by `msg.knxAi.sessionId`, `msg.sessionId`, or a detected Telegram chat ID. Requests such as “Remember not to use the term unknown” become durable instructions. All KNX AI nodes using the same storage share this live context and reload it after Node-RED restarts from `knxultimatestorage/knxai/memory/knxai-chat-context.md`. The atomically written file is bounded to 50 sessions and 512 KB. When KNX control is enabled, wire output 3 back to the chat sender and output 4 to a KNX Ultimate node configured in **Universal mode**. With confirmation enabled, the first reply previews every write GA, DPT, and payload without emitting writes; the same session must then reply `CONFIRM`/`CANCEL` (localized equivalents are accepted) within 5 minutes. A new request replaces any older pending plan. Each confirmed command has `msg.destination`, `msg.dpt`, `msg.payload`, and `msg.event = "GroupValue_Write"`.
32
+ Every Ask/chat session keeps its last 8 turns and up to 20 model-selected long-term instructions, separated by `msg.knxAi.sessionId`, `msg.sessionId`, or a detected Telegram chat ID. The model decides semantically when the meaning of a conversation should be remembered or forgotten through the structured memory tool; no language keyword or intent list is used. All KNX AI nodes using the same storage share this live context and reload it after Node-RED restarts from `knxultimatestorage/knxai/memory/knxai-chat-context.knxctx`. The atomically written file is bounded to 50 sessions and 512 KB. When KNX control is enabled, wire output 3 back to the chat sender and output 4 to a KNX Ultimate node configured in **Universal mode**. With confirmation enabled, the first reply previews every write GA, DPT, and payload without emitting writes; the same session must then reply `CONFIRM`/`CANCEL` (localized equivalents are accepted) within 5 minutes. A new request replaces any older pending plan. Each confirmed command has `msg.destination`, `msg.dpt`, `msg.payload`, and `msg.event = "GroupValue_Write"`.
33
+ Recent session memory is placed immediately beside the current request so local models retain user-supplied facts such as a preferred name or language even inside a large KNX prompt. The model may persist durable facts, preferences and instructions through `memoryActions`; this remains a semantic tool choice without phrase classifiers or intent routing. Credentials, security codes and API keys must never be learned.
34
+
31
35
  For DPT 1.xxx writes, safe AI equivalents `true`/`false`, `1`/`0`, and `on`/`off` are normalized to a real boolean before local validation and output.
32
36
 
33
37
  ### Fresh KNX reads
@@ -42,24 +46,38 @@ While a plan is pending, output 3 contains `msg.knxAi.confirmationRequest`. The
42
46
  ### Chat adapter presets
43
47
  The **Chat adapters** tab loads its selectable mappings from `resources/KNXAIChatAdapterMappings.js`. Selecting a preset installs two predefined synchronous JavaScript mappings internally: one before KNX AI processes an input and one before output 3 is emitted. The mappings remain hidden in the editor. Syntax and execution failures are caught and reported without stopping Node-RED.
44
48
 
45
- The included **windkh/node-red-contrib-telegrambot** preset follows the package's receiver/sender contract. Connect a `telegram receiver` directly to KNX AI, output 3 directly to a `telegram sender`, and—when inline confirmation buttons are required—connect a `telegram event` configured for `callback_query` to the same KNX AI input. The input mapping extracts `msg.payload.content`, `msg.payload.chatId`, and the Telegram language. The output mapping creates the required `msg.payload.chatId`, `type`, and `content`, adding `options.reply_markup` from `msg.knxAi.confirmationRequest` when writes await confirmation. The Telegram package remains a separate optional dependency.
49
+ The included **windkh/node-red-contrib-telegrambot** preset follows the package's receiver/sender contract. Connect a `telegram receiver` directly to KNX AI and output 3 directly to a `telegram sender`. Confirmation uses a one-time Telegram reply keyboard: clicking **Confirm** or **Cancel** returns a normal localized message through the same receiver, so no `telegram event` or callback wiring is required. Legacy `callback_query` messages remain accepted. The input mapping extracts `msg.payload.content`, `msg.payload.chatId`, and the Telegram language. The output mapping creates the required `msg.payload.chatId`, `type`, and `content`, adding `options.reply_markup` from `msg.knxAi.confirmationRequest` when writes await confirmation. The Telegram package remains a separate optional dependency.
46
50
 
47
51
  The included **RedBot / node-red-contrib-chatbot (Telegram)** preset follows RedBot's common message contract. Connect `chatbot-telegram-receive` directly to KNX AI and output 3 directly to `chatbot-telegram-send`; no separate callback node is needed because RedBot converts inline-button postbacks into normal inbound messages. The input mapping reads `transport`, `chatId`, `type`, `content`, and the Telegram language. The output mapping preserves RedBot's `originalMessage`, `chat`, `api`, and `client` tracking data, then emits either a `message` payload or an `inline-buttons` payload containing `postback` actions for confirmation. RedBot remains a separate optional dependency.
48
52
 
49
53
  ### Automatically detected camera adapters
50
54
  Installed camera packages can publish a camera adapter to KNX AI at runtime. There is no selector and no camera node to wire to KNX AI: available adapters, controllers and cameras are detected automatically and included in the chat context. `node-red-contrib-unifi-ultimate` is the first supported provider; other packages, such as `hikvision-ultimate`, can register through the same vendor-neutral contract.
51
55
 
52
- The user can ask for a current snapshot or ask the vision model what is visible. Telegram and RedBot presets emit the returned image as a native photo with a caption. The user can also create persistent notifications for motion, a smart line crossing or entry into an intrusion/loiter zone, optionally limited to detected people and to an exact named line or zone. These rules are stored in the same `knxai-chat-context.md` file and are restored after Node-RED restarts. UniFi event subscriptions and snapshot requests are made directly through the detected provider; KNX AI output 4 is not involved and no intermediate flow wiring is required.
56
+ The user can ask for a current snapshot or ask the vision model what is visible. Telegram and RedBot presets emit the returned image as a native photo with a caption. The user can also create persistent notifications for motion, a smart line crossing or entry into an intrusion/loiter zone, optionally limited to detected people and to an exact named line or zone. These rules are stored in the same `knxai-chat-context.knxctx` file and are restored after Node-RED restarts. UniFi event subscriptions and snapshot requests are made directly through the detected provider; KNX AI output 4 is not involved and no intermediate flow wiring is required.
53
57
 
54
- Every event published by an automatically detected adapter is normalized and appended to a daily `YYYY-MM-DD.jsonl` file under `knxultimatestorage/knxai/adapter-history/<node-id>/`. The archive keeps 10 days, guarantees more than 24 hours of history and stores event metadata rather than snapshot images. The web Assistant and every CHAT channel query it together with the KNX daily telegram archive. Totals cover every stored row in the requested interval; selected details are only a relevant sample.
58
+ Every event published by an automatically detected adapter is normalized and appended directly in KNX AI's compact native row format to a daily `YYYY-MM-DD.knxctx` file under `knxultimatestorage/knxai/adapter-history/<node-id>/`. The KNX telegram archive uses the same compact format, without intermediate JSON serialization. The archive keeps 10 days, guarantees more than 24 hours of history and stores event metadata rather than snapshot images. Existing JSONL archives are neither read nor migrated. Totals cover every stored row in the requested interval; selected details are only a relevant sample.
55
59
 
56
60
  ### TTS Ultimate announcements
57
61
  When the optional `node-red-contrib-tts-ultimate` package is installed, it appears among the automatically detected adapters. The selector lists every `ttsultimate` node in all project flows, with its flow, node name and configured player. Choose the node that must handle chat announcements and deploy the flow.
58
62
 
59
- Only an explicit request in the current chat message can create an announcement. KNX AI sends the exact text directly to the selected node as `msg.payload`, with `msg.topic = "knx_ai_announcement"`; no intermediate flow wiring is required. TTS Ultimate then handles the configured Sonos player, voice, volume, hailing and queue. Persistent context, AI Education, camera content and inferred events never trigger speech by themselves.
63
+ The model decides whether to use this adapter by reasoning over the current request, persistent chat instructions and user-managed AI Education; there is no announcement intent or trigger-phrase list. KNX values, adapter events, camera content and archives remain data rather than instructions, but trusted user guidance may tell the model how to act on them. KNX AI sends the chosen text directly to the selected node as `msg.payload`, with `msg.topic = "knx_ai_announcement"`; no intermediate flow wiring is required. TTS Ultimate then handles the configured Sonos player, voice, volume, hailing and queue.
60
64
 
61
65
  ### Chat context overview
62
- The node editor shows a compact card summarizing the sources available to the chat: live and archived KNX traffic, persistent adapter events, ETS semantics and the Node-RED project, session and home memory, AI Education and detected cameras. It also shows the maximum operational context and the actual UTF-8 size of the last chat prompt; exact provider input tokens are used when reported, otherwise the token count is marked as estimated. The card lists the absolute KNX telegram and adapter-event archive directories and the `YYYY-MM-DD.jsonl` daily-file pattern.
66
+ The node editor shows a compact card summarizing the sources available to the chat: live and archived KNX traffic, persistent adapter events, ETS semantics and the Node-RED project, session and home memory, AI Education and detected cameras. It also shows the user-selected maximum operational context and the actual UTF-8 size of the last chat prompt; exact provider input tokens are used when reported, otherwise the token count is marked as estimated. The card lists the absolute KNX telegram and adapter-event archive directories and the `YYYY-MM-DD.knxctx` daily-file pattern.
67
+
68
+ The model receives KNX read/write operations, camera adapters, TTS announcements and persistent memory as structured tools. It can select and combine them semantically from the current request and trusted learned guidance, without linguistic intent routing. The runtime only validates tool arguments, adapter availability and safety boundaries; KNX writes still use local ETS/DPT validation and the configured confirmation step.
69
+
70
+ ### Editing and backing up CHAT learning
71
+ The **Conversations & home** tab in the Node-RED KNX AI configuration includes an **Open AI Chat Learning** button that opens the Vue Web UI directly on this editor for the current node.
72
+
73
+ In the Vue web UI, open **Settings → AI Chat Learning** to view and edit the exact shared `knxai-chat-context.knxctx` file and its absolute path. The file can be copied, downloaded as a backup or restored from another `.knxctx` file. **Reinitialize Memory**, protected by an explicit confirmation, replaces it with a new empty context and clears saved sessions, instructions, camera watches and pending chat confirmations across every KNX AI node using the same storage. The native tab-separated `KNXAI_CHAT_CONTEXT 3` records are authoritative and directly editable: `SESSION` contains `INSTRUCTION`, `TURN` and `CAMERA_WATCH` records until `END_SESSION`. Saving validates and bounds these records, atomically rewrites the file and updates the live context of every KNX AI node using the same storage. A revision check refuses to overwrite or reset learning that changed after the editor loaded it.
74
+
75
+ Only the native V3 format is supported. Previous Markdown/JSON V2 and Base64 V1 files are deliberately not read, imported or migrated; the old `.md` file is left untouched and KNX AI starts a new `.knxctx` context. The 50-session and 512 KB limits still apply.
76
+
77
+ ### Learned KNX group-address roles
78
+ The `neutral` role means initial uncertainty, not a permanent control ban. The model can use the structured `gaRoleActions` tool to learn that an exact ETS group address is a command, status or neutral object from trusted user teaching, persistent chat guidance, AI Education or unequivocal ETS project semantics. There is no required keyword or role intent; if the evidence is ambiguous, the model asks for clarification instead of learning.
79
+
80
+ The learned role, reason and evidence are stored per node in `<userDir>/knxai/config/knxai-config-<node-id>.json` and synchronized into the bounded semantic home memory. A role learned as `command` can validate a write in the same answer and remains available after restart; the model can also forget it and restore automatic classification. Learning never invents a GA, changes its ETS DPT, bypasses payload validation or skips the configured write confirmation.
63
81
 
64
82
  ## Education-driven proactive home intelligence and bounded memory
65
83
  From ETS hierarchy, names, roles and DPTs, the node builds a deterministic semantic model for covers, windows, doors, lights, temperature, climate, occupancy and alarms using Italian, English, German, French, Spanish and Chinese terms. Its proactive detector watches only reliably recognized non-command cover/window/door states.
@@ -131,7 +149,7 @@ All fields exposed in the KNX AI editor are listed below.
131
149
  - **2) Install it**: downloads and installs the model locally (for example `llama3.1`).
132
150
  - During model refresh/install, KNX AI also tries to auto-start the Ollama server when possible.
133
151
  - If install fails with connection errors, ensure Ollama is running (desktop app or `ollama serve`).
134
- - The maximum context reported by `/api/show` is informational. KNX AI always sends `num_ctx = 16384` (or the model maximum when it is smaller) and uses the same relevance-selected 16K semantic prompt, avoiding oversized KV-cache allocation without removing agent capabilities.
152
+ - The maximum context reported by `/api/show` is informational. KNX AI sends the selected 4K, 8K or 16K budget as `num_ctx` (or the model maximum when it is smaller) and proportionally bounds every supplied context source without removing agent capabilities.
135
153
  - If Node-RED runs in Docker, use `host.docker.internal` instead of `localhost` in the endpoint URL.
136
154
 
137
155
  ### Bionic LM Studio quick setup (local)
@@ -139,7 +157,7 @@ All fields exposed in the KNX AI editor are listed below.
139
157
  - Start the LM Studio API server from the **Developer** page or with `lms server start`.
140
158
  - Default endpoint: `http://localhost:1234/v1/chat/completions`.
141
159
  - Click **Refresh** to load all models exposed by `/v1/models`; the first model is selected when none is configured.
142
- - When a model is already loaded, KNX AI preserves its active context length. KNX AI never loads an inactive Bionic model through the management API: the first chat request lets Bionic JIT-load it with its saved per-model defaults. Independently of the context reported by Bionic, KNX AI always limits its own prompt to a relevance-selected 16K semantic view; this avoids sending the full 131K data set without removing reasoning, KNX, routine, camera or TTS capabilities.
160
+ - When a model is already loaded, KNX AI preserves its active context length. KNX AI never loads an inactive Bionic model through the management API: the first chat request lets Bionic JIT-load it with its saved per-model defaults. Independently of the context reported by Bionic, KNX AI uses the selected 4K, 8K or 16K prompt budget and keeps reasoning, KNX, routine, camera and TTS capabilities available.
143
161
  - An API key is optional unless authentication is enabled in the LM Studio server settings. In Docker, replace `localhost` with `host.docker.internal`.
144
162
 
145
163
  ## Security note
@@ -6,6 +6,7 @@
6
6
  "groupChatHome": "Conversations & home",
7
7
  "detectedAdapters": "Automatically detected adapters",
8
8
  "chatContextOverview": "Chat context overview",
9
+ "chatLearning": "AI Chat Learning",
9
10
  "quickSetup": "Assistant setup",
10
11
  "llmConnection": "AI Assistant Connection",
11
12
  "chatAdapter": "Chat channels",
@@ -21,6 +22,7 @@
21
22
  "llmBaseUrl": "Endpoint URL",
22
23
  "llmApiKey": "API key",
23
24
  "llmModel": "Model",
25
+ "llmPromptContextTokens": "Chat context amount",
24
26
  "llmSystemPrompt": "System prompt",
25
27
  "llmIncludeRaw": "Include raw payload hex",
26
28
  "llmAllowKnxCommands": "Allow AI to read KNX states and control actuators",
@@ -45,6 +47,11 @@
45
47
  "ollama": "Ollama (local)",
46
48
  "lmstudio": "Bionic LM Studio"
47
49
  },
50
+ "promptContext": {
51
+ "small": "Small (4K, faster)",
52
+ "medium": "Medium (8K)",
53
+ "full": "Full (16K)"
54
+ },
48
55
  "chatAdapter": {
49
56
  "none": "No adapter"
50
57
  },
@@ -57,7 +64,8 @@
57
64
  "refreshModels": "Refresh",
58
65
  "installOllamaModel": "2) Install it",
59
66
  "ollamaLibrary": "Model library",
60
- "downloadOllamaModel": "1) Download model"
67
+ "downloadOllamaModel": "1) Download model",
68
+ "openChatLearning": "Open AI Chat Learning"
61
69
  },
62
70
  "messages": {
63
71
  "loadingModels": "Loading models…",
@@ -69,6 +77,7 @@
69
77
  "lmStudioContextFailed": "Unable to configure the model context",
70
78
  "lmStudioContextCurrentlyLoaded": "currently loaded",
71
79
  "localContextBudget": "KNX AI context budget",
80
+ "promptContextHint": "Controls how much KNX, memory, project and adapter context is sent to local models. It does not enable or disable tools and does not use intent routing.",
72
81
  "ollamaNotSupported": "Ollama local mode: API key not required. Default endpoint is http://localhost:11434/api/chat.",
73
82
  "ollamaNoModels": "No local Ollama model found. Install one or pick one from the library.",
74
83
  "installingOllamaModel": "Starting Ollama and installing model…",
@@ -88,6 +97,7 @@
88
97
  "ttsUltimateHint": "Explicit chat announcement requests are sent directly to the selected node; no flow wiring is required.",
89
98
  "chatContextLoading": "Loading chat context summary…",
90
99
  "chatContextUnavailable": "The chat context summary is temporarily unavailable.",
100
+ "chatLearningOpenHint": "Open the Web UI directly on the shared CHAT learning editor to view, edit, copy or back up its persistent file.",
91
101
  "chatContextIntro": "The chat automatically receives these sources. The paths below are the actual paths used by this Node-RED installation.",
92
102
  "chatContextLimitLabel": "Maximum operational context",
93
103
  "chatContextProviderManaged": "managed by the selected provider/model",
@@ -45,7 +45,8 @@ The rest of this help describes the classic **IoT bridge** mode.
45
45
  ## Mapping Fields
46
46
 
47
47
  - **Direction** — choose KNX→IoT, IoT→KNX or bidirectional.
48
- - **Channel type** — MQTT uses the target as topic; REST uses it as the base URL; Modbus expects a register identifier.
48
+ - **Channel type** — MQTT uses the target as topic; REST uses it as the base URL; for Modbus, **Target** is the zero-based protocol address (0–65535).
49
+ - **Modbus format / Unit ID / Area / Data type** — choose **Flex Write compatible** for new mappings, then select the unit, memory area and `bool`, `uint16` or `int16`. A missing format remains the legacy scalar contract so existing flows keep working.
49
50
  - **Scale & Offset** — applied to KNX→IoT; IoT→KNX applies the inverse transform.
50
51
  - **Template** — optional string replacing `{{value}}`, `{{ga}}`, `{{label}}`, `{{target}}`, `{{type}}`, `{{isoTimestamp}}`.
51
52
  - **Timeout / Retries** — informational fields exposed in the emitted message for downstream nodes to act on.
@@ -88,7 +89,32 @@ The rest of this help describes the classic **IoT bridge** mode.
88
89
 
89
90
  ### Modbus register sync
90
91
 
91
- - Pair the MQTT - IoT with `node-red-contrib-modbus` `modbus-flex-write` nodes. Output&nbsp;1 carries the Modbus address in `msg.address` and the value in `msg.payload`.
92
+ The bridge is a message adapter for `node-red-contrib-modbus`; it does not open a TCP/serial connection and does not poll a device. Install a version of that package compatible with your Node-RED runtime, then use its client and transport nodes.
93
+
94
+ |Area|Read|Write|Allowed direction|
95
+ |--|--|--|--|
96
+ | Coil | FC1 | FC5 | Either direction |
97
+ | Discrete input | FC2 | — | Modbus → KNX only |
98
+ | Holding register | FC3 | FC6 | Either direction |
99
+ | Input register | FC4 | — | Modbus → KNX only |
100
+
101
+ For a new mapping select `Format = Flex Write compatible`. On KNX → Modbus, Output&nbsp;1 can be wired directly to a `modbus-flex-write` node and emits:
102
+
103
+ ```
104
+ msg.payload = {
105
+ value: 215,
106
+ fc: 6,
107
+ unitid: 1,
108
+ address: 9,
109
+ quantity: 1
110
+ }
111
+ ```
112
+
113
+ `address` is always zero-based: if a device manual labels a holding register as `40010`, its protocol address is commonly `9`; verify the convention in that manual. The bridge supports one bit or one 16-bit register per mapping. It does not currently combine words, decode 32-bit/float values or manage byte/word order.
114
+
115
+ For Modbus → KNX, wire the data output of a `modbus-flex-getter` or `modbus-read` node to the bridge input. A Flex Getter provides the request (`fc`, `unitid`, `address`, `quantity`) in `msg.modbusRequest`; a Modbus Read node preserves it in `msg.input.payload`. The returned values array may be in `msg.payload` or `msg.values`. The bridge supports both message shapes, matches every Flex mapping covered by the response and uses the appropriate array element. Enable **Keep Msg Properties** on Flex Getter. Scale and offset are applied as `raw = KNX × scale + offset`; the incoming path applies the inverse transformation.
116
+
117
+ `Read KNX values on deploy` reads KNX only; schedule Modbus reads in the external Modbus flow. Legacy mappings (including mappings without `modbusMessageFormat`) continue to emit the previous scalar payload plus top-level `msg.address`/`msg.modbusFunction` metadata.
92
118
 
93
119
  ## Sample Flow
94
120
 
@@ -79,6 +79,10 @@
79
79
  "target": "Target",
80
80
  "method": "HTTP method",
81
81
  "modbusFunction": "Modbus function",
82
+ "modbusMessageFormat": "Modbus message format",
83
+ "modbusUnitId": "Unit ID",
84
+ "modbusArea": "Modbus area",
85
+ "modbusDataType": "Data type",
82
86
  "scale": "Scale",
83
87
  "offset": "Offset",
84
88
  "timeout": "Timeout (ms)",
@@ -103,7 +107,7 @@
103
107
  "target": "Topic, URL or register",
104
108
  "target_mqtt": "Topic, e.g. knx/light/living",
105
109
  "target_rest": "https://example/api/endpoint",
106
- "target_modbus": "Register (e.g. 40001)",
110
+ "target_modbus": "Zero-based address (e.g. 0)",
107
111
  "template": "{\"value\":{{value}}}",
108
112
  "property": "Optional property/path",
109
113
  "method": "POST",
@@ -114,7 +118,7 @@
114
118
  "default": "Target",
115
119
  "mqtt": "MQTT topic",
116
120
  "rest": "REST URL",
117
- "modbus": "Modbus register"
121
+ "modbus": "Modbus address (zero-based)"
118
122
  },
119
123
  "method": {
120
124
  "default": "HTTP method",
@@ -125,6 +129,20 @@
125
129
  "modbus": "Modbus function"
126
130
  }
127
131
  },
132
+ "modbus": {
133
+ "formatLegacy": "Legacy scalar message",
134
+ "formatFlex": "Flex Write compatible",
135
+ "areaCoil": "Coil (FC1 read / FC5 write)",
136
+ "areaDiscreteInput": "Discrete input (FC2 read only)",
137
+ "areaHoldingRegister": "Holding register (FC3 read / FC6 write)",
138
+ "areaInputRegister": "Input register (FC4 read only)",
139
+ "dataTypeBool": "Boolean",
140
+ "dataTypeUint16": "Unsigned 16-bit",
141
+ "dataTypeInt16": "Signed 16-bit",
142
+ "zeroBasedHint": "Use the zero-based protocol address (0–65535), not the 4xxxx reference printed by some manuals.",
143
+ "flexHint": "Flex emits msg.payload = {value,fc,unitid,address,quantity} for direct wiring to modbus-flex-write.",
144
+ "readOnlyHint": "Discrete inputs and input registers are read-only and can only use Modbus → KNX."
145
+ },
128
146
  "labels": {
129
147
  "outputKnxToIoT": "KNX → IoT stream",
130
148
  "outputIoTToKnx": "IoT → KNX acknowledgements",