My goal: to use the openHAB chat feature (core) similar as Alexa. Ask or command something using the iPhone’s voice input for the openHAB chat and get a voice response through openHAB but again using the iPhone’s TTS. Example: asked for battery voltage. The answer (2 parts) is the value first (406,7V) and then a spoken openHAB answer within the lefthand bubble. This spoken answer is, what i want to write into a string item.
After tests with openHAB’s TTS and webaudio, which have not been successful, i moved forward to use the “Command-Item” enabled within the openHAB app on my iPhone together with the TTS functionality of my iPhone.
Setup a string item “iPhone_Command” and selected it on my iPhone within the openHAB app.
Setup a rule:
// Holt den letzten Text, den openHAB (bzw. die KI) generiert hat
var lastResponse = actions.Voice.interpret();
// Sendet den Text als Sprachbefehl direkt an dein iPhone
items.getItem("iPhone_Command").postUpdate("device:tts:" + lastResponse + ":de-DE");
Am not able to extract a Chat response into the variable “lastResponse”. The actions pointer seems to be wrong? The 2nd line generates a voice output on the iPhone if i write a text instead of the variable “lastResponse”. Thus, the audio output on my iPhone works out.
If i change the first line to:
var lastResponse = actions.Voice.interpret('Wie ist der Status?', 'gemini');
i get asked what i want to know, everytime when i open the openHAB app on my iPhone, but the chat answer is not written into the “iPhone_Command” item.
Then the item state of the iPhone_Command item is: “device:tts:Welchen Status oder welches Gerät möchtest du genau abfragen?:de-DE”.
@florian-h05 or other experts: would be happy about the right input to get this done.
You need to provide text, the other three can be null so they use their defaults (llmTools defaults to all). If you want to have a conversation context so you can ask follow-up questions, you need to provide a conversationId.
It works then … “Wie ist der Status“ might be way to generic for the LLM to actually answer. You can adjust the system prompt in the voice settings and describe what you expect as answer for that question, that should instruct the LLM so it can answer to that question.
Thanks for supporting me. Am learning step by step and will explore your inputs.
Actually i have the following workarround running:
Set the log level:
log:set TRACE org.openhab.core.voice
Use the LogReader binding to extract the Chat answer string from openhab.log:
2026-10-23 08:10:30.592 [DEBUG] [core.voice.internal.VoiceManagerImpl] - Interpretation result from interpreter 'gemini': Die aktuelle Batteriespannung beträgt 405,1 V.
Extract the envisaged naked answer “Die aktuelle Batteriespannung beträgt 405,1 V.” (equal to the lefthand grey bubble within the OH Chat window) using the REGEX transformation .‘gemini’:\s(.*) and write the desired text it into my item “iPhone_Command”:
Then, the string leads to a voice output on my iPhone using the iPhone’s TTS.
Have actually one limitation which i am going to test furthermore:
Update interval of reading the openhab.log by the LogReader binding, actually set to 1 sec.
A 2nd limitation has been, that the defined Command-Item for the openHAB iOS app was executed everytime i opened the app. I eliminated this effect executing a small rule which empties the Command-Item string (iPhone_Command) after 5 secs, enough to execute the desired voice command first.
Thus, i learned a lot, and it provides me a single close to realtime voice output of the lefthand grey bubble response text on my iPhone.
I have not yet been able to get the response in the chat bubble as voice output on my iPhone (openHAB app, BasicUI and Chat in a WebView window) using the imterpret functions. It maybe that i am doing something wrong?
Is your interpreter loop running on a computer where you use voice in- and output through openHAB?
If i use the OH Chat window, i can retrieve states and command devices. This is by the way a really great new functionality. But i get no voice response and the response is not written into a string item. I can only retrieve the response through the above described workarround using the openhab.log. Maybe i don’t apply the interpret functions as intended.
In order to learn furthermore, i have setup a “Custom AI Chat Assistant” page (see screenshot below).
I use 2 different string items for request/command and response. It communicates with Gemini and the answer comes out in parallel with voice . But i can command nothing. It only gives me the feeling that something happens.
You already explained me the difference between Gemini chat and the core function OH chat. Nevertheless a have still a hurdle to fully understand this w.r.t. response storage and voice output.