Dateien nach "openhab" hochladen
This commit is contained in:
1 parent
08ff519216
commit
7d9faca720
3 files changed
+74
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
Group gAI_Bridge "AI Bridge"
|
||||||
|
|
||||||
|
String AI_Bridge_Availability "AI Bridge Online [%s]" (gAI_Bridge) {channel="mqtt:topic:ai_bridge:availability"}
|
||||||
|
String AI_Bridge_Status "AI Bridge Status [%s]" (gAI_Bridge) {channel="mqtt:topic:ai_bridge:status"}
|
||||||
|
String AI_Bridge_LastResponse "KI Antwort [%s]" (gAI_Bridge) {channel="mqtt:topic:ai_bridge:last_response"}
|
||||||
|
String AI_Bridge_ActiveSession "Aktive Session [%s]" (gAI_Bridge) {channel="mqtt:topic:ai_bridge:active_session"}
|
||||||
|
String AI_Bridge_Notify "AI Notify [%s]" (gAI_Bridge) {channel="mqtt:topic:ai_bridge:notify"}
|
||||||
|
String AI_Bridge_DialogInput "Dialog Input [%s]" (gAI_Bridge) {channel="mqtt:topic:ai_bridge:dialog_input"}
|
||||||
|
|
||||||
|
// Textfeld in der UI – Befehl löst die JS-Regel aus
|
||||||
|
String AI_Bridge_DialogCommand "KI fragen" (gAI_Bridge)
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// openHAB JS Scripting – Dialog an die Bridge senden
|
||||||
|
// JavaScript Scripting Add-on muss installiert/aktiviert sein.
|
||||||
|
//
|
||||||
|
// Token und URL anpassen!
|
||||||
|
|
||||||
|
const { rules, triggers, actions } = require('openhab');
|
||||||
|
|
||||||
|
const BRIDGE_URL = 'http://192.168.178.60:8090/api/v1/dialog';
|
||||||
|
const BRIDGE_TOKEN = 'REPLACE_WITH_BRIDGE_TOKEN';
|
||||||
|
|
||||||
|
rules.JSRule({
|
||||||
|
name: 'AI Bridge - Dialog senden',
|
||||||
|
description: 'Sendet Text aus AI_Bridge_DialogCommand an die Bridge und startet den Claude-Flow',
|
||||||
|
tags: ['AI', 'MCP'],
|
||||||
|
triggers: [triggers.ItemCommandTrigger('AI_Bridge_DialogCommand')],
|
||||||
|
execute: (event) => {
|
||||||
|
const text = String(event.receivedCommand || '').trim();
|
||||||
|
if (!text) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
actions.HTTP.sendHttpPostRequest(
|
||||||
|
BRIDGE_URL,
|
||||||
|
'application/json',
|
||||||
|
JSON.stringify({
|
||||||
|
text: text,
|
||||||
|
title: 'openHAB Dialog',
|
||||||
|
notify_text: 'KI_DIALOG'
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
'Authorization': 'Bearer ' + BRIDGE_TOKEN,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
8000
|
||||||
|
);
|
||||||
|
console.info('AI Bridge dialog sent: ' + text.substring(0, 80));
|
||||||
|
} catch (e) {
|
||||||
|
console.error('AI Bridge dialog failed: ' + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Broker-UID an deine Installation anpassen:
|
||||||
|
// Dein Broker: mqtt:broker:72a3b87ef9
|
||||||
|
Thing mqtt:topic:ai_bridge "AI Bridge" (mqtt:broker:72a3b87ef9) {
|
||||||
|
Channels:
|
||||||
|
Type string : availability "Availability" [
|
||||||
|
stateTopic="openhab/ai_bridge/availability"
|
||||||
|
]
|
||||||
|
Type string : status "Status" [
|
||||||
|
stateTopic="openhab/ai_bridge/status"
|
||||||
|
]
|
||||||
|
Type string : last_response "Last response" [
|
||||||
|
stateTopic="openhab/ai_bridge/last_response"
|
||||||
|
]
|
||||||
|
Type string : active_session "Active session" [
|
||||||
|
stateTopic="openhab/ai_bridge/active_session"
|
||||||
|
]
|
||||||
|
Type string : notify "Notify" [
|
||||||
|
stateTopic="openhab/ai_bridge/notify"
|
||||||
|
]
|
||||||
|
Type string : dialog_input "Dialog input" [
|
||||||
|
stateTopic="openhab/ai_bridge/dialog/input"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user