node-red-contrib-knx-ultimate 6.3.14 → 6.3.16

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.
@@ -14,14 +14,14 @@ Jede an den Ausgängen 3 und 4 ausgegebene Nachricht enthält außerdem eine Kop
14
14
  ## Befehle (Eingang)
15
15
  Sende `msg.topic`:
16
16
  - `summary` (oder leer): Summary sofort senden
17
- - `reset`: internen Verlauf, Zähler und gelerntes Hausgedächtnis löschen; die KI-Erziehung bleibt unverändert
17
+ - `reset`: internen Verlauf, Zähler, gelerntes Hausgedächtnis und alle gespeicherten Chat-Kontexte löschen; die KI-Erziehung bleibt unverändert
18
18
  - `ask`: Frage an das konfigurierte LLM senden
19
19
  - `confirm` / `cancel`: ausstehende KNX-Befehle ohne erneuten LLM-Aufruf bestätigen oder abbrechen
20
- - `clear_chat`: Gesprächsspeicher der aktuellen Sitzung löschen
20
+ - `clear_chat`: letzte Gesprächsschritte, dauerhafte Anweisungen und ausstehende Befehle der aktuellen Sitzung löschen
21
21
 
22
22
  Für `ask` die Frage in `msg.prompt` (empfohlen), `msg.payload` (String) oder den üblichen Telegram-Feldern `msg.payload.content` / `msg.payload.text` übergeben.
23
23
 
24
- Bei aktiviertem KNX-Steuern werden die letzten Gesprächsschritte im RAM nach `msg.knxAi.sessionId`, `msg.sessionId` oder erkannter Telegram-Chat-ID getrennt. 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"`.
24
+ 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"`.
25
25
  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.
26
26
 
27
27
  ### Aktuelle KNX-Lesewerte
@@ -35,12 +35,19 @@ Der Tab **Chat-Adapter** lädt seine auswählbaren Zuordnungen aus `resources/KN
35
35
 
36
36
  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.
37
37
 
38
+ 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.
39
+
40
+ ### Automatisch erkannte Kamera-Adapter
41
+ 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.
42
+
43
+ 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.
44
+
38
45
  ## Proaktive Hausintelligenz und begrenztes Gedächtnis
39
46
  Der Unterbereich **Proaktives Zuhause & Gedächtnis** in **Gespräche & Zuhause** aktiviert proaktive Benachrichtigungen auf Wunsch des Benutzers. Aus ETS-Hierarchie, Namen, Rollen und DPTs erstellt der Node ein deterministisches semantisches Modell für Rollläden, Fenster, Türen, Licht, Temperatur, Klima, Anwesenheit und Alarme mit italienischen, englischen, deutschen, französischen, spanischen und chinesischen Begriffen. Der erste proaktive Detektor überwacht nur zuverlässig erkannte Nicht-Befehlszustände von Rollläden/Fenstern/Türen. Nach der konfigurierten Offenzeit und außerhalb der Ruhezeiten gibt Ausgang 3 eine lokalisierte Nachricht mit `msg.knxAi.type = "proactive_notification"` aus. Ausgang 4 wird niemals proaktiv verwendet und KNX wird nicht selbstständig verändert; eine spätere Benutzeranfrage durchläuft weiterhin die normale Validierung und Bestätigung.
40
47
 
41
48
  Die letzte Chat-Sitzung wird als Eigentümer gespeichert; alternativ kann **Hauptempfänger / Chat-ID** sie ausdrücklich festlegen. Ein synthetisches `msg.inputMessage` bewahrt den Empfänger, damit der Telegram-Adapter eine spontane Nachricht senden kann. Cooldown und höchstens drei proaktive Nachrichten pro Stunde verhindern eine Nachrichtenflut.
42
49
 
43
- Die gelernte Referenz wird beim Start aus `<userDir>/knxai/memory/knxai-home-memory-<node-id>.md` geladen, alle 15 Minuten atomar neu geschrieben und strikt auf konfigurierbare 64–1.024 KB begrenzt (standardmäßig 256 KB). Sie enthält höchstens 120 wichtige Beobachtungen, 80 aggregierte Gewohnheiten, 80 Benachrichtigungen und 300 semantische ETS-Objekte, niemals einen unbegrenzten Rohtelegrammstrom. Alte Einträge mit niedriger Priorität werden zuerst entfernt. **KI-Erziehung** ist auf 16.000 Zeichen begrenzt und stammt immer aus der Node-Konfiguration: Die KI darf sie als verbindliche Vorgabe lesen, aber weder ändern noch überschreiben. Ist eine Erziehung vorhanden, kann das LLM sie aber nicht auswerten, wird die mögliche Benachrichtigung unterdrückt, statt ihr möglicherweise zu widersprechen.
50
+ Die gemeinsame gelernte Referenz wird beim Start aus `<userDir>/knxai/memory/knxai-home-memory.md` geladen, alle 15 Minuten atomar neu geschrieben und immer strikt auf 5 MB begrenzt. Sie enthält höchstens 120 wichtige Beobachtungen, 80 aggregierte Gewohnheiten, 80 Benachrichtigungen und 300 semantische ETS-Objekte, niemals einen unbegrenzten Rohtelegrammstrom. Alte Einträge mit niedriger Priorität werden zuerst entfernt. **KI-Erziehung** ist auf 16.000 Zeichen begrenzt und stammt immer aus der Node-Konfiguration: Die KI darf sie als verbindliche Vorgabe lesen, aber weder ändern noch überschreiben. Ist eine Erziehung vorhanden, kann das LLM sie aber nicht auswerten, wird die mögliche Benachrichtigung unterdrückt, statt ihr möglicherweise zu widersprechen.
44
51
 
45
52
  ## Praktisches Konfigurationsbeispiel
46
53
  Dieses Beispiel erstellt einen knappen Assistenten, der wichtige Öffnungen meldet, aber akzeptiert, dass der Rollladen im Büro offen bleiben darf:
@@ -52,7 +59,6 @@ Dieses Beispiel erstellt einen knappen Assistenten, der wichtige Öffnungen meld
52
59
  | **Nach offener Dauer benachrichtigen** (`proactiveOpenMinutes`) | `120` | Nach zwei Stunden wird eine mögliche Meldung bewertet. |
53
60
  | **Ruhezeit Beginn / Ende** | `23:00` / `07:00` | Nachts werden keine proaktiven Nachrichten ausgegeben. |
54
61
  | **Wiederholungs-Cooldown** (`proactiveCooldownMinutes`) | `360` | Dasselbe Objekt meldet sich sechs Stunden lang nicht erneut. |
55
- | **Maximale Hausgedächtnis-Datei** (`homeMemoryMaxKb`) | `256` | Die Markdown-Referenz dieses Nodes bleibt unter 256 KB. |
56
62
 
57
63
  Beispiel für **KI-Erziehung** (`aiEducation`):
58
64
 
@@ -116,7 +122,6 @@ KNX AI hört automatisch auf `GroupValue_Write`, `GroupValue_Response` und `Grou
116
122
  - **Ruhezeit Beginn / Ende**: Täglicher Zeitraum, in dem proaktive Nachrichten unterdrückt werden.
117
123
  - **KI-Erziehung**: Verbindliche, ausschließlich vom Benutzer verwaltete Hinweise, die die KI lesen, aber nie ändern darf.
118
124
  - **Wiederholungs-Cooldown (Minuten)**: Mindestintervall vor einer weiteren Meldung desselben Objekts; standardmäßig 360 Minuten.
119
- - **Maximale Hausgedächtnis-Datei (KB)**: Harte Grenze von 64 bis 1.024 KB; standardmäßig 256 KB.
120
125
  - Wenn das Festplattenarchiv aktiv ist, nutzt **Ask** standardmäßig dieses Archiv: explizite Datumsangaben/Zeitbereiche werden beachtet, sonst durchsucht der Assistent die letzten 24 Stunden plus aktuelle RAM-Events.
121
126
  - **Node-RED-Projektinventar einbeziehen**: Nimmt das gesamte Node-RED-Projektinventar in den Prompt auf, einschließlich KNX-Nodes und anderer hilfreicher Nodes wie function/change/inject/template, wenn sie KNX-Logik oder Gruppenadressen enthalten.
122
127
  - Relevante Auszüge aus Hilfe, README und Beispielen werden immer automatisch einbezogen.
@@ -4,6 +4,7 @@
4
4
  "sections": {
5
5
  "groupAssistant": "KI-Assistent",
6
6
  "groupChatHome": "Gespräche & Zuhause",
7
+ "detectedAdapters": "Automatisch erkannte Adapter",
7
8
  "groupKnxAnalysis": "KNX-Verkehrsanalyse",
8
9
  "quickSetup": "Assistent einrichten",
9
10
  "capture": "Bus-Telegrammeingang",
@@ -57,7 +58,6 @@
57
58
  "proactiveCooldownMinutes": "Wiederholsperre (Minuten)",
58
59
  "proactiveQuietStart": "Beginn der Ruhezeit",
59
60
  "proactiveQuietEnd": "Ende der Ruhezeit",
60
- "homeMemoryMaxKb": "Maximale Hausgedächtnisdatei (KB)",
61
61
  "aiEducation": "KI-Erziehung (vom Benutzer verwaltet)",
62
62
  "llmIncludeDocsSnippets": "Include documentation snippets (help/README/examples)",
63
63
  "llmDocsLanguage": "Docs language"
@@ -94,11 +94,16 @@
94
94
  "installOllamaModelFailed": "Failed to install Ollama model",
95
95
  "ollamaInstallSteps": "1) Open the model library and copy the model name (for example llama3.1). 2) Put the name in the Model field and click Install it.",
96
96
  "ollamaStartedAuto": "Ollama server started automatically.",
97
+ "detectedAdaptersLoading": "Installierte Adapter werden erkannt…",
98
+ "detectedAdaptersNone": "Kein automatischer Adapter erkannt.",
99
+ "detectedAdaptersUnavailable": "Die automatische Adaptererkennung ist vorübergehend nicht verfügbar.",
100
+ "detectedAdapterDetected": "Erkannt",
101
+ "detectedAdapterControllers": "Controller",
102
+ "detectedAdapterCameras": "Kameras",
97
103
  "chatAdapterIntro": "Wählen Sie eine Vorlage, um den Code für Ein- und Ausgang einzufügen. Die Liste wird aus der mitgelieferten Chat-Adapter-Datei geladen; der erzeugte Code bleibt bearbeitbar.",
98
104
  "chatAdapterCodeHelp": "Zuordnungen laufen synchron. Geben Sie msg zurück, um fortzufahren, oder keinen Wert, um die Nachricht zu verwerfen. Fehler werden abgefangen und gemeldet, ohne Node-RED anzuhalten.",
99
105
  "homeIntelligenceIntro": "Der Node erstellt ein mehrsprachiges semantisches ETS-Modell und kann den Chat benachrichtigen, wenn ein zuverlässig erkannter Rollladen, ein Fenster oder eine Tür offen bleibt. Er sendet niemals selbstständig einen KNX-Befehl.",
100
- "aiEducationHelp": "Nur der Benutzer kann diesen Abschnitt bearbeiten. Die KI liest ihn als verbindliche Vorgabe; gelernte Erinnerungen können ihn niemals überschreiben. Maximal 16.000 Zeichen.",
101
- "homeMemoryLimitHelp": "Das Markdown-Gedächtnis wird alle 15 Minuten atomar neu geschrieben und bleibt stets auf 64 bis 1.024 KB begrenzt. Alte Beobachtungen werden vor Gewohnheiten und semantischen Objekten entfernt."
106
+ "aiEducationHelp": "Nur der Benutzer kann diesen Abschnitt bearbeiten. Die KI liest ihn als verbindliche Vorgabe; gelernte Erinnerungen können ihn niemals überschreiben. Maximal 16.000 Zeichen."
102
107
  },
103
108
  "sidebar": {
104
109
  "ui": {
@@ -14,14 +14,14 @@ Every message emitted by outputs 3 and 4 also contains a clone of the original i
14
14
  ## Commands (input)
15
15
  Send `msg.topic`:
16
16
  - `summary` (or empty): emit summary immediately
17
- - `reset`: clear internal history, counters and learned home memory; AI Education remains unchanged
17
+ - `reset`: clear internal history, counters, learned home memory, and every persisted chat context; AI Education remains unchanged
18
18
  - `ask`: send a question to the configured LLM
19
19
  - `confirm` / `cancel`: confirm or cancel pending KNX commands without calling the LLM
20
- - `clear_chat`: clear the conversation memory for the current session
20
+ - `clear_chat`: clear recent turns, persistent instructions, and pending commands for the current session
21
21
 
22
22
  For `ask`, provide the question in `msg.prompt` (preferred), `msg.payload` (string), or the common Telegram fields `msg.payload.content` / `msg.payload.text`.
23
23
 
24
- When KNX control is enabled, recent turns are remembered in RAM per `msg.knxAi.sessionId`, `msg.sessionId`, or a detected Telegram chat ID. 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"`.
24
+ 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"`.
25
25
  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.
26
26
 
27
27
  ### Fresh KNX reads
@@ -35,12 +35,19 @@ The **Chat adapters** tab loads its selectable mappings from `resources/KNXAICha
35
35
 
36
36
  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.
37
37
 
38
+ 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.
39
+
40
+ ### Automatically detected camera adapters
41
+ 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.
42
+
43
+ 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.
44
+
38
45
  ## Proactive home intelligence and bounded memory
39
46
  The **Proactive home & memory** subsection inside **Conversations & home** enables opt-in proactive notifications. 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. The first proactive detector watches only reliably recognized non-command cover/window/door states. After the configured open duration and outside quiet hours, output 3 emits a localized message with `msg.knxAi.type = "proactive_notification"`. It never emits output 4 or changes KNX autonomously; a subsequent user request still uses the normal validation and confirmation workflow.
40
47
 
41
48
  The most recent chat session is remembered as the owner, or **Primary recipient / chat ID** can set it explicitly. A synthetic `msg.inputMessage` preserves this recipient so the Telegram adapter can send an unsolicited notification. Cooldown and a maximum of three proactive messages per hour prevent flooding.
42
49
 
43
- The learned reference is loaded at startup from `<userDir>/knxai/memory/knxai-home-memory-<node-id>.md`, rewritten atomically every 15 minutes and hard-capped to the configured 64–1,024 KB (256 KB by default). It stores at most 120 significant observations, 80 aggregate habits, 80 notifications and 300 semantic ETS objects—never a raw unlimited telegram stream. Older low-priority entries are removed first. **AI Education** is limited to 16,000 characters and always comes from the node configuration: the AI can read it as authoritative guidance but cannot modify or overwrite it. When Education is present but the LLM cannot evaluate it, the candidate notification is suppressed rather than risking a contradiction.
50
+ The shared learned reference is loaded at startup from `<userDir>/knxai/memory/knxai-home-memory.md`, rewritten atomically every 15 minutes and always hard-capped at 5 MB. It stores at most 120 significant observations, 80 aggregate habits, 80 notifications and 300 semantic ETS objects—never a raw unlimited telegram stream. Older low-priority entries are removed first. **AI Education** is limited to 16,000 characters and always comes from the node configuration: the AI can read it as authoritative guidance but cannot modify or overwrite it. When Education is present but the LLM cannot evaluate it, the candidate notification is suppressed rather than risking a contradiction.
44
51
 
45
52
  ## Practical configuration example
46
53
  This example creates a concise assistant that notifies the owner about relevant openings but accepts that the office cover may stay open:
@@ -52,7 +59,6 @@ This example creates a concise assistant that notifies the owner about relevant
52
59
  | **Notify after open** (`proactiveOpenMinutes`) | `120` | A candidate notification is considered after two hours. |
53
60
  | **Quiet hours start / end** | `23:00` / `07:00` | No proactive message is emitted during the night. |
54
61
  | **Repeat cooldown** (`proactiveCooldownMinutes`) | `360` | The same object cannot notify again for six hours. |
55
- | **Maximum home-memory file** (`homeMemoryMaxKb`) | `256` | The per-node Markdown reference can never exceed 256 KB. |
56
62
 
57
63
  Example for **AI Education** (`aiEducation`):
58
64
 
@@ -121,7 +127,6 @@ KNX AI automatically listens to `GroupValue_Write`, `GroupValue_Response`, and `
121
127
  - **Quiet hours start / end**: Daily interval in which proactive messages are suppressed.
122
128
  - **AI Education**: User-only, authoritative guidance read by the AI and never modified by it.
123
129
  - **Repeat cooldown (minutes)**: Minimum interval before the same object may notify again; 360 minutes by default.
124
- - **Maximum home-memory file (KB)**: Hard size limit from 64 to 1,024 KB; 256 KB by default.
125
130
  - If disk archive is enabled, **Ask** uses the archive by default: explicit dates/ranges are honored, otherwise the assistant searches the last 24 hours plus current RAM events.
126
131
  - **Include Node-RED project inventory**: Include the whole Node-RED project inventory in the prompt, including KNX nodes and other useful nodes such as function/change/inject/template when they contain KNX-related logic or group addresses.
127
132
  - Relevant help, README, and example snippets are always included automatically.
@@ -4,6 +4,7 @@
4
4
  "sections": {
5
5
  "groupAssistant": "AI assistant",
6
6
  "groupChatHome": "Conversations & home",
7
+ "detectedAdapters": "Automatically detected adapters",
7
8
  "groupKnxAnalysis": "KNX traffic analysis",
8
9
  "quickSetup": "Assistant setup",
9
10
  "capture": "Bus telegram input",
@@ -57,7 +58,6 @@
57
58
  "proactiveCooldownMinutes": "Repeat cooldown (minutes)",
58
59
  "proactiveQuietStart": "Quiet hours start",
59
60
  "proactiveQuietEnd": "Quiet hours end",
60
- "homeMemoryMaxKb": "Maximum home-memory file (KB)",
61
61
  "aiEducation": "AI Education (user managed)",
62
62
  "llmIncludeDocsSnippets": "Include documentation snippets (help/README/examples)",
63
63
  "llmDocsLanguage": "Docs language"
@@ -94,11 +94,16 @@
94
94
  "installOllamaModelFailed": "Failed to install Ollama model",
95
95
  "ollamaInstallSteps": "1) Open the model library and copy the model name (for example llama3.1). 2) Put the name in the Model field and click Install it.",
96
96
  "ollamaStartedAuto": "Ollama server started automatically.",
97
+ "detectedAdaptersLoading": "Detecting installed adapters…",
98
+ "detectedAdaptersNone": "No automatic adapter detected.",
99
+ "detectedAdaptersUnavailable": "Automatic adapter detection is temporarily unavailable.",
100
+ "detectedAdapterDetected": "Detected",
101
+ "detectedAdapterControllers": "Controllers",
102
+ "detectedAdapterCameras": "Cameras",
97
103
  "chatAdapterIntro": "Choose a mapping preset to insert its input and output code. The list is loaded from the packaged chat-adapter mappings file; the generated code remains editable.",
98
104
  "chatAdapterCodeHelp": "Mappings run synchronously. Return msg to continue or return no value to discard it. Errors are caught and reported without stopping Node-RED.",
99
105
  "homeIntelligenceIntro": "The node builds a multilingual semantic ETS model and can notify the chat when a reliably recognized cover, window, or door remains open. It never sends a KNX command proactively.",
100
- "aiEducationHelp": "Only the user can edit this section. The AI reads it as authoritative guidance, but learned-memory updates can never overwrite it. Maximum 16,000 characters.",
101
- "homeMemoryLimitHelp": "The Markdown memory is rewritten atomically every 15 minutes and is always capped between 64 and 1,024 KB. Old observations are pruned before habits and semantic objects."
106
+ "aiEducationHelp": "Only the user can edit this section. The AI reads it as authoritative guidance, but learned-memory updates can never overwrite it. Maximum 16,000 characters."
102
107
  },
103
108
  "placeholder": {
104
109
  "llmBaseUrl": "https://api.openai.com/v1/chat/completions (or your compatible endpoint)",
@@ -14,14 +14,14 @@ Cada mensaje emitido por las salidas 3 y 4 también contiene una copia del mensa
14
14
  ## Comandos (entrada)
15
15
  Envía `msg.topic`:
16
16
  - `summary` (o vacío): emite el resumen inmediatamente
17
- - `reset`: borra el historial, los contadores y la memoria del hogar aprendida; la Educación de la IA permanece sin cambios
17
+ - `reset`: borra el historial, los contadores, la memoria del hogar aprendida y todos los contextos de chat persistentes; la Educación de la IA permanece sin cambios
18
18
  - `ask`: envía una pregunta al LLM configurado
19
19
  - `confirm` / `cancel`: confirma o cancela los comandos KNX pendientes sin volver a llamar al LLM
20
- - `clear_chat`: borra la memoria de conversación de la sesión actual
20
+ - `clear_chat`: borra los turnos recientes, las instrucciones persistentes y los comandos pendientes de la sesión actual
21
21
 
22
22
  Para `ask`, envía la pregunta en `msg.prompt` (recomendado), `msg.payload` (string), o los campos comunes de Telegram `msg.payload.content` / `msg.payload.text`.
23
23
 
24
- Cuando el control KNX está habilitado, los turnos recientes se guardan en RAM por `msg.knxAi.sessionId`, `msg.sessionId` o el ID de chat Telegram detectado. Conecta la salida 3 al nodo emisor del chat y la salida 4 a un nodo KNX Ultimate en **modo universal**. Con la confirmación activa, la primera respuesta muestra GA, DPT y payload sin emitir escrituras; la misma sesión debe responder `CONFIRMAR` o `CANCELAR` en 5 minutos. Una solicitud nueva sustituye cualquier plan anterior. Cada comando confirmado contiene `msg.destination`, `msg.dpt`, `msg.payload` y `msg.event = "GroupValue_Write"`.
24
+ Cada sesión Ask/chat conserva sus últimos 8 turnos y hasta 20 instrucciones explícitas a largo plazo, separadas por `msg.knxAi.sessionId`, `msg.sessionId` o el ID de chat Telegram detectado. Solicitudes como «Recuerda no usar el término unknown» se convierten en instrucciones persistentes. Todos los nodos KNX AI que usan el mismo almacenamiento comparten este contexto en tiempo real y lo recargan tras reiniciar Node-RED desde `knxultimatestorage/knxai/memory/knxai-chat-context.md`. El archivo se escribe de forma atómica y está limitado a 50 sesiones y 512 KB. Cuando el control KNX está habilitado, conecta la salida 3 al nodo emisor del chat y la salida 4 a un nodo KNX Ultimate en **modo universal**. Con la confirmación activa, la primera respuesta muestra GA, DPT y payload sin emitir escrituras; la misma sesión debe responder `CONFIRMAR` o `CANCELAR` en 5 minutos. Una solicitud nueva sustituye cualquier plan anterior. Cada comando confirmado contiene `msg.destination`, `msg.dpt`, `msg.payload` y `msg.event = "GroupValue_Write"`.
25
25
  Para las escrituras DPT 1.xxx, los equivalentes seguros producidos por la IA `true`/`false`, `1`/`0` y `on`/`off` se normalizan a booleanos reales antes de la validación local y la salida.
26
26
 
27
27
  ### Lecturas KNX actualizadas
@@ -35,12 +35,19 @@ La pestaña **Adaptadores de chat** carga sus mapeos seleccionables desde `resou
35
35
 
36
36
  El preajuste incluido **windkh/node-red-contrib-telegrambot** sigue el contrato receiver/sender del paquete. Conecta directamente un `telegram receiver` a KNX AI y la salida 3 a un `telegram sender`. Para los botones inline de confirmación, conecta también un `telegram event` configurado como `callback_query` a la misma entrada KNX AI. El mapeo de entrada extrae `msg.payload.content`, `msg.payload.chatId` y el idioma de Telegram. El mapeo de salida crea `msg.payload.chatId`, `type` y `content`, y añade `options.reply_markup` desde `msg.knxAi.confirmationRequest` cuando una escritura espera confirmación. El paquete Telegram sigue siendo una dependencia opcional separada.
37
37
 
38
+ El preajuste incluido **RedBot / node-red-contrib-chatbot (Telegram)** sigue el formato común de mensajes de RedBot. Conecta directamente `chatbot-telegram-receive` a KNX AI y la salida 3 a `chatbot-telegram-send`; no hace falta un nodo callback separado porque RedBot convierte los postbacks de los botones inline en mensajes de entrada normales. El mapeo de entrada lee `transport`, `chatId`, `type`, `content` y el idioma de Telegram. El mapeo de salida conserva los datos de seguimiento RedBot `originalMessage`, `chat`, `api` y `client`, y después emite un payload `message` o un payload `inline-buttons` con acciones `postback` de confirmación. RedBot sigue siendo una dependencia opcional separada.
39
+
40
+ ### Adaptadores de cámara detectados automáticamente
41
+ Los paquetes de cámaras instalados pueden publicar en tiempo de ejecución un adaptador para KNX AI. No hay selector ni nodo de cámara que conectar a KNX AI: los adaptadores, controladores y cámaras disponibles se detectan automáticamente y se incorporan al contexto del chat. `node-red-contrib-unifi-ultimate` es el primer proveedor compatible; otros paquetes, como `hikvision-ultimate`, pueden registrarse mediante el mismo contrato independiente del fabricante.
42
+
43
+ El usuario puede pedir una captura actual o preguntar al modelo de visión qué se ve. Los preajustes de Telegram y RedBot envían la imagen como foto nativa con pie. También se pueden crear notificaciones persistentes por movimiento, cruce de una línea inteligente o entrada en una zona de intrusión/merodeo, limitadas opcionalmente a personas detectadas y a una línea o zona concreta por nombre. Estas reglas se guardan en el mismo archivo `knxai-chat-context.md` y se restauran después de reiniciar Node-RED. Las suscripciones a eventos UniFi y las solicitudes de captura se realizan directamente a través del proveedor detectado; no interviene la salida 4 de KNX AI ni hace falta cableado intermedio en el flujo.
44
+
38
45
  ## Inteligencia doméstica proactiva y memoria limitada
39
46
  La subsección **Hogar proactivo y memoria** dentro de **Conversaciones y hogar** activa las notificaciones proactivas de forma opcional. A partir de la jerarquía ETS, nombres, roles y DPT, el nodo crea un modelo semántico determinista para persianas, ventanas, puertas, luces, temperatura, clima, presencia y alarmas usando términos italianos, ingleses, alemanes, franceses, españoles y chinos. El primer detector proactivo vigila únicamente estados que no sean de comando de persianas/ventanas/puertas reconocidos con suficiente fiabilidad. Tras el tiempo abierto configurado y fuera de las horas silenciosas, la salida 3 emite un mensaje localizado con `msg.knxAi.type = "proactive_notification"`. Nunca emite por la salida 4 ni modifica KNX de manera autónoma; una solicitud posterior del usuario sigue pasando por la validación y confirmación normales.
40
47
 
41
48
  La última sesión de chat se recuerda como propietario, o **Destinatario principal / ID de chat** permite definirla explícitamente. Un `msg.inputMessage` sintético conserva el destinatario para que el adaptador de Telegram pueda enviar una notificación espontánea. El tiempo de espera y el máximo de tres notificaciones proactivas por hora evitan inundar el chat.
42
49
 
43
- La referencia aprendida se carga al arrancar desde `<userDir>/knxai/memory/knxai-home-memory-<node-id>.md`, se reescribe atómicamente cada 15 minutos y queda estrictamente limitada entre 64 y 1.024 KB configurables (256 KB de forma predeterminada). Conserva como máximo 120 observaciones importantes, 80 hábitos agregados, 80 notificaciones y 300 objetos ETS semánticos, nunca un flujo ilimitado de telegramas raw. Los elementos antiguos y de menor prioridad se eliminan primero. **Educación IA** está limitada a 16.000 caracteres y siempre procede de la configuración del nodo: la IA puede leerla como instrucción autoritativa, pero no modificarla ni sobrescribirla. Si existe Educación pero el LLM no puede evaluarla, la notificación candidata se suprime en lugar de arriesgarse a contradecirla.
50
+ La referencia aprendida compartida se carga al arrancar desde `<userDir>/knxai/memory/knxai-home-memory.md`, se reescribe atómicamente cada 15 minutos y siempre queda estrictamente limitada a 5 MB. Conserva como máximo 120 observaciones importantes, 80 hábitos agregados, 80 notificaciones y 300 objetos ETS semánticos, nunca un flujo ilimitado de telegramas raw. Los elementos antiguos y de menor prioridad se eliminan primero. **Educación IA** está limitada a 16.000 caracteres y siempre procede de la configuración del nodo: la IA puede leerla como instrucción autoritativa, pero no modificarla ni sobrescribirla. Si existe Educación pero el LLM no puede evaluarla, la notificación candidata se suprime en lugar de arriesgarse a contradecirla.
44
51
 
45
52
  ## Ejemplo práctico de configuración
46
53
  Este ejemplo crea un asistente conciso que avisa sobre aperturas importantes, pero acepta que la persiana del despacho permanezca abierta:
@@ -52,7 +59,6 @@ Este ejemplo crea un asistente conciso que avisa sobre aperturas importantes, pe
52
59
  | **Avisar después de abierta** (`proactiveOpenMinutes`) | `120` | Se evalúa una posible notificación después de dos horas. |
53
60
  | **Inicio / fin de horas silenciosas** | `23:00` / `07:00` | No se emiten mensajes proactivos durante la noche. |
54
61
  | **Tiempo de espera de repetición** (`proactiveCooldownMinutes`) | `360` | El mismo objeto no vuelve a avisar durante seis horas. |
55
- | **Archivo máximo de memoria del hogar** (`homeMemoryMaxKb`) | `256` | La referencia Markdown de este nodo permanece por debajo de 256 KB. |
56
62
 
57
63
  Ejemplo para **Educación IA** (`aiEducation`):
58
64
 
@@ -116,7 +122,6 @@ KNX AI escucha automáticamente los telegramas `GroupValue_Write`, `GroupValue_R
116
122
  - **Inicio / fin de horas silenciosas**: intervalo diario en el que se suprimen los mensajes proactivos.
117
123
  - **Educación de la IA**: instrucciones vinculantes gestionadas solo por el usuario, leídas por la IA y nunca modificadas.
118
124
  - **Tiempo de espera de repetición (minutos)**: intervalo mínimo antes de que el mismo objeto pueda volver a avisar; 360 minutos por defecto.
119
- - **Archivo máximo de memoria del hogar (KB)**: límite estricto de 64 a 1.024 KB; 256 KB por defecto.
120
125
  - Si el archivo en disco esta activo, **Ask** lo usa por defecto: respeta fechas/rangos explicitos y, si no los indicas, busca en las ultimas 24 horas mas los eventos actuales en RAM.
121
126
  - **Incluir inventario del proyecto Node-RED**: incluye en el prompt el inventario de todo el proyecto Node-RED, con nodos KNX y otros nodos utiles como function/change/inject/template cuando contienen logica KNX o direcciones de grupo.
122
127
  - Los fragmentos pertinentes de la ayuda, README y ejemplos se incluyen siempre de forma automática.
@@ -4,6 +4,7 @@
4
4
  "sections": {
5
5
  "groupAssistant": "Asistente IA",
6
6
  "groupChatHome": "Conversaciones y hogar",
7
+ "detectedAdapters": "Adaptadores detectados automáticamente",
7
8
  "groupKnxAnalysis": "Análisis del tráfico KNX",
8
9
  "quickSetup": "Configurar el asistente",
9
10
  "capture": "Telegramas del bus",
@@ -57,7 +58,6 @@
57
58
  "proactiveCooldownMinutes": "Espera antes de repetir (minutos)",
58
59
  "proactiveQuietStart": "Inicio de horas silenciosas",
59
60
  "proactiveQuietEnd": "Fin de horas silenciosas",
60
- "homeMemoryMaxKb": "Tamaño máximo de memoria del hogar (KB)",
61
61
  "aiEducation": "Educación IA (gestionada por el usuario)",
62
62
  "llmIncludeDocsSnippets": "Include documentation snippets (help/README/examples)",
63
63
  "llmDocsLanguage": "Docs language"
@@ -86,11 +86,16 @@
86
86
  "installOllamaModelFailed": "Failed to install Ollama model",
87
87
  "ollamaInstallSteps": "1) Open the model library and copy the model name (for example llama3.1). 2) Put the name in the Model field and click Install it.",
88
88
  "ollamaStartedAuto": "Ollama server started automatically.",
89
+ "detectedAdaptersLoading": "Detectando adaptadores instalados…",
90
+ "detectedAdaptersNone": "No se detectó ningún adaptador automático.",
91
+ "detectedAdaptersUnavailable": "La detección automática de adaptadores no está disponible temporalmente.",
92
+ "detectedAdapterDetected": "Detectado",
93
+ "detectedAdapterControllers": "Controladores",
94
+ "detectedAdapterCameras": "Cámaras",
89
95
  "chatAdapterIntro": "Elige un preajuste para insertar su código de mapeo de entrada y salida. La lista se carga desde el archivo de adaptadores de chat incluido; el código generado sigue siendo editable.",
90
96
  "chatAdapterCodeHelp": "Los mapeos se ejecutan de forma síncrona. Devuelve msg para continuar o ningún valor para descartarlo. Los errores se capturan y notifican sin detener Node-RED.",
91
97
  "homeIntelligenceIntro": "El nodo crea un modelo ETS semántico multilingüe y puede avisar al chat cuando una persiana, ventana o puerta reconocida con suficiente fiabilidad permanece abierta. Nunca envía por sí solo un comando KNX.",
92
- "aiEducationHelp": "Solo el usuario puede editar esta sección. La IA la lee como una instrucción autoritativa, pero la memoria aprendida nunca puede sobrescribirla. Máximo 16.000 caracteres.",
93
- "homeMemoryLimitHelp": "La memoria Markdown se reescribe atómicamente cada 15 minutos y siempre queda limitada entre 64 y 1.024 KB. Las observaciones antiguas se eliminan antes que los hábitos y los objetos semánticos."
98
+ "aiEducationHelp": "Solo el usuario puede editar esta sección. La IA la lee como una instrucción autoritativa, pero la memoria aprendida nunca puede sobrescribirla. Máximo 16.000 caracteres."
94
99
  },
95
100
  "placeholder": {
96
101
  "llmBaseUrl": "https://api.openai.com/v1/chat/completions (or your compatible endpoint)",
@@ -14,14 +14,14 @@ Chaque message émis par les sorties 3 et 4 contient également une copie du mes
14
14
  ## Commandes (entrée)
15
15
  Envoyez `msg.topic` :
16
16
  - `summary` (ou vide) : envoie le résumé immédiatement
17
- - `reset` : efface l'historique, les compteurs et la mémoire domestique apprise ; l'Éducation de l'IA reste inchangée
17
+ - `reset` : efface l'historique, les compteurs, la mémoire domestique apprise et tous les contextes de chat persistants ; l'Éducation de l'IA reste inchangée
18
18
  - `ask` : envoie une question au LLM configuré
19
19
  - `confirm` / `cancel` : confirme ou annule les commandes KNX en attente sans rappeler le LLM
20
- - `clear_chat` : efface la mémoire de conversation de la session courante
20
+ - `clear_chat` : efface les échanges récents, les instructions persistantes et les commandes en attente de la session courante
21
21
 
22
22
  Pour `ask`, mettez la question dans `msg.prompt` (recommandé), `msg.payload` (chaîne), ou les champs Telegram courants `msg.payload.content` / `msg.payload.text`.
23
23
 
24
- Lorsque le contrôle KNX est activé, les échanges récents sont conservés en RAM par `msg.knxAi.sessionId`, `msg.sessionId` ou ID de chat Telegram détecté. Reliez la sortie 3 au nœud d'envoi du chat et la sortie 4 à un nœud KNX Ultimate en **mode universel**. Avec la confirmation active, la première réponse affiche GA, DPT et payload sans émettre d’écriture ; la même session doit répondre `CONFIRMER` ou `ANNULER` dans les 5 minutes. Une nouvelle demande remplace tout plan précédent. Chaque commande confirmée contient `msg.destination`, `msg.dpt`, `msg.payload` et `msg.event = "GroupValue_Write"`.
24
+ Chaque session Ask/chat conserve ses 8 derniers échanges et jusqu'à 20 instructions explicites à long terme, séparées par `msg.knxAi.sessionId`, `msg.sessionId` ou l’ID de chat Telegram détecté. Les demandes telles que « Souviens-toi de ne pas employer le terme unknown » deviennent des instructions persistantes. Tous les nœuds KNX AI utilisant le même stockage partagent ce contexte en direct et le rechargent après un redémarrage de Node-RED depuis `knxultimatestorage/knxai/memory/knxai-chat-context.md`. Le fichier, écrit de façon atomique, est limité à 50 sessions et 512 Ko. Lorsque le contrôle KNX est activé, reliez la sortie 3 au nœud d'envoi du chat et la sortie 4 à un nœud KNX Ultimate en **mode universel**. Avec la confirmation active, la première réponse affiche GA, DPT et payload sans émettre d’écriture ; la même session doit répondre `CONFIRMER` ou `ANNULER` dans les 5 minutes. Une nouvelle demande remplace tout plan précédent. Chaque commande confirmée contient `msg.destination`, `msg.dpt`, `msg.payload` et `msg.event = "GroupValue_Write"`.
25
25
  Pour les écritures DPT 1.xxx, les équivalents sûrs produits par l’IA `true`/`false`, `1`/`0` et `on`/`off` sont normalisés en véritables booléens avant la validation locale et la sortie.
26
26
 
27
27
  ### Lectures KNX actualisées
@@ -35,12 +35,19 @@ L’onglet **Adaptateurs de chat** charge ses mappages sélectionnables depuis `
35
35
 
36
36
  Le préréglage inclus **windkh/node-red-contrib-telegrambot** suit le contrat receiver/sender du paquet. Connectez directement un `telegram receiver` à KNX AI et la sortie 3 à un `telegram sender`. Pour les boutons de confirmation inline, connectez aussi un `telegram event` configuré pour `callback_query` à la même entrée KNX AI. Le mappage d’entrée extrait `msg.payload.content`, `msg.payload.chatId` et la langue Telegram. Le mappage de sortie crée `msg.payload.chatId`, `type` et `content`, puis ajoute `options.reply_markup` depuis `msg.knxAi.confirmationRequest` lorsqu’une écriture attend confirmation. Le paquet Telegram reste une dépendance optionnelle distincte.
37
37
 
38
+ Le préréglage inclus **RedBot / node-red-contrib-chatbot (Telegram)** suit le format de message commun de RedBot. Connectez directement `chatbot-telegram-receive` à KNX AI et la sortie 3 à `chatbot-telegram-send` ; aucun nœud de callback séparé n’est nécessaire, car RedBot convertit les postbacks des boutons inline en messages entrants ordinaires. Le mappage d’entrée lit `transport`, `chatId`, `type`, `content` et la langue Telegram. Le mappage de sortie conserve les données de suivi RedBot `originalMessage`, `chat`, `api` et `client`, puis émet soit un payload `message`, soit un payload `inline-buttons` avec des actions `postback` de confirmation. RedBot reste une dépendance optionnelle distincte.
39
+
40
+ ### Adaptateurs de caméra détectés automatiquement
41
+ Les paquets de caméra installés peuvent publier à l’exécution un adaptateur pour KNX AI. Il n’existe aucun sélecteur ni nœud caméra à relier à KNX AI : les adaptateurs, contrôleurs et caméras disponibles sont détectés automatiquement et ajoutés au contexte du chat. `node-red-contrib-unifi-ultimate` est le premier fournisseur pris en charge ; d’autres paquets, tels que `hikvision-ultimate`, peuvent s’enregistrer avec le même contrat indépendant du fabricant.
42
+
43
+ L’utilisateur peut demander une capture actuelle ou demander au modèle de vision ce qui est visible. Les préréglages Telegram et RedBot envoient l’image comme photo native avec une légende. L’utilisateur peut aussi créer des notifications persistantes pour un mouvement, le franchissement d’une ligne intelligente ou l’entrée dans une zone d’intrusion/de stationnement, avec une limitation facultative aux personnes détectées et à une ligne ou zone nommée précise. Ces règles sont stockées dans le même fichier `knxai-chat-context.md` et restaurées après les redémarrages de Node-RED. Les abonnements aux événements UniFi et les demandes de capture passent directement par le fournisseur détecté ; la sortie 4 de KNX AI et un câblage intermédiaire ne sont pas nécessaires.
44
+
38
45
  ## Intelligence domestique proactive et mémoire limitée
39
46
  La sous-section **Maison proactive et mémoire** de **Conversations et maison** active les notifications proactives sur choix de l’utilisateur. À partir de la hiérarchie ETS, des noms, rôles et DPT, le nœud crée un modèle sémantique déterministe pour les volets, fenêtres, portes, éclairages, températures, climat, présence et alarmes avec des termes italiens, anglais, allemands, français, espagnols et chinois. Le premier détecteur proactif surveille uniquement les états hors commande de volets/fenêtres/portes reconnus avec une fiabilité suffisante. Après la durée d’ouverture configurée et hors heures silencieuses, la sortie 3 émet un message localisé avec `msg.knxAi.type = "proactive_notification"`. Il n’émet jamais sur la sortie 4 et ne modifie jamais KNX de façon autonome ; une demande ultérieure de l’utilisateur passe toujours par la validation et la confirmation normales.
40
47
 
41
48
  La dernière session de chat est mémorisée comme propriétaire, ou **Destinataire principal / ID de chat** permet de la définir explicitement. Un `msg.inputMessage` synthétique conserve le destinataire afin que l’adaptateur Telegram puisse envoyer une notification spontanée. Le délai de répétition et la limite de trois notifications proactives par heure évitent les rafales.
42
49
 
43
- La référence apprise est chargée au démarrage depuis `<userDir>/knxai/memory/knxai-home-memory-<node-id>.md`, réécrite atomiquement toutes les 15 minutes et strictement limitée entre 64 et 1 024 Ko configurables (256 Ko par défaut). Elle conserve au maximum 120 observations importantes, 80 habitudes agrégées, 80 notifications et 300 objets ETS sémantiques, jamais un flux illimité de télégrammes bruts. Les éléments anciens et moins prioritaires sont supprimés en premier. **Éducation IA** est limitée à 16 000 caractères et provient toujours de la configuration du nœud : l’IA peut la lire comme une consigne faisant autorité, mais ne peut ni la modifier ni l’écraser. Si cette Éducation est présente mais que le LLM ne peut pas l’évaluer, la notification candidate est supprimée plutôt que de risquer de la contredire.
50
+ La référence apprise partagée est chargée au démarrage depuis `<userDir>/knxai/memory/knxai-home-memory.md`, réécrite atomiquement toutes les 15 minutes et toujours strictement limitée à 5 Mo. Elle conserve au maximum 120 observations importantes, 80 habitudes agrégées, 80 notifications et 300 objets ETS sémantiques, jamais un flux illimité de télégrammes bruts. Les éléments anciens et moins prioritaires sont supprimés en premier. **Éducation IA** est limitée à 16 000 caractères et provient toujours de la configuration du nœud : l’IA peut la lire comme une consigne faisant autorité, mais ne peut ni la modifier ni l’écraser. Si cette Éducation est présente mais que le LLM ne peut pas l’évaluer, la notification candidate est supprimée plutôt que de risquer de la contredire.
44
51
 
45
52
  ## Exemple pratique de configuration
46
53
  Cet exemple crée un assistant concis qui signale les ouvertures importantes, tout en acceptant que le volet du bureau reste ouvert :
@@ -52,7 +59,6 @@ Cet exemple crée un assistant concis qui signale les ouvertures importantes, to
52
59
  | **Notifier après ouverture** (`proactiveOpenMinutes`) | `120` | Une notification potentielle est évaluée après deux heures. |
53
60
  | **Début / fin des heures silencieuses** | `23:00` / `07:00` | Aucun message proactif n’est émis pendant la nuit. |
54
61
  | **Délai de répétition** (`proactiveCooldownMinutes`) | `360` | Le même objet ne peut pas notifier à nouveau pendant six heures. |
55
- | **Taille maximale du fichier mémoire** (`homeMemoryMaxKb`) | `256` | La référence Markdown de ce nœud reste sous 256 Ko. |
56
62
 
57
63
  Exemple pour **Éducation IA** (`aiEducation`) :
58
64
 
@@ -116,7 +122,6 @@ KNX AI écoute automatiquement les télégrammes `GroupValue_Write`, `GroupValue
116
122
  - **Début / fin des heures silencieuses** : intervalle quotidien pendant lequel les messages proactifs sont supprimés.
117
123
  - **Éducation de l’IA** : consignes autoritaires gérées uniquement par l'utilisateur, lues par l'IA et jamais modifiées.
118
124
  - **Délai de répétition (minutes)** : intervalle minimal avant qu'un même objet puisse notifier à nouveau ; 360 minutes par défaut.
119
- - **Taille maximale du fichier mémoire domestique (KB)** : limite stricte de 64 à 1 024 KB ; 256 KB par défaut.
120
125
  - Si l'archive disque est active, **Ask** l'utilise par défaut : les dates/plages explicites sont respectées, sinon l'assistant cherche sur les dernières 24 heures plus les événements RAM courants.
121
126
  - **Inclure l'inventaire du projet Node-RED** : inclut dans le prompt l'inventaire de tout le projet Node-RED, avec les nœuds KNX et d'autres nœuds utiles comme function/change/inject/template lorsqu'ils contiennent de la logique KNX ou des adresses de groupe.
122
127
  - Les extraits pertinents de l’aide, du README et des exemples sont toujours inclus automatiquement.
@@ -4,6 +4,7 @@
4
4
  "sections": {
5
5
  "groupAssistant": "Assistant IA",
6
6
  "groupChatHome": "Conversations et maison",
7
+ "detectedAdapters": "Adaptateurs détectés automatiquement",
7
8
  "groupKnxAnalysis": "Analyse du trafic KNX",
8
9
  "quickSetup": "Configurer l'assistant",
9
10
  "capture": "Télégrammes du bus",
@@ -57,7 +58,6 @@
57
58
  "proactiveCooldownMinutes": "Délai avant répétition (minutes)",
58
59
  "proactiveQuietStart": "Début des heures silencieuses",
59
60
  "proactiveQuietEnd": "Fin des heures silencieuses",
60
- "homeMemoryMaxKb": "Taille maximale de la mémoire maison (Ko)",
61
61
  "aiEducation": "Éducation IA (gérée par l'utilisateur)",
62
62
  "llmIncludeDocsSnippets": "Include documentation snippets (help/README/examples)",
63
63
  "llmDocsLanguage": "Docs language"
@@ -86,11 +86,16 @@
86
86
  "installOllamaModelFailed": "Failed to install Ollama model",
87
87
  "ollamaInstallSteps": "1) Open the model library and copy the model name (for example llama3.1). 2) Put the name in the Model field and click Install it.",
88
88
  "ollamaStartedAuto": "Ollama server started automatically.",
89
+ "detectedAdaptersLoading": "Détection des adaptateurs installés…",
90
+ "detectedAdaptersNone": "Aucun adaptateur automatique détecté.",
91
+ "detectedAdaptersUnavailable": "La détection automatique des adaptateurs est temporairement indisponible.",
92
+ "detectedAdapterDetected": "Détecté",
93
+ "detectedAdapterControllers": "Contrôleurs",
94
+ "detectedAdapterCameras": "Caméras",
89
95
  "chatAdapterIntro": "Choisissez un préréglage pour insérer son code de mappage d’entrée et de sortie. La liste est chargée depuis le fichier d’adaptateurs de chat fourni ; le code généré reste modifiable.",
90
96
  "chatAdapterCodeHelp": "Les mappages s’exécutent de façon synchrone. Renvoyez msg pour continuer ou aucune valeur pour l’écarter. Les erreurs sont interceptées et signalées sans arrêter Node-RED.",
91
97
  "homeIntelligenceIntro": "Le nœud crée un modèle ETS sémantique multilingue et peut avertir le chat lorsqu'un volet, une fenêtre ou une porte reconnu avec suffisamment de fiabilité reste ouvert. Il n'envoie jamais de commande KNX de manière autonome.",
92
- "aiEducationHelp": "Seul l'utilisateur peut modifier cette section. L'IA la lit comme une consigne faisant autorité, mais la mémoire apprise ne peut jamais l'écraser. Maximum 16 000 caractères.",
93
- "homeMemoryLimitHelp": "La mémoire Markdown est réécrite atomiquement toutes les 15 minutes et reste toujours limitée entre 64 et 1 024 Ko. Les anciennes observations sont supprimées avant les habitudes et les objets sémantiques."
98
+ "aiEducationHelp": "Seul l'utilisateur peut modifier cette section. L'IA la lit comme une consigne faisant autorité, mais la mémoire apprise ne peut jamais l'écraser. Maximum 16 000 caractères."
94
99
  },
95
100
  "placeholder": {
96
101
  "llmBaseUrl": "https://api.openai.com/v1/chat/completions (or your compatible endpoint)",
@@ -14,14 +14,14 @@ Ogni messaggio emesso dalle uscite 3 e 4 contiene anche una copia del messaggio
14
14
  ## Comandi (input)
15
15
  Invia `msg.topic`:
16
16
  - `summary` (o vuoto): emette subito la summary
17
- - `reset`: azzera storico, contatori e memoria domestica appresa; Educazione AI resta invariata
17
+ - `reset`: azzera storico, contatori, memoria domestica appresa e tutti i context CHAT persistenti; Educazione AI resta invariata
18
18
  - `ask`: invia una domanda all'LLM configurato
19
19
  - `confirm` / `cancel`: conferma o annulla i comandi KNX in attesa senza richiamare l'LLM
20
- - `clear_chat`: azzera la memoria della conversazione per la sessione corrente
20
+ - `clear_chat`: azzera turni recenti, istruzioni persistenti e comandi in attesa per la sessione corrente
21
21
 
22
22
  Per `ask`, passa la domanda in `msg.prompt` (consigliato), in `msg.payload` (stringa), oppure nei comuni campi Telegram `msg.payload.content` / `msg.payload.text`.
23
23
 
24
- Quando il controllo KNX è abilitato, i turni recenti sono conservati in RAM per `msg.knxAi.sessionId`, `msg.sessionId` o per il chat ID Telegram rilevato. Collega l'uscita 3 al nodo di risposta della chat e l'uscita 4 a un nodo KNX Ultimate configurato in **Modalità Universale**. Con la conferma attiva, la prima risposta mostra GA, DPT e payload delle scritture senza emetterle; la stessa sessione deve poi rispondere `CONFERMA`/`ANNULLA` entro 5 minuti. Una nuova richiesta sostituisce l'eventuale piano precedente. Ogni comando confermato contiene `msg.destination`, `msg.dpt`, `msg.payload` e `msg.event = "GroupValue_Write"`.
24
+ Ogni sessione Ask/chat conserva gli ultimi 8 turni e fino a 20 istruzioni esplicite a lungo termine, separate per `msg.knxAi.sessionId`, `msg.sessionId` o chat ID Telegram rilevato. Richieste come «Ricordati di non usare il termine unknown» diventano istruzioni persistenti. Tutti i nodi KNX AI che usano lo stesso storage condividono questo context in tempo reale e lo ricaricano dopo un riavvio di Node-RED da `knxultimatestorage/knxai/memory/knxai-chat-context.md`. Il file, scritto atomicamente, è limitato a 50 sessioni e 512 KB. Quando il controllo KNX è abilitato, collega l'uscita 3 al nodo di risposta della chat e l'uscita 4 a un nodo KNX Ultimate configurato in **Modalità Universale**. Con la conferma attiva, la prima risposta mostra GA, DPT e payload delle scritture senza emetterle; la stessa sessione deve poi rispondere `CONFERMA`/`ANNULLA` entro 5 minuti. Una nuova richiesta sostituisce l'eventuale piano precedente. Ogni comando confermato contiene `msg.destination`, `msg.dpt`, `msg.payload` e `msg.event = "GroupValue_Write"`.
25
25
  Per le scritture DPT 1.xxx, gli equivalenti sicuri prodotti dall'AI `true`/`false`, `1`/`0` e `on`/`off` vengono normalizzati in un vero booleano prima della validazione locale e dell'uscita.
26
26
 
27
27
  ### Letture KNX aggiornate
@@ -35,12 +35,19 @@ La tab **Adattatori chat** carica le mappature selezionabili da `resources/KNXAI
35
35
 
36
36
  Il preset incluso **windkh/node-red-contrib-telegrambot** segue il contratto receiver/sender del pacchetto. Collega direttamente un `telegram receiver` a KNX AI e l'uscita 3 direttamente a un `telegram sender`; per usare i pulsanti inline di conferma, collega allo stesso ingresso KNX AI anche un `telegram event` configurato come `callback_query`. La mappatura d'ingresso estrae `msg.payload.content`, `msg.payload.chatId` e la lingua Telegram. Quella d'uscita crea i campi richiesti `msg.payload.chatId`, `type` e `content`, aggiungendo `options.reply_markup` da `msg.knxAi.confirmationRequest` quando una scrittura attende conferma. Il pacchetto Telegram resta una dipendenza opzionale separata.
37
37
 
38
+ Il preset incluso **RedBot / node-red-contrib-chatbot (Telegram)** segue il formato comune dei messaggi RedBot. Collega direttamente `chatbot-telegram-receive` a KNX AI e l'uscita 3 direttamente a `chatbot-telegram-send`; non serve un nodo callback separato perché RedBot converte i postback dei pulsanti inline in normali messaggi in ingresso. La mappatura d'ingresso legge `transport`, `chatId`, `type`, `content` e la lingua Telegram. Quella d'uscita conserva i dati di tracciamento RedBot `originalMessage`, `chat`, `api` e `client`, quindi emette un payload `message` oppure un payload `inline-buttons` con azioni `postback` per la conferma. RedBot resta una dipendenza opzionale separata.
39
+
40
+ ### Adapter telecamera rilevati automaticamente
41
+ I pacchetti di telecamere installati possono pubblicare a runtime un adapter per KNX AI. Non esistono selettori né nodi telecamera da collegare a KNX AI: adapter, controller e telecamere disponibili vengono rilevati automaticamente e inseriti nel contesto della chat. `node-red-contrib-unifi-ultimate` è il primo provider supportato; altri pacchetti, come `hikvision-ultimate`, possono registrarsi tramite lo stesso contratto indipendente dal produttore.
42
+
43
+ L'utente può chiedere uno snapshot aggiornato oppure domandare al modello vision che cosa è visibile. I preset Telegram e RedBot inviano l'immagine come foto nativa con didascalia. L'utente può anche creare notifiche persistenti per movimento, attraversamento di una linea intelligente o ingresso in una zona di intrusione/stazionamento, limitandole facoltativamente alle persone rilevate e a una linea o zona nominata esatta. Le regole vengono salvate nello stesso file `knxai-chat-context.md` e ripristinate dopo i riavvii di Node-RED. Le sottoscrizioni agli eventi UniFi e le richieste snapshot avvengono direttamente tramite il provider rilevato: l'uscita 4 di KNX AI non è coinvolta e non servono collegamenti intermedi nel flow.
44
+
38
45
  ## Intelligenza domestica proattiva e memoria limitata
39
46
  La sottosezione **Casa proattiva e memoria** dentro **Conversazioni e casa** abilita le notifiche proattive su scelta dell'utente. Da gerarchia ETS, nomi, ruoli e DPT, il nodo crea un modello semantico deterministico per persiane, finestre, porte, luci, temperatura, clima, presenza e allarmi usando termini italiani, inglesi, tedeschi, francesi, spagnoli e cinesi. Il primo rilevatore proattivo osserva soltanto stati non di comando di persiane/finestre/porte riconosciuti con sufficiente affidabilità. Dopo il tempo di apertura configurato e fuori dalle ore silenziose, l'uscita 3 emette un messaggio localizzato con `msg.knxAi.type = "proactive_notification"`. Non emette mai l'uscita 4 e non modifica autonomamente KNX; un'eventuale richiesta successiva dell'utente passa sempre dalla normale validazione e conferma.
40
47
 
41
48
  L'ultima sessione chat viene ricordata come proprietario, oppure **Destinatario principale / chat ID** consente di impostarla esplicitamente. Un `msg.inputMessage` sintetico conserva il destinatario affinché l'adattatore Telegram possa inviare una notifica spontanea. Il cooldown e il limite di tre notifiche proattive all'ora evitano messaggi ripetuti.
42
49
 
43
- Il riferimento appreso viene caricato all'avvio da `<userDir>/knxai/memory/knxai-home-memory-<node-id>.md`, riscritto atomicamente ogni 15 minuti e limitato rigidamente tra 64 e 1.024 KB configurabili (256 KB per default). Conserva al massimo 120 osservazioni significative, 80 abitudini aggregate, 80 notifiche e 300 oggetti ETS semantici, mai un flusso illimitato di telegrammi raw. Gli elementi vecchi e meno importanti vengono eliminati per primi. **Educazione AI** è limitata a 16.000 caratteri e proviene sempre dalla configurazione del nodo: l'AI può leggerla come istruzione autorevole, ma non può modificarla o sovrascriverla. Se l'Educazione è presente ma l'LLM non riesce a valutarla, la notifica candidata viene soppressa invece di rischiare di contraddirla.
50
+ Il riferimento appreso condiviso viene caricato all'avvio da `<userDir>/knxai/memory/knxai-home-memory.md`, riscritto atomicamente ogni 15 minuti e sempre limitato rigidamente a 5 MB. Conserva al massimo 120 osservazioni significative, 80 abitudini aggregate, 80 notifiche e 300 oggetti ETS semantici, mai un flusso illimitato di telegrammi raw. Gli elementi vecchi e meno importanti vengono eliminati per primi. **Educazione AI** è limitata a 16.000 caratteri e proviene sempre dalla configurazione del nodo: l'AI può leggerla come istruzione autorevole, ma non può modificarla o sovrascriverla. Se l'Educazione è presente ma l'LLM non riesce a valutarla, la notifica candidata viene soppressa invece di rischiare di contraddirla.
44
51
 
45
52
  ## Esempio pratico di configurazione
46
53
  Questo esempio crea un assistente conciso che avvisa il proprietario delle aperture importanti, ma accetta che la persiana dello studio possa rimanere aperta:
@@ -52,7 +59,6 @@ Questo esempio crea un assistente conciso che avvisa il proprietario delle apert
52
59
  | **Avvisa dopo apertura** (`proactiveOpenMinutes`) | `120` | Dopo due ore viene valutata una possibile notifica. |
53
60
  | **Inizio / fine ore silenziose** | `23:00` / `07:00` | Durante la notte non vengono emessi messaggi proattivi. |
54
61
  | **Intervallo prima di ripetere** (`proactiveCooldownMinutes`) | `360` | Lo stesso oggetto non può generare un altro avviso per sei ore. |
55
- | **Dimensione massima memoria casa** (`homeMemoryMaxKb`) | `256` | Il riferimento Markdown del singolo nodo non può superare 256 KB. |
56
62
 
57
63
  Esempio per **Educazione AI** (`aiEducation`):
58
64
 
@@ -121,7 +127,6 @@ KNX AI ascolta automaticamente i telegrammi `GroupValue_Write`, `GroupValue_Resp
121
127
  - **Inizio / fine ore silenziose**: intervallo giornaliero in cui i messaggi proattivi sono sospesi.
122
128
  - **Educazione AI**: istruzioni autorevoli gestite soltanto dall'utente, lette dall'AI e mai modificate.
123
129
  - **Cooldown ripetizione (minuti)**: intervallo minimo prima che lo stesso oggetto possa generare un altro avviso; 360 minuti per default.
124
- - **Dimensione massima memoria domestica (KB)**: limite rigido da 64 a 1.024 KB; 256 KB per default.
125
130
  - Se l'archivio su disco e' attivo, **Ask** lo usa di default: rispetta date/intervalli espliciti e, se non presenti, cerca nelle ultime 24 ore piu' gli eventi correnti in RAM.
126
131
  - **Includi inventario del progetto Node-RED**: include nel prompt l'inventario dell'intero progetto Node-RED, compresi nodi KNX e altri nodi utili come function/change/inject/template quando contengono logica KNX o group address.
127
132
  - Gli estratti pertinenti di help, README ed esempi vengono sempre inclusi automaticamente.
@@ -4,6 +4,7 @@
4
4
  "sections": {
5
5
  "groupAssistant": "Assistente AI",
6
6
  "groupChatHome": "Conversazioni e casa",
7
+ "detectedAdapters": "Adapter rilevati automaticamente",
7
8
  "groupKnxAnalysis": "Analisi traffico KNX",
8
9
  "quickSetup": "Configurazione assistente",
9
10
  "capture": "Telegrammi dal bus",
@@ -57,7 +58,6 @@
57
58
  "proactiveCooldownMinutes": "Intervallo prima di ripetere (minuti)",
58
59
  "proactiveQuietStart": "Inizio ore silenziose",
59
60
  "proactiveQuietEnd": "Fine ore silenziose",
60
- "homeMemoryMaxKb": "Dimensione massima memoria casa (KB)",
61
61
  "aiEducation": "Educazione AI (gestita dall'utente)",
62
62
  "llmIncludeDocsSnippets": "Includi estratti documentazione (help/README/esempi)",
63
63
  "llmDocsLanguage": "Lingua documentazione"
@@ -94,11 +94,16 @@
94
94
  "installOllamaModelFailed": "Installazione modello Ollama non riuscita",
95
95
  "ollamaInstallSteps": "1) Apri la libreria, scegli un modello e copiane il nome (es. llama3.1). 2) Inserisci il nome nel campo Modello e clicca Installalo.",
96
96
  "ollamaStartedAuto": "Server Ollama avviato automaticamente.",
97
+ "detectedAdaptersLoading": "Rilevamento degli adapter installati…",
98
+ "detectedAdaptersNone": "Nessun adapter automatico rilevato.",
99
+ "detectedAdaptersUnavailable": "Il rilevamento automatico degli adapter non è momentaneamente disponibile.",
100
+ "detectedAdapterDetected": "Rilevato",
101
+ "detectedAdapterControllers": "Controller",
102
+ "detectedAdapterCameras": "Telecamere",
97
103
  "chatAdapterIntro": "Scegli un preset per inserire il codice di mappatura in ingresso e in uscita. La lista viene caricata dal file degli adattatori chat incluso nel pacchetto; il codice generato resta modificabile.",
98
104
  "chatAdapterCodeHelp": "Le mappature sono sincrone. Restituisci msg per continuare oppure nessun valore per scartarlo. Gli errori vengono intercettati e segnalati senza arrestare Node-RED.",
99
105
  "homeIntelligenceIntro": "Il nodo crea un modello ETS semantico multilingue e può avvisare la chat quando una persiana, finestra o porta riconosciuta con sufficiente affidabilità rimane aperta. Non invia mai autonomamente comandi KNX.",
100
- "aiEducationHelp": "Solo l'utente può modificare questa sezione. L'AI la legge come istruzione autorevole, ma la memoria appresa non può mai sovrascriverla. Massimo 16.000 caratteri.",
101
- "homeMemoryLimitHelp": "La memoria Markdown viene riscritta atomicamente ogni 15 minuti ed è sempre limitata tra 64 e 1.024 KB. Le osservazioni vecchie vengono eliminate prima delle abitudini e degli oggetti semantici."
106
+ "aiEducationHelp": "Solo l'utente può modificare questa sezione. L'AI la legge come istruzione autorevole, ma la memoria appresa non può mai sovrascriverla. Massimo 16.000 caratteri."
102
107
  },
103
108
  "placeholder": {
104
109
  "llmBaseUrl": "https://api.openai.com/v1/chat/completions (o endpoint compatibile)",
@@ -14,14 +14,14 @@
14
14
  ## 命令(输入)
15
15
  发送 `msg.topic`:
16
16
  - `summary`(或空):立即输出摘要
17
- - `reset`:清空内部历史、计数器和已学习的家庭记忆;AI 教育保持不变
17
+ - `reset`:清空内部历史、计数器、已学习的家庭记忆和所有持久聊天上下文;AI 教育保持不变
18
18
  - `ask`:向已配置的 LLM 提问
19
19
  - `confirm` / `cancel`:无需再次调用 LLM,即可确认或取消待处理的 KNX 命令
20
- - `clear_chat`:清除当前会话的对话记忆
20
+ - `clear_chat`:清除当前会话的最近对话、持久指令和待处理命令
21
21
 
22
22
  `ask` 的问题建议放在 `msg.prompt`,也可放在 `msg.payload`(字符串)或常见 Telegram 字段 `msg.payload.content` / `msg.payload.text`。
23
23
 
24
- 启用 KNX 控制后,最近的对话会按 `msg.knxAi.sessionId`、`msg.sessionId` 或检测到的 Telegram 聊天 ID 保存在 RAM 中。将输出 3 连接到聊天发送节点,将输出 4 连接到配置为**通用模式**的 KNX Ultimate 节点。启用确认后,第一条回复会显示 GA、DPT 和 payload,但不会发送写入;同一会话必须在 5 分钟内回复“确认”或“取消”。新请求会替换旧的待处理计划。每条已确认命令都包含 `msg.destination`、`msg.dpt`、`msg.payload` 和 `msg.event = "GroupValue_Write"`。
24
+ 每个 Ask/聊天会话都会保留最近 8 轮对话和最多 20 条明确的长期指令,并按 `msg.knxAi.sessionId`、`msg.sessionId` 或检测到的 Telegram 聊天 ID 隔离。像“请记住不要在回答中使用 unknown 这个词”这样的请求会成为持久指令。使用相同存储的所有 KNX AI 节点实时共享此上下文,并在 Node-RED 重启后从 `knxultimatestorage/knxai/memory/knxai-chat-context.md` 重新加载。该文件采用原子写入,最多保存 50 个会话且不超过 512 KB。启用 KNX 控制后,将输出 3 连接到聊天发送节点,将输出 4 连接到配置为**通用模式**的 KNX Ultimate 节点。启用确认后,第一条回复会显示 GA、DPT 和 payload,但不会发送写入;同一会话必须在 5 分钟内回复“确认”或“取消”。新请求会替换旧的待处理计划。每条已确认命令都包含 `msg.destination`、`msg.dpt`、`msg.payload` 和 `msg.event = "GroupValue_Write"`。
25
25
  对于 DPT 1.xxx 写入,AI 生成的安全等价值 `true`/`false`、`1`/`0` 和 `on`/`off` 会在本地校验和输出前统一转换为真正的布尔值。
26
26
 
27
27
  ### 最新 KNX 读取
@@ -35,12 +35,19 @@
35
35
 
36
36
  随附的 **windkh/node-red-contrib-telegrambot** 预设遵循该包的 receiver/sender 消息约定。把 `telegram receiver` 直接连接到 KNX AI,并把输出 3 直接连接到 `telegram sender`。如需内联确认按钮,还要把配置为 `callback_query` 的 `telegram event` 连接到同一个 KNX AI 输入。输入映射会提取 `msg.payload.content`、`msg.payload.chatId` 和 Telegram 语言;输出映射会创建所需的 `msg.payload.chatId`、`type` 和 `content`,并在写入等待确认时从 `msg.knxAi.confirmationRequest` 添加 `options.reply_markup`。Telegram 包仍是独立的可选依赖项。
37
37
 
38
+ 随附的 **RedBot / node-red-contrib-chatbot (Telegram)** 预设遵循 RedBot 的通用消息格式。将 `chatbot-telegram-receive` 直接连接到 KNX AI,并将输出 3 直接连接到 `chatbot-telegram-send`;无需单独的 callback 节点,因为 RedBot 会把内联按钮的 postback 转换成普通入站消息。输入映射读取 `transport`、`chatId`、`type`、`content` 和 Telegram 语言。输出映射保留 RedBot 的 `originalMessage`、`chat`、`api` 和 `client` 跟踪数据,然后发送 `message` payload,或发送带有确认 `postback` 操作的 `inline-buttons` payload。RedBot 仍是独立的可选依赖项。
39
+
40
+ ### 自动检测的摄像机适配器
41
+ 已安装的摄像机软件包可以在运行时向 KNX AI 发布适配器。无需选择器,也无需将摄像机节点连接到 KNX AI:可用的适配器、控制器和摄像机会被自动检测并加入聊天上下文。`node-red-contrib-unifi-ultimate` 是首个受支持的提供方;`hikvision-ultimate` 等其他软件包可通过同一套厂商无关协议注册。
42
+
43
+ 用户可以请求当前快照,或询问视觉模型画面中可见的内容。Telegram 和 RedBot 预设会把图像作为带说明文字的原生照片发送。用户还可以为移动、智能越线或进入入侵/徘徊区域创建持久通知,并可按检测到的人员以及指定名称的线或区域进行限制。这些规则保存在同一个 `knxai-chat-context.md` 文件中,并在 Node-RED 重启后恢复。UniFi 事件订阅和快照请求直接通过检测到的提供方完成;不会使用 KNX AI 输出 4,也不需要中间 Flow 连线。
44
+
38
45
  ## 主动家庭智能与有限记忆
39
46
  **对话与家庭**中的**主动家庭与记忆**子部分以可选方式启用主动通知。节点会根据 ETS 层级、名称、角色和 DPT,使用意大利语、英语、德语、法语、西班牙语和中文术语,为卷帘、窗户、门、照明、温度、气候、占用和报警建立确定性的语义模型。首个主动检测器只监视可靠识别且非命令的卷帘/窗户/门状态。超过配置的打开时间且当前不在静默时段时,输出 3 会发送本地化消息,并设置 `msg.knxAi.type = "proactive_notification"`。节点绝不会主动使用输出 4,也不会自行修改 KNX;用户之后提出的任何操作仍须经过正常的校验与确认。
40
47
 
41
48
  最近一次聊天会话会被记为主人,也可以通过**主要接收者 / 聊天 ID**明确指定。合成的 `msg.inputMessage` 会保留接收者,使 Telegram 适配器能够发送主动通知。冷却时间和每小时最多三条主动通知可防止消息泛滥。
42
49
 
43
- 学习到的参考文件会在启动时从 `<userDir>/knxai/memory/knxai-home-memory-<node-id>.md` 加载,每 15 分钟以原子方式重写,并严格限制在可配置的 64–1,024 KB(默认 256 KB)。最多保留 120 条重要观察、80 条聚合习惯、80 条通知和 300 个 ETS 语义对象,绝不会保存无限的原始报文流。较旧且优先级较低的项目会先被删除。**AI 教育**最多 16,000 个字符,并且始终来自节点配置:AI 可以将其作为权威指导读取,但不能修改或覆盖。如果已填写 AI 教育但 LLM 无法进行评估,候选通知会被抑制,以免违反用户指导。
50
+ 共享的学习参考文件会在启动时从 `<userDir>/knxai/memory/knxai-home-memory.md` 加载,每 15 分钟以原子方式重写,并始终严格限制为 5 MB。最多保留 120 条重要观察、80 条聚合习惯、80 条通知和 300 个 ETS 语义对象,绝不会保存无限的原始报文流。较旧且优先级较低的项目会先被删除。**AI 教育**最多 16,000 个字符,并且始终来自节点配置:AI 可以将其作为权威指导读取,但不能修改或覆盖。如果已填写 AI 教育但 LLM 无法进行评估,候选通知会被抑制,以免违反用户指导。
44
51
 
45
52
  ## 实用配置示例
46
53
  此示例创建一个简洁的助手:它会报告重要的长时间开启状态,但允许书房卷帘保持开启。
@@ -52,7 +59,6 @@
52
59
  | **开启多久后通知** (`proactiveOpenMinutes`) | `120` | 开启两小时后评估是否需要通知。 |
53
60
  | **静默时间开始 / 结束** | `23:00` / `07:00` | 夜间不会发送主动消息。 |
54
61
  | **重复冷却时间** (`proactiveCooldownMinutes`) | `360` | 同一对象六小时内不会再次通知。 |
55
- | **家庭记忆文件上限** (`homeMemoryMaxKb`) | `256` | 此节点的 Markdown 参考文件始终小于 256 KB。 |
56
62
 
57
63
  **AI 教育** (`aiEducation`) 示例:
58
64
 
@@ -116,7 +122,6 @@ KNX AI 会自动监听 `GroupValue_Write`、`GroupValue_Response` 和 `GroupValu
116
122
  - **静默时间开始 / 结束**:每天禁止主动消息的时间段。
117
123
  - **AI 教育**:仅由用户管理的权威指导,AI 可以读取但永远不能修改。
118
124
  - **重复冷却时间(分钟)**:同一对象再次通知前的最短间隔;默认 360 分钟。
119
- - **家庭记忆文件上限(KB)**:64 到 1,024 KB 的硬限制;默认 256 KB。
120
125
  - 如果启用了磁盘归档,**Ask** 默认会查询该归档:若问题里写了明确日期/时间范围就按其查询,否则默认查询最近 24 小时并补上当前 RAM 事件。
121
126
  - **包含 Node-RED 项目清单**:在提示词中加入整个 Node-RED 项目的节点清单,不仅包含 KNX 节点,也包含 function/change/inject/template 等在内且带有 KNX 逻辑或组地址的有用节点。
122
127
  - 相关的帮助、README 和示例片段始终会自动包含。