node-red-contrib-knx-ultimate 6.2.0 → 6.2.2
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.
- package/CHANGELOG.md +14 -4
- package/examples/KNX AI - Telegrambot Direct Chat.json +18 -0
- package/nodes/knxUltimateAI.html +361 -251
- package/nodes/knxUltimateAI.js +491 -17
- package/nodes/locales/de/knxUltimateAI.html +50 -31
- package/nodes/locales/de/knxUltimateAI.json +27 -9
- package/nodes/locales/en/knxUltimateAI.html +54 -30
- package/nodes/locales/en/knxUltimateAI.json +27 -9
- package/nodes/locales/es/knxUltimateAI.html +50 -31
- package/nodes/locales/es/knxUltimateAI.json +27 -9
- package/nodes/locales/fr/knxUltimateAI.html +50 -31
- package/nodes/locales/fr/knxUltimateAI.json +27 -9
- package/nodes/locales/it/knxUltimateAI.html +54 -30
- package/nodes/locales/it/knxUltimateAI.json +27 -9
- package/nodes/locales/zh-CN/knxUltimateAI.html +50 -31
- package/nodes/locales/zh-CN/knxUltimateAI.json +27 -9
- package/nodes/utils/knxAiHomeMemory.js +507 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script type="text/markdown" data-help-name="knxUltimateAI">
|
|
2
2
|
Dieser Node überwacht **alle KNX-Telegramme** des ausgewählten KNX-Ultimate-Gateways, erstellt Verkehrsstatistiken, erkennt Anomalien und kann optional ein LLM befragen.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Der Editor verwendet drei Hauptbereiche als Akkordeon: **KI-Assistent** enthält Einrichtung, Wissen/Kontext und Anbietergrenzen; **Gespräche & Zuhause** enthält Chat-Kanäle, proaktives Zuhause und begrenztes Gedächtnis; **KNX-Verkehrsanalyse** enthält Bus-Telegramme, Verlauf/Zusammenfassungen und Anomalien/Muster. Beim Öffnen eines Hauptbereichs werden alle zugehörigen Optionen gemeinsam angezeigt. Gespeicherte Feld-IDs und Werte bleiben unverändert.
|
|
5
5
|
|
|
6
6
|
## Ausgänge
|
|
7
7
|
1. **Zusammenfassung/Statistik** (`msg.payload` JSON)
|
|
@@ -14,7 +14,7 @@ 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
|
|
17
|
+
- `reset`: internen Verlauf, Zähler und gelerntes Hausgedächtnis 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
20
|
- `clear_chat`: Gesprächsspeicher der aktuellen Sitzung löschen
|
|
@@ -35,6 +35,40 @@ 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
|
+
## Proaktive Hausintelligenz und begrenztes Gedächtnis
|
|
39
|
+
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
|
+
|
|
41
|
+
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
|
+
|
|
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.
|
|
44
|
+
|
|
45
|
+
## Praktisches Konfigurationsbeispiel
|
|
46
|
+
Dieses Beispiel erstellt einen knappen Assistenten, der wichtige Öffnungen meldet, aber akzeptiert, dass der Rollladen im Büro offen bleiben darf:
|
|
47
|
+
|
|
48
|
+
| Editor-Feld | Beispielwert | Wirkung |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| **Proaktive Hausbenachrichtigungen aktivieren** (`proactiveEnabled`) | aktiv | Zuverlässig erkannte offene Rollladen-/Fenster-/Türzustände werden bewertet. |
|
|
51
|
+
| **Hauptempfänger / Chat-ID** (`proactiveRecipient`) | `123456789` | Spontane Nachrichten gehen an diesen Chat; leer bedeutet: letzte Ask-Sitzung merken. |
|
|
52
|
+
| **Nach offener Dauer benachrichtigen** (`proactiveOpenMinutes`) | `120` | Nach zwei Stunden wird eine mögliche Meldung bewertet. |
|
|
53
|
+
| **Ruhezeit Beginn / Ende** | `23:00` / `07:00` | Nachts werden keine proaktiven Nachrichten ausgegeben. |
|
|
54
|
+
| **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
|
+
|
|
57
|
+
Beispiel für **KI-Erziehung** (`aiEducation`):
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Nenne mich Alex und antworte in derselben Sprache wie ich.
|
|
61
|
+
Antworte kurz, außer ich bitte um technische Einzelheiten.
|
|
62
|
+
Der Büro-Rollladen darf tagsüber offen bleiben: benachrichtige mich nicht.
|
|
63
|
+
Melde andere Rollläden, Fenster oder Türen, die ungewöhnlich lange offen bleiben.
|
|
64
|
+
Wenn „Wohnzimmerlicht“ mehrdeutig ist, frage nach der gemeinten Leuchte.
|
|
65
|
+
Behaupte nie eine Aktoränderung, bevor ein KNX-Statusobjekt sie bestätigt.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Damit kann Ausgang 3 nach 120 Minuten eine lokalisierte `proactive_notification` für den Wohnzimmer-Rollladen ausgeben, während eine Meldung für den Büro-Rollladen durch die Erziehung unterdrückt wird. Bittet Alex danach um das Schließen, erstellt KNX AI den exakten ETS-Befehl, behält aber Validierung und Bestätigung vor Ausgang 4 bei.
|
|
69
|
+
|
|
70
|
+
Verwenden Sie aussagekräftige ETS-Hierarchien und Objektnamen sowie korrekte Status-/Befehlsrollen. Die Erziehung personalisiert Entscheidungen und Formulierungen, kann aber keine Gruppenadresse erfinden, keinen DPT ändern und die KNX-Validierung nicht umgehen.
|
|
71
|
+
|
|
38
72
|
## Kurzer Ablauf: KNX-Steuerung
|
|
39
73
|
1. Importieren Sie die ETS-CSV in das Gateway und konfigurieren Sie LLM-Anbieter, Modell und Zugangsdaten.
|
|
40
74
|
2. Aktivieren Sie **LLM-Assistent** und **KNX-Zustände lesen und Aktoren steuern**; lassen Sie die Bestätigung aktiviert.
|
|
@@ -53,10 +87,7 @@ Hier sind alle Felder aufgeführt, wie sie im KNX-AI-Editor sichtbar sind.
|
|
|
53
87
|
- **Topic**: Basis-Topic der Node-Ausgänge.
|
|
54
88
|
- Button **Open KNX AI Web**: Öffnet das Web-Dashboard (`/knxUltimateAI/sidebar/page`).
|
|
55
89
|
|
|
56
|
-
|
|
57
|
-
- **Capture GroupValue_Write**: Erfasst Write-Telegramme.
|
|
58
|
-
- **Capture GroupValue_Response**: Erfasst Response-Telegramme.
|
|
59
|
-
- **Capture GroupValue_Read**: Erfasst Read-Telegramme.
|
|
90
|
+
KNX AI hört automatisch auf `GroupValue_Write`, `GroupValue_Response` und `GroupValue_Read`. Die Muster- und Anomalieanalyse wird immer mit den integrierten Standardwerten initialisiert; Busereignisse und Erkennung müssen daher nicht konfiguriert werden.
|
|
60
91
|
|
|
61
92
|
### Analysis
|
|
62
93
|
- **Analysis window (seconds)**: Hauptfenster für Summary/Rate-Berechnung.
|
|
@@ -66,16 +97,6 @@ Hier sind alle Felder aufgeführt, wie sie im KNX-AI-Editor sichtbar sind.
|
|
|
66
97
|
- **Max stored events**: Maximale Anzahl Telegramme im Speicher.
|
|
67
98
|
- **Auto emit summary (seconds, 0=off)**: Periodisches Summary-Intervall.
|
|
68
99
|
- **Top list size**: Anzahl Top-Gruppenadressen/Quellen in der Summary.
|
|
69
|
-
- **Detect simple patterns (A -> B)**: Aktiviert Übergangs-/Pattern-Erkennung.
|
|
70
|
-
- **Pattern max lag (ms)**: Maximaler Zeitabstand für Pattern-Korrelation.
|
|
71
|
-
- **Pattern min occurrences**: Mindestanzahl, bevor ein Pattern gemeldet wird.
|
|
72
|
-
|
|
73
|
-
### Anomalies
|
|
74
|
-
- **Rate window (seconds)**: Gleitendes Zeitfenster für Rate-Prüfungen.
|
|
75
|
-
- **Max overall telegrams/sec (0=off)**: Schwellwert für gesamten Bus.
|
|
76
|
-
- **Max telegrams/sec per GA (0=off)**: Schwellwert pro Gruppenadresse.
|
|
77
|
-
- **Flap window (seconds)**: Zeitfenster für Flapping-/Wechselraten-Erkennung.
|
|
78
|
-
- **Max changes per GA in window (0=off)**: Maximal erlaubte Änderungen im Fenster.
|
|
79
100
|
|
|
80
101
|
### KI-Assistent
|
|
81
102
|
- **Enable LLM assistant**: Aktiviert Ask/Chat-Funktionen.
|
|
@@ -84,30 +105,28 @@ Hier sind alle Felder aufgeführt, wie sie im KNX-AI-Editor sichtbar sind.
|
|
|
84
105
|
- **API key**: API-Schlüssel (für lokales Ollama nicht erforderlich).
|
|
85
106
|
- **Model**: Modell-ID/Name.
|
|
86
107
|
- **Chatmodell-Kompatibilität**: Das ausgewählte Modell muss den konfigurierten Chat-Completions-Endpunkt unterstützen. Ältere reine Completions-Modelle wie `gpt-3.5-turbo-instruct` werden beim Aktualisieren der Modellliste ausgeschlossen. Lehnt der Anbieter einen benutzerdefinierten Temperaturwert oder den Token-Limit-Parameter ab, wiederholt KNX AI die Anfrage und entfernt oder ersetzt nur das inkompatible Feld.
|
|
87
|
-
- **System prompt**: Globale Instruktion für KNX-Analyse (Advanced).
|
|
88
108
|
- **KI darf KNX-Zustände lesen und Aktoren steuern**: Aktiviert Ausgang 4 und ist standardmäßig aus. Exakte ETS-Katalogobjekte dürfen gelesen werden; Schreiboperationen werden ausschließlich für Objekte mit Rolle `command` akzeptiert. Unbekannte, DPT-falsche, ungültige oder überzählige Operationen sowie Schreiboperationen auf Status-/Neutralobjekte werden lokal abgewiesen.
|
|
89
109
|
- **Vor dem Senden von KNX-Befehlen bestätigen lassen**: Standardmäßig aktiv. Zeigt zuerst die validierten Änderungen und sendet nichts, bis dieselbe Chat-Sitzung bestätigt. Wenn Befehle auf Bestätigung warten, fügt die Antwort immer die genauen Anweisungen zum Bestätigen oder Abbrechen in der Sprache der aktuellen Anfrage hinzu. Vor der Ausgabe werden die Befehle erneut validiert.
|
|
90
|
-
- **Adapter-Vorlage**:
|
|
91
|
-
- **Eingangszuordnung (Chat → KNX AI)**: Synchrones JavaScript vor der Verarbeitung des Eingangsbefehls.
|
|
92
|
-
- **Ausgangszuordnung (KNX AI → Chat)**: Synchrones JavaScript ausschließlich für Nachrichten an Ausgang 3.
|
|
110
|
+
- **Adapter-Vorlage**: Standardmäßig ist **Kein Adapter** gewählt. Die JavaScript-Editoren bleiben verborgen, bis ein Adapter ausgewählt wird; danach werden die bearbeitbaren Ein- und Ausgangszuordnungen geladen und angezeigt.
|
|
111
|
+
- **Eingangszuordnung (Chat → KNX AI)**: Synchrones JavaScript vor der Verarbeitung des Eingangsbefehls im grünen JavaScript-Editor.
|
|
112
|
+
- **Ausgangszuordnung (KNX AI → Chat)**: Synchrones JavaScript ausschließlich für Nachrichten an Ausgang 3 im gelben JavaScript-Editor.
|
|
113
|
+
- **Proaktive Hausbenachrichtigungen aktivieren**: Optionaler Detektor für zuverlässig erkannte offene Rollladen-/Fenster-/Türzustände; er schreibt nie selbstständig auf KNX.
|
|
114
|
+
- **Hauptempfänger / Chat-ID**: Optionales Ziel für unaufgeforderte Chatnachrichten; andernfalls wird die letzte Ask-Sitzung gespeichert.
|
|
115
|
+
- **Nach offener Dauer benachrichtigen (Minuten)**: Schwelle, bevor eine proaktive Nachricht erwogen wird; standardmäßig 120 Minuten.
|
|
116
|
+
- **Ruhezeit Beginn / Ende**: Täglicher Zeitraum, in dem proaktive Nachrichten unterdrückt werden.
|
|
117
|
+
- **KI-Erziehung**: Verbindliche, ausschließlich vom Benutzer verwaltete Hinweise, die die KI lesen, aber nie ändern darf.
|
|
118
|
+
- **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.
|
|
93
120
|
- 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.
|
|
94
|
-
- **Include raw payload hex**: Rohe Hex-Payload im Prompt einfügen.
|
|
95
121
|
- **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.
|
|
96
|
-
-
|
|
97
|
-
- **Docs language**: Bevorzugte Sprache der
|
|
98
|
-
- Button **Refresh**: Provider
|
|
122
|
+
- Relevante Auszüge aus Hilfe, README und Beispielen werden immer automatisch einbezogen.
|
|
123
|
+
- **Docs language**: Bevorzugte Sprache der automatisch einbezogenen Dokumentationsauszüge.
|
|
124
|
+
- Button **Refresh**: Fragt den Provider ab und lädt verfügbare Modelle. Währenddessen dreht sich das Symbol; ein erfolgreicher Abschluss bleibt absichtlich ohne Meldung.
|
|
99
125
|
|
|
100
126
|
### Advanced
|
|
101
127
|
- **Analysis window (seconds)**: Hauptfenster für Summary/Rate-Berechnung.
|
|
102
128
|
- **Max stored events**: Maximale Anzahl Telegramme im Speicher.
|
|
103
129
|
- **Top list size**: Anzahl Top-Gruppenadressen/Quellen in der Summary.
|
|
104
|
-
- **Pattern max lag (ms)**: Maximaler Zeitabstand für Pattern-Korrelation.
|
|
105
|
-
- **Pattern min occurrences**: Mindestanzahl, bevor ein Pattern gemeldet wird.
|
|
106
|
-
- **Rate window (seconds)**: Gleitendes Zeitfenster für Rate-Prüfungen.
|
|
107
|
-
- **Max overall telegrams/sec (0=off)**: Schwellwert für gesamten Bus.
|
|
108
|
-
- **Max telegrams/sec per GA (0=off)**: Schwellwert pro Gruppenadresse.
|
|
109
|
-
- **Flap window (seconds)**: Zeitfenster für Flapping-/Wechselraten-Erkennung.
|
|
110
|
-
- **Max changes per GA in window (0=off)**: Maximal erlaubte Änderungen im Fenster.
|
|
111
130
|
|
|
112
131
|
### Ollama Schnellstart (lokal)
|
|
113
132
|
- **Provider = Ollama** auswählen.
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
"knxUltimateAI": {
|
|
3
3
|
"title": "KNX AI (Traffic Analyzer)",
|
|
4
4
|
"sections": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
5
|
+
"groupAssistant": "KI-Assistent",
|
|
6
|
+
"groupChatHome": "Gespräche & Zuhause",
|
|
7
|
+
"groupKnxAnalysis": "KNX-Verkehrsanalyse",
|
|
8
|
+
"quickSetup": "Assistent einrichten",
|
|
9
|
+
"capture": "Bus-Telegrammeingang",
|
|
10
|
+
"storage": "KNX-Verlauf & Zusammenfassungen",
|
|
11
|
+
"detection": "Anomalien & Muster",
|
|
9
12
|
"llmConnection": "KI-Assistent-Verbindung",
|
|
10
|
-
"llmContext": "KI-
|
|
11
|
-
"chatAdapter": "Chat-
|
|
12
|
-
"
|
|
13
|
+
"llmContext": "KI-Wissen & Kontext",
|
|
14
|
+
"chatAdapter": "Chat-Kanäle",
|
|
15
|
+
"homeIntelligence": "Proaktives Zuhause & Gedächtnis",
|
|
16
|
+
"homeIntelligenceAdvanced": "Erweiterte proaktive Einstellungen",
|
|
17
|
+
"advanced": "Anbieter & Grenzen"
|
|
13
18
|
},
|
|
14
19
|
"properties": {
|
|
15
20
|
"server": "Gateway",
|
|
@@ -46,6 +51,14 @@
|
|
|
46
51
|
"chatAdapterPreset": "Adapter-Vorlage",
|
|
47
52
|
"chatInputCode": "Eingangszuordnung (Chat → KNX AI)",
|
|
48
53
|
"chatOutputCode": "Ausgangszuordnung (KNX AI → Chat)",
|
|
54
|
+
"proactiveEnabled": "Proaktive Hausbenachrichtigungen aktivieren",
|
|
55
|
+
"proactiveRecipient": "Hauptempfänger / Chat-ID",
|
|
56
|
+
"proactiveOpenMinutes": "Nach Offenstand benachrichtigen (Minuten)",
|
|
57
|
+
"proactiveCooldownMinutes": "Wiederholsperre (Minuten)",
|
|
58
|
+
"proactiveQuietStart": "Beginn der Ruhezeit",
|
|
59
|
+
"proactiveQuietEnd": "Ende der Ruhezeit",
|
|
60
|
+
"homeMemoryMaxKb": "Maximale Hausgedächtnisdatei (KB)",
|
|
61
|
+
"aiEducation": "KI-Erziehung (vom Benutzer verwaltet)",
|
|
49
62
|
"llmIncludeDocsSnippets": "Include documentation snippets (help/README/examples)",
|
|
50
63
|
"llmDocsLanguage": "Docs language"
|
|
51
64
|
},
|
|
@@ -69,7 +82,9 @@
|
|
|
69
82
|
"llmBaseUrl": "https://api.openai.com/v1/chat/completions (or your compatible endpoint)",
|
|
70
83
|
"llmApiKey": "Paste API key (starts with sk-)",
|
|
71
84
|
"llmModel": "e.g. gpt-4o-mini",
|
|
72
|
-
"llmSystemPrompt": "Optional. Leave empty for default."
|
|
85
|
+
"llmSystemPrompt": "Optional. Leave empty for default.",
|
|
86
|
+
"proactiveRecipient": "Optional: Telegram-Chat-ID; andernfalls wird die letzte Chat-Sitzung gespeichert",
|
|
87
|
+
"aiEducation": "Beispiel: Zwischen 23:00 und 07:00 nicht benachrichtigen. Der Rollladen im Büro darf nachts offen bleiben."
|
|
73
88
|
},
|
|
74
89
|
"messages": {
|
|
75
90
|
"ollamaNotSupported": "Ollama local mode: API key not required. Default endpoint is http://localhost:11434/api/chat.",
|
|
@@ -80,7 +95,10 @@
|
|
|
80
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.",
|
|
81
96
|
"ollamaStartedAuto": "Ollama server started automatically.",
|
|
82
97
|
"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.",
|
|
83
|
-
"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."
|
|
98
|
+
"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
|
+
"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."
|
|
84
102
|
},
|
|
85
103
|
"sidebar": {
|
|
86
104
|
"ui": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script type="text/markdown" data-help-name="knxUltimateAI">
|
|
2
2
|
This node listens to **all KNX telegrams** from the selected KNX Ultimate gateway, builds traffic statistics, detects anomalies, and can optionally query an LLM.
|
|
3
3
|
|
|
4
|
-
The editor
|
|
4
|
+
The editor uses three main accordion sections: **AI assistant** contains setup, knowledge/context and provider limits; **Conversations & home** contains chat channels, proactive home and bounded memory; **KNX traffic analysis** contains bus telegram input, history/summaries and anomalies/patterns. Opening a main section shows all of its related options together. Saved field IDs and values remain unchanged.
|
|
5
5
|
|
|
6
6
|
## Outputs
|
|
7
7
|
1. **Summary/Stats** (`msg.payload` JSON)
|
|
@@ -14,7 +14,7 @@ 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
|
|
17
|
+
- `reset`: clear internal history, counters and learned home memory; 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
20
|
- `clear_chat`: clear the conversation memory for the current session
|
|
@@ -35,6 +35,44 @@ 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
|
+
## Proactive home intelligence and bounded memory
|
|
39
|
+
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
|
+
|
|
41
|
+
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
|
+
|
|
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.
|
|
44
|
+
|
|
45
|
+
## Practical configuration example
|
|
46
|
+
This example creates a concise assistant that notifies the owner about relevant openings but accepts that the office cover may stay open:
|
|
47
|
+
|
|
48
|
+
| Editor field | Example value | Result |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| **Enable proactive home notifications** (`proactiveEnabled`) | enabled | The node evaluates reliably recognized open cover/window/door states. |
|
|
51
|
+
| **Primary recipient / chat ID** (`proactiveRecipient`) | `123456789` | Unsolicited messages go to this chat. Leave it empty to remember the most recent Ask session. |
|
|
52
|
+
| **Notify after open** (`proactiveOpenMinutes`) | `120` | A candidate notification is considered after two hours. |
|
|
53
|
+
| **Quiet hours start / end** | `23:00` / `07:00` | No proactive message is emitted during the night. |
|
|
54
|
+
| **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
|
+
|
|
57
|
+
Example for **AI Education** (`aiEducation`):
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Call me Alex and answer in the same language I use.
|
|
61
|
+
Keep replies short unless I ask for technical details.
|
|
62
|
+
The office cover may remain open during the day: do not notify me about it.
|
|
63
|
+
Notify me when another cover, window, or door remains open unusually long.
|
|
64
|
+
When "living-room light" is ambiguous, ask which light I mean.
|
|
65
|
+
Never say that an actuator changed until a KNX status object confirms it.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
With these settings:
|
|
69
|
+
|
|
70
|
+
1. If the living-room cover status remains open for 120 minutes outside quiet hours, output 3 can emit a localized `proactive_notification`.
|
|
71
|
+
2. If the office cover remains open, the LLM reads Education and suppresses that candidate notification.
|
|
72
|
+
3. If Alex later asks to close the living-room cover, KNX AI prepares the exact ETS command and still follows normal validation and confirmation before output 4.
|
|
73
|
+
|
|
74
|
+
Use descriptive ETS hierarchy/object names and correct status/command roles. Education can personalize decisions and wording, but it cannot authorize an invented group address, change a DPT, or bypass KNX validation.
|
|
75
|
+
|
|
38
76
|
## Quick workflow: KNX control
|
|
39
77
|
1. Import the ETS CSV into the gateway and configure the LLM provider, model, and credentials.
|
|
40
78
|
2. Enable **LLM assistant** and **KNX state reads and actuator control**; leave confirmation enabled.
|
|
@@ -54,9 +92,7 @@ All fields exposed in the KNX AI editor are listed below.
|
|
|
54
92
|
- **Open KNX AI Web** button: Opens the full KNX AI web dashboard (`/knxUltimateAI/sidebar/page`).
|
|
55
93
|
|
|
56
94
|
### Capture
|
|
57
|
-
|
|
58
|
-
- **Capture GroupValue_Response**: Capture response telegrams.
|
|
59
|
-
- **Capture GroupValue_Read**: Capture read telegrams.
|
|
95
|
+
KNX AI automatically listens to `GroupValue_Write`, `GroupValue_Response`, and `GroupValue_Read` telegrams. Pattern and anomaly analysis is always initialized with the built-in defaults, so no bus-event or detection setup is required.
|
|
60
96
|
|
|
61
97
|
### Analysis
|
|
62
98
|
- **Analysis window (seconds)**: Main analysis window used for summaries/rates.
|
|
@@ -66,16 +102,6 @@ All fields exposed in the KNX AI editor are listed below.
|
|
|
66
102
|
- **Max stored events**: Maximum number of telegrams kept in memory.
|
|
67
103
|
- **Auto emit summary (seconds, 0=off)**: Periodic summary output interval.
|
|
68
104
|
- **Top list size**: Number of top group addresses/sources in summary.
|
|
69
|
-
- **Detect simple patterns (A -> B)**: Enable transition/pattern detection.
|
|
70
|
-
- **Pattern max lag (ms)**: Max time gap for pattern transition matching.
|
|
71
|
-
- **Pattern min occurrences**: Minimum occurrences before a pattern is reported.
|
|
72
|
-
|
|
73
|
-
### Anomalies
|
|
74
|
-
- **Rate window (seconds)**: Sliding time window for anomaly rate checks.
|
|
75
|
-
- **Max overall telegrams/sec (0=off)**: Overall bus rate threshold.
|
|
76
|
-
- **Max telegrams/sec per GA (0=off)**: Per-group-address rate threshold.
|
|
77
|
-
- **Flap window (seconds)**: Time window for flapping/change-rate detection.
|
|
78
|
-
- **Max changes per GA in window (0=off)**: Max allowed changes in flap window.
|
|
79
105
|
|
|
80
106
|
### AI Assistant
|
|
81
107
|
- **Enable LLM assistant**: Enable Ask/chat assistant features.
|
|
@@ -84,30 +110,28 @@ All fields exposed in the KNX AI editor are listed below.
|
|
|
84
110
|
- **API key**: API key (not required for local Ollama).
|
|
85
111
|
- **Model**: Model ID/name.
|
|
86
112
|
- **Chat model compatibility**: The selected model must support the configured Chat Completions endpoint. Legacy completion-only models such as `gpt-3.5-turbo-instruct` are excluded when the model list is refreshed. If the provider rejects a custom temperature or token-limit parameter, KNX AI retries after removing or replacing only that incompatible field.
|
|
87
|
-
- **System prompt**: Global instruction for KNX analysis behavior (Advanced).
|
|
88
113
|
- **Allow AI to read KNX states and control actuators**: Enables output 4 and is off by default. Exact ETS catalog objects may be read; writes are accepted only for objects classified as `command`. Unknown, DPT-mismatched, invalid, or excessive operations and writes to status/neutral objects are rejected locally.
|
|
89
114
|
- **Ask for confirmation before sending KNX commands**: Enabled by default. Shows the validated changes first and emits no KNX command until the same chat session confirms them. Whenever commands are awaiting confirmation, the response always appends the exact confirmation/cancellation instructions in the language of the current request. Commands are validated again immediately before output.
|
|
90
|
-
- **Adapter preset**:
|
|
91
|
-
- **Input mapping (chat → KNX AI)**: Synchronous JavaScript applied before input command processing.
|
|
92
|
-
- **Output mapping (KNX AI → chat)**: Synchronous JavaScript applied only to messages on output 3.
|
|
115
|
+
- **Adapter preset**: Defaults to **No adapter**. The JavaScript mapping editors remain hidden until an adapter is selected; selecting a preset loads and reveals its editable input/output mapping pair.
|
|
116
|
+
- **Input mapping (chat → KNX AI)**: Synchronous JavaScript applied before input command processing. It uses the green JavaScript editor.
|
|
117
|
+
- **Output mapping (KNX AI → chat)**: Synchronous JavaScript applied only to messages on output 3. It uses the yellow JavaScript editor.
|
|
118
|
+
- **Enable proactive home notifications**: Opt-in detector for reliably recognized open cover/window/door states; it never writes autonomously to KNX.
|
|
119
|
+
- **Primary recipient / chat ID**: Optional destination for unsolicited chat messages; otherwise the most recent Ask session is remembered.
|
|
120
|
+
- **Notify after open (minutes)**: Open-duration threshold before a proactive notification can be considered; 120 minutes by default.
|
|
121
|
+
- **Quiet hours start / end**: Daily interval in which proactive messages are suppressed.
|
|
122
|
+
- **AI Education**: User-only, authoritative guidance read by the AI and never modified by it.
|
|
123
|
+
- **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.
|
|
93
125
|
- 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.
|
|
94
|
-
- **Include raw payload hex**: Include raw telegram hex in prompt.
|
|
95
126
|
- **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.
|
|
96
|
-
-
|
|
97
|
-
- **Docs language**: Preferred language for
|
|
98
|
-
- **Refresh** button:
|
|
127
|
+
- Relevant help, README, and example snippets are always included automatically.
|
|
128
|
+
- **Docs language**: Preferred language for the automatically included documentation snippets.
|
|
129
|
+
- **Refresh** button: Queries the provider and loads available model IDs. Its icon spins while loading; successful completion is intentionally silent.
|
|
99
130
|
|
|
100
131
|
### Advanced
|
|
101
132
|
- **Analysis window (seconds)**: Main analysis window used for summaries/rates.
|
|
102
133
|
- **Max stored events**: Maximum number of telegrams kept in memory.
|
|
103
134
|
- **Top list size**: Number of top group addresses/sources in summary.
|
|
104
|
-
- **Pattern max lag (ms)**: Max time gap for pattern transition matching.
|
|
105
|
-
- **Pattern min occurrences**: Minimum occurrences before a pattern is reported.
|
|
106
|
-
- **Rate window (seconds)**: Sliding time window for anomaly rate checks.
|
|
107
|
-
- **Max overall telegrams/sec (0=off)**: Overall bus rate threshold.
|
|
108
|
-
- **Max telegrams/sec per GA (0=off)**: Per-group-address rate threshold.
|
|
109
|
-
- **Flap window (seconds)**: Time window for flapping/change-rate detection.
|
|
110
|
-
- **Max changes per GA in window (0=off)**: Max allowed changes in flap window.
|
|
111
135
|
|
|
112
136
|
### Ollama quick setup (local)
|
|
113
137
|
- Choose **Provider = Ollama**.
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
"knxUltimateAI": {
|
|
3
3
|
"title": "KNX AI (Traffic Analyzer)",
|
|
4
4
|
"sections": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
5
|
+
"groupAssistant": "AI assistant",
|
|
6
|
+
"groupChatHome": "Conversations & home",
|
|
7
|
+
"groupKnxAnalysis": "KNX traffic analysis",
|
|
8
|
+
"quickSetup": "Assistant setup",
|
|
9
|
+
"capture": "Bus telegram input",
|
|
10
|
+
"storage": "KNX history & summaries",
|
|
11
|
+
"detection": "Anomalies & patterns",
|
|
9
12
|
"llmConnection": "AI Assistant Connection",
|
|
10
|
-
"llmContext": "AI
|
|
11
|
-
"chatAdapter": "Chat
|
|
12
|
-
"
|
|
13
|
+
"llmContext": "AI knowledge & context",
|
|
14
|
+
"chatAdapter": "Chat channels",
|
|
15
|
+
"homeIntelligence": "Proactive home & memory",
|
|
16
|
+
"homeIntelligenceAdvanced": "Advanced proactive settings",
|
|
17
|
+
"advanced": "Provider & limits"
|
|
13
18
|
},
|
|
14
19
|
"properties": {
|
|
15
20
|
"server": "Gateway",
|
|
@@ -46,6 +51,14 @@
|
|
|
46
51
|
"chatAdapterPreset": "Adapter preset",
|
|
47
52
|
"chatInputCode": "Input mapping (chat → KNX AI)",
|
|
48
53
|
"chatOutputCode": "Output mapping (KNX AI → chat)",
|
|
54
|
+
"proactiveEnabled": "Enable proactive home notifications",
|
|
55
|
+
"proactiveRecipient": "Primary recipient / chat ID",
|
|
56
|
+
"proactiveOpenMinutes": "Notify after open (minutes)",
|
|
57
|
+
"proactiveCooldownMinutes": "Repeat cooldown (minutes)",
|
|
58
|
+
"proactiveQuietStart": "Quiet hours start",
|
|
59
|
+
"proactiveQuietEnd": "Quiet hours end",
|
|
60
|
+
"homeMemoryMaxKb": "Maximum home-memory file (KB)",
|
|
61
|
+
"aiEducation": "AI Education (user managed)",
|
|
49
62
|
"llmIncludeDocsSnippets": "Include documentation snippets (help/README/examples)",
|
|
50
63
|
"llmDocsLanguage": "Docs language"
|
|
51
64
|
},
|
|
@@ -82,13 +95,18 @@
|
|
|
82
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.",
|
|
83
96
|
"ollamaStartedAuto": "Ollama server started automatically.",
|
|
84
97
|
"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.",
|
|
85
|
-
"chatAdapterCodeHelp": "Mappings run synchronously. Return msg to continue or return no value to discard it. Errors are caught and reported without stopping Node-RED."
|
|
98
|
+
"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
|
+
"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."
|
|
86
102
|
},
|
|
87
103
|
"placeholder": {
|
|
88
104
|
"llmBaseUrl": "https://api.openai.com/v1/chat/completions (or your compatible endpoint)",
|
|
89
105
|
"llmApiKey": "Paste API key (starts with sk-)",
|
|
90
106
|
"llmModel": "e.g. gpt-4o-mini",
|
|
91
|
-
"llmSystemPrompt": "Optional. Leave empty for default."
|
|
107
|
+
"llmSystemPrompt": "Optional. Leave empty for default.",
|
|
108
|
+
"proactiveRecipient": "Optional: Telegram chat ID; otherwise the most recent chat session is remembered",
|
|
109
|
+
"aiEducation": "Example: Do not notify me between 23:00 and 07:00. The office shutter may remain open at night."
|
|
92
110
|
},
|
|
93
111
|
"sidebar": {
|
|
94
112
|
"ui": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script type="text/markdown" data-help-name="knxUltimateAI">
|
|
2
2
|
Este nodo escucha **todos los telegramas KNX** del gateway KNX Ultimate seleccionado, genera estadísticas de tráfico, detecta anomalías y puede consultar opcionalmente un LLM.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
El editor utiliza tres secciones principales en acordeón: **Asistente IA** contiene configuración, conocimiento/contexto y límites del proveedor; **Conversaciones y hogar** contiene canales de chat, hogar proactivo y memoria limitada; **Análisis del tráfico KNX** contiene telegramas del bus, historial/resúmenes y anomalías/patrones. Al abrir una sección principal se muestran juntas todas sus opciones. Los ID y valores guardados permanecen intactos.
|
|
5
5
|
|
|
6
6
|
## Salidas
|
|
7
7
|
1. **Resumen/Estadísticas** (`msg.payload` JSON)
|
|
@@ -14,7 +14,7 @@ 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`:
|
|
17
|
+
- `reset`: borra el historial, los contadores y la memoria del hogar aprendida; 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
20
|
- `clear_chat`: borra la memoria de conversación de la sesión actual
|
|
@@ -35,6 +35,40 @@ 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
|
+
## Inteligencia doméstica proactiva y memoria limitada
|
|
39
|
+
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
|
+
|
|
41
|
+
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
|
+
|
|
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.
|
|
44
|
+
|
|
45
|
+
## Ejemplo práctico de configuración
|
|
46
|
+
Este ejemplo crea un asistente conciso que avisa sobre aperturas importantes, pero acepta que la persiana del despacho permanezca abierta:
|
|
47
|
+
|
|
48
|
+
| Campo del editor | Valor de ejemplo | Resultado |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| **Activar notificaciones proactivas del hogar** (`proactiveEnabled`) | activado | El nodo evalúa estados abiertos fiables de persianas, ventanas y puertas. |
|
|
51
|
+
| **Destinatario principal / ID de chat** (`proactiveRecipient`) | `123456789` | Los mensajes espontáneos van a este chat; déjalo vacío para recordar la última sesión Ask. |
|
|
52
|
+
| **Avisar después de abierta** (`proactiveOpenMinutes`) | `120` | Se evalúa una posible notificación después de dos horas. |
|
|
53
|
+
| **Inicio / fin de horas silenciosas** | `23:00` / `07:00` | No se emiten mensajes proactivos durante la noche. |
|
|
54
|
+
| **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
|
+
|
|
57
|
+
Ejemplo para **Educación IA** (`aiEducation`):
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Llámame Alex y responde en el mismo idioma que uso.
|
|
61
|
+
Responde brevemente, salvo que pida detalles técnicos.
|
|
62
|
+
La persiana del despacho puede permanecer abierta durante el día: no me avises.
|
|
63
|
+
Avísame si otra persiana, ventana o puerta permanece abierta demasiado tiempo.
|
|
64
|
+
Si «luz del salón» es ambiguo, pregúntame a qué luz me refiero.
|
|
65
|
+
Nunca afirmes que un actuador cambió hasta que lo confirme un objeto de estado KNX.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Con estos ajustes, la salida 3 puede emitir una `proactive_notification` localizada después de 120 minutos para la persiana del salón, mientras que Educación suprime el aviso de la persiana del despacho. Si Alex pide después cerrar la persiana del salón, KNX AI prepara el comando ETS exacto, pero mantiene la validación y confirmación normales antes de la salida 4.
|
|
69
|
+
|
|
70
|
+
Usa jerarquías y nombres de objetos ETS descriptivos, con roles de estado/comando correctos. Educación personaliza decisiones y texto, pero no puede inventar una dirección de grupo, cambiar un DPT ni evitar la validación KNX.
|
|
71
|
+
|
|
38
72
|
## Flujo rápido: control KNX
|
|
39
73
|
1. Importa el CSV de ETS en el gateway y configura el proveedor, el modelo y las credenciales LLM.
|
|
40
74
|
2. Activa **Asistente LLM** y **lectura de estados KNX y control de actuadores**; deja activada la confirmación.
|
|
@@ -53,10 +87,7 @@ Aquí tienes todos los campos tal como se muestran en el editor de KNX AI.
|
|
|
53
87
|
- **Topic**: topic base usado en las salidas del nodo.
|
|
54
88
|
- Botón **Open KNX AI Web**: abre el dashboard web (`/knxUltimateAI/sidebar/page`).
|
|
55
89
|
|
|
56
|
-
|
|
57
|
-
- **Capture GroupValue_Write**: captura telegramas Write.
|
|
58
|
-
- **Capture GroupValue_Response**: captura telegramas Response.
|
|
59
|
-
- **Capture GroupValue_Read**: captura telegramas Read.
|
|
90
|
+
KNX AI escucha automáticamente los telegramas `GroupValue_Write`, `GroupValue_Response` y `GroupValue_Read`. El análisis de patrones y anomalías siempre se inicializa con los valores predeterminados internos, por lo que no es necesario configurar los eventos del bus ni la detección.
|
|
60
91
|
|
|
61
92
|
### Analysis
|
|
62
93
|
- **Analysis window (seconds)**: ventana principal para resumen/rate.
|
|
@@ -66,16 +97,6 @@ Aquí tienes todos los campos tal como se muestran en el editor de KNX AI.
|
|
|
66
97
|
- **Max stored events**: número máximo de telegramas en memoria.
|
|
67
98
|
- **Auto emit summary (seconds, 0=off)**: intervalo periódico de resumen.
|
|
68
99
|
- **Top list size**: cantidad de group addresses/fuentes en el top.
|
|
69
|
-
- **Detect simple patterns (A -> B)**: habilita detección de transiciones/patrones.
|
|
70
|
-
- **Pattern max lag (ms)**: diferencia temporal máxima para correlación.
|
|
71
|
-
- **Pattern min occurrences**: ocurrencias mínimas antes de reportar patrón.
|
|
72
|
-
|
|
73
|
-
### Anomalies
|
|
74
|
-
- **Rate window (seconds)**: ventana deslizante para controles de rate.
|
|
75
|
-
- **Max overall telegrams/sec (0=off)**: umbral en el bus global.
|
|
76
|
-
- **Max telegrams/sec per GA (0=off)**: umbral por group address.
|
|
77
|
-
- **Flap window (seconds)**: ventana para detectar flapping/cambios rápidos.
|
|
78
|
-
- **Max changes per GA in window (0=off)**: cambios máximos permitidos en ventana.
|
|
79
100
|
|
|
80
101
|
### Asistente IA
|
|
81
102
|
- **Enable LLM assistant**: habilita funciones Ask/chat.
|
|
@@ -84,30 +105,28 @@ Aquí tienes todos los campos tal como se muestran en el editor de KNX AI.
|
|
|
84
105
|
- **API key**: clave API (no requerida con Ollama local).
|
|
85
106
|
- **Model**: ID/nombre de modelo.
|
|
86
107
|
- **Compatibilidad del modelo de chat**: el modelo seleccionado debe admitir el endpoint Chat Completions configurado. Los modelos antiguos disponibles solo mediante completions, como `gpt-3.5-turbo-instruct`, se excluyen al actualizar la lista. Si el proveedor rechaza un valor personalizado de temperatura o el parámetro de límite de tokens, KNX AI vuelve a intentarlo eliminando o sustituyendo únicamente el campo incompatible.
|
|
87
|
-
- **System prompt**: instrucción global para análisis KNX (Advanced).
|
|
88
108
|
- **Permitir que la IA lea estados KNX y controle actuadores**: habilita la salida 4 y está desactivado por defecto. Los objetos exactos del catálogo ETS se pueden leer; solo se aceptan escrituras hacia objetos clasificados como `command`. Las operaciones desconocidas, con DPT distinto, inválidas o excesivas, y las escrituras hacia objetos de estado o neutrales, se rechazan localmente.
|
|
89
109
|
- **Pedir confirmación antes de enviar comandos KNX**: activado por defecto. Muestra primero los cambios validados y no emite comandos hasta que la misma sesión de chat los confirme. Cuando hay comandos pendientes, la respuesta añade siempre las instrucciones exactas para confirmar o cancelar en el idioma de la solicitud actual. Los comandos se validan de nuevo justo antes de la salida.
|
|
90
|
-
- **Preajuste del adaptador**:
|
|
91
|
-
- **Mapeo de entrada (chat → KNX AI)**: JavaScript síncrono aplicado antes de procesar el comando de entrada.
|
|
92
|
-
- **Mapeo de salida (KNX AI → chat)**: JavaScript síncrono aplicado solo a los mensajes de la salida 3.
|
|
110
|
+
- **Preajuste del adaptador**: usa **Sin adaptador** por defecto. Los editores JavaScript permanecen ocultos hasta seleccionar un adaptador; entonces se cargan y muestran los mapeos editables de entrada y salida.
|
|
111
|
+
- **Mapeo de entrada (chat → KNX AI)**: JavaScript síncrono aplicado antes de procesar el comando de entrada en el editor JavaScript verde.
|
|
112
|
+
- **Mapeo de salida (KNX AI → chat)**: JavaScript síncrono aplicado solo a los mensajes de la salida 3 en el editor JavaScript amarillo.
|
|
113
|
+
- **Activar notificaciones proactivas del hogar**: detector opcional de estados abiertos de persiana/ventana/puerta reconocidos de forma fiable; nunca escribe de manera autónoma en KNX.
|
|
114
|
+
- **Destinatario principal / ID de chat**: destino opcional de mensajes espontáneos; de lo contrario se recuerda la última sesión Ask.
|
|
115
|
+
- **Avisar después de abierta (minutos)**: umbral de duración antes de considerar una notificación proactiva; 120 minutos por defecto.
|
|
116
|
+
- **Inicio / fin de horas silenciosas**: intervalo diario en el que se suprimen los mensajes proactivos.
|
|
117
|
+
- **Educación de la IA**: instrucciones vinculantes gestionadas solo por el usuario, leídas por la IA y nunca modificadas.
|
|
118
|
+
- **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.
|
|
93
120
|
- 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.
|
|
94
|
-
- **Include raw payload hex**: incluye payload hex raw en el prompt.
|
|
95
121
|
- **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.
|
|
96
|
-
-
|
|
97
|
-
- **Docs language**: idioma preferido de
|
|
98
|
-
- Botón **Refresh**: consulta el provider y carga modelos disponibles.
|
|
122
|
+
- Los fragmentos pertinentes de la ayuda, README y ejemplos se incluyen siempre de forma automática.
|
|
123
|
+
- **Docs language**: idioma preferido para los fragmentos de documentación incluidos automáticamente.
|
|
124
|
+
- Botón **Refresh**: consulta el provider y carga los modelos disponibles. El icono gira durante la carga; una finalización correcta no muestra ningún mensaje.
|
|
99
125
|
|
|
100
126
|
### Advanced
|
|
101
127
|
- **Analysis window (seconds)**: ventana principal para resumen/rate.
|
|
102
128
|
- **Max stored events**: número máximo de telegramas en memoria.
|
|
103
129
|
- **Top list size**: cantidad de group addresses/fuentes en el top.
|
|
104
|
-
- **Pattern max lag (ms)**: diferencia temporal máxima para correlación.
|
|
105
|
-
- **Pattern min occurrences**: ocurrencias mínimas antes de reportar patrón.
|
|
106
|
-
- **Rate window (seconds)**: ventana deslizante para controles de rate.
|
|
107
|
-
- **Max overall telegrams/sec (0=off)**: umbral en el bus global.
|
|
108
|
-
- **Max telegrams/sec per GA (0=off)**: umbral por group address.
|
|
109
|
-
- **Flap window (seconds)**: ventana para detectar flapping/cambios rápidos.
|
|
110
|
-
- **Max changes per GA in window (0=off)**: cambios máximos permitidos en ventana.
|
|
111
130
|
|
|
112
131
|
### Configuración rápida de Ollama (local)
|
|
113
132
|
- Selecciona **Provider = Ollama**.
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
"knxUltimateAI": {
|
|
3
3
|
"title": "KNX AI (Traffic Analyzer)",
|
|
4
4
|
"sections": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
5
|
+
"groupAssistant": "Asistente IA",
|
|
6
|
+
"groupChatHome": "Conversaciones y hogar",
|
|
7
|
+
"groupKnxAnalysis": "Análisis del tráfico KNX",
|
|
8
|
+
"quickSetup": "Configurar el asistente",
|
|
9
|
+
"capture": "Telegramas del bus",
|
|
10
|
+
"storage": "Historial y resúmenes KNX",
|
|
11
|
+
"detection": "Anomalías y patrones",
|
|
9
12
|
"llmConnection": "Conexion del Asistente IA",
|
|
10
|
-
"llmContext": "
|
|
11
|
-
"chatAdapter": "
|
|
12
|
-
"
|
|
13
|
+
"llmContext": "Conocimiento y contexto IA",
|
|
14
|
+
"chatAdapter": "Canales de chat",
|
|
15
|
+
"homeIntelligence": "Hogar proactivo y memoria",
|
|
16
|
+
"homeIntelligenceAdvanced": "Ajustes proactivos avanzados",
|
|
17
|
+
"advanced": "Proveedor y límites"
|
|
13
18
|
},
|
|
14
19
|
"properties": {
|
|
15
20
|
"server": "Gateway",
|
|
@@ -46,6 +51,14 @@
|
|
|
46
51
|
"chatAdapterPreset": "Preajuste del adaptador",
|
|
47
52
|
"chatInputCode": "Mapeo de entrada (chat → KNX AI)",
|
|
48
53
|
"chatOutputCode": "Mapeo de salida (KNX AI → chat)",
|
|
54
|
+
"proactiveEnabled": "Activar notificaciones domésticas proactivas",
|
|
55
|
+
"proactiveRecipient": "Destinatario principal / ID de chat",
|
|
56
|
+
"proactiveOpenMinutes": "Avisar tras permanecer abierto (minutos)",
|
|
57
|
+
"proactiveCooldownMinutes": "Espera antes de repetir (minutos)",
|
|
58
|
+
"proactiveQuietStart": "Inicio de horas silenciosas",
|
|
59
|
+
"proactiveQuietEnd": "Fin de horas silenciosas",
|
|
60
|
+
"homeMemoryMaxKb": "Tamaño máximo de memoria del hogar (KB)",
|
|
61
|
+
"aiEducation": "Educación IA (gestionada por el usuario)",
|
|
49
62
|
"llmIncludeDocsSnippets": "Include documentation snippets (help/README/examples)",
|
|
50
63
|
"llmDocsLanguage": "Docs language"
|
|
51
64
|
},
|
|
@@ -74,13 +87,18 @@
|
|
|
74
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.",
|
|
75
88
|
"ollamaStartedAuto": "Ollama server started automatically.",
|
|
76
89
|
"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.",
|
|
77
|
-
"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."
|
|
90
|
+
"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
|
+
"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."
|
|
78
94
|
},
|
|
79
95
|
"placeholder": {
|
|
80
96
|
"llmBaseUrl": "https://api.openai.com/v1/chat/completions (or your compatible endpoint)",
|
|
81
97
|
"llmApiKey": "Paste API key (starts with sk-)",
|
|
82
98
|
"llmModel": "e.g. gpt-4o-mini",
|
|
83
|
-
"llmSystemPrompt": "Optional. Leave empty for default."
|
|
99
|
+
"llmSystemPrompt": "Optional. Leave empty for default.",
|
|
100
|
+
"proactiveRecipient": "Opcional: ID de chat de Telegram; si no, se recuerda la última sesión de chat",
|
|
101
|
+
"aiEducation": "Ejemplo: no avisarme entre las 23:00 y las 07:00. La persiana del despacho puede quedar abierta de noche."
|
|
84
102
|
},
|
|
85
103
|
"sidebar": {
|
|
86
104
|
"ui": {
|