Whisper STT: How to get the recognized text?

I just set up Assist using Whisper and OpenTTS. To start an automation I’d like to use appdaemon, but I haven’t found a way of getting the recognized text. I checked the event when Whisper has done STT, but it doesn’t contain the text.

Any ways of setting assist up in a way that the event contains the text? Or should I use rhasspy instead?

The voice assistant has this information

If you want this info into HA (pushed from the satellite)
Make a text_sensor on the device

text_sensor:
  - id: text_request
    name: Request
    platform: template
    icon: mdi:ear-hearing
    on_value:
      lambda: |-
        if(id(text_request).state.length()>32) {
          std::string name = id(text_request).state.c_str();
          std::string truncated = esphome::str_truncate(name.c_str(),31);
          id(text_request).state = (truncated+"...").c_str();
        }	

And use this to put the request into the text_sensor.

voice_assistant:
   ..... 
  on_stt_end:
    - text_sensor.template.publish:
        id: text_request
        state: !lambda return x;

on_tts_start will give you the response in the same manner

1 Like

Thank you very much! I can’t say though that I actually understand what you mean though.

What’s “the device” here? I don’t have a smart speaker yet.

Okay, could you explain a bit more what you have now,

I am in the assumption that you have a voice client setup. I have several esp32 voice clients connection via ESPHome. The software running (yaml) on them have a section called voice_assistant. The on_stt_end event will contain the request string that you can grab and put into the text_sensor. Or do what you want with it.

More info here Voice assistant

Oh, wait.
You are using Assist in HA itself. Am I correct?

If that’s the case then go to
settings - voice assistant - click the pipeline you have setup under Assist
Now you got the configuration panel open and click on the 3 dots in the top right corner and click debug
In the top right of your screen you have a blue icon that says Start debug run
There you have to details of your present and previous sessions

Thank you for your message!
I have set up an assist pipeline and ordered everything for a wyoming satellite.

After reading about assist and how it works I changed my mind a bit, this is what I would like: I would like to keep intent recognition in HA/Assist. But I want Appdaemon to run the actual automations.

So I thought there would be an easy way of catching the event that holds the intent (and hopefully it’s metadata), but the only event emitted (on error or success) looks like this:

event_type: state_changed
data:
  entity_id: conversation.home_assistant
  old_state:
    entity_id: conversation.home_assistant
    state: "2024-10-01T06:47:58.012657+00:00"
    attributes:
      friendly_name: Home Assistant
      supported_features: 1
    last_changed: "2024-10-01T06:47:58.012675+00:00"
    last_reported: "2024-10-01T06:47:58.012675+00:00"
    last_updated: "2024-10-01T06:47:58.012675+00:00"
    context:
      id: 01J93DBV9W9EJY24K9GXZ8YYTS
      parent_id: null
      user_id: db3c0f79726249f89589319a4d32804f
  new_state:
    entity_id: conversation.home_assistant
    state: "2024-10-01T06:48:38.495201+00:00"
    attributes:
      friendly_name: Home Assistant
      supported_features: 1
    last_changed: "2024-10-01T06:48:38.495219+00:00"
    last_reported: "2024-10-01T06:48:38.495219+00:00"
    last_updated: "2024-10-01T06:48:38.495219+00:00"
    context:
      id: 01J93DD2TYDRB5KQ9NKTEGZB48
      parent_id: null
      user_id: db3c0f79726249f89589319a4d32804f
origin: LOCAL
time_fired: "2024-10-01T06:48:38.495219+00:00"
context:
  id: 01J93DD2TYDRB5KQ9NKTEGZB48
  parent_id: null
  user_id: db3c0f79726249f89589319a4d32804f

Which is surprising. I thought everything in Home Assistant is an event?

At the moment it seems I need to create a helper that I can toggle with assist because that creates an event which I can read with appdaemon.

I am not familiar with appdeamon. I kept it simple and just run HAOS on a nuc.
Why would you run the automation via appdeamon as it could also be done within HA itself?

Because it’s much easier with appdaemon, especially if you want to do more than just lights on or off.

Okay, it that case I can’t help you.

I never had the need for adding extra complexity and extra layers. Plain automations will do nicely for me. Also for voice control which is a mix of custom intents and automations.
(208 Automations, 302 devices and 2386 entities)

I see it as removing a layer of complexity :smiley:
Are you well versed in intent_scripts? Is there a list of objects you can use when writing your intent script? Say I want to write an action that emits an event that contains all slots without me knowing what the slots are called.

Sadly I am not.
This documentation is spread all over the place. As far as I understand it slots are just lists of pre-defined key-value pairs in your yaml. You can put this also in a separate file and include it where you need it. I don’t think it is possible to get a list of all used slots on request. Till now I didn’t had an use case for it to look into it further.
(But I have noticed that running a (local) LLM fixes a few expected results of intents in my case.)

Side note
To understand my reasoning for this is this. I am doing home automation now for about 16 years. I am 61 and there will be a time that someone else need to do maintenance. Keeping things simple and clear for someone not familiar with my system is then a must.

I understand where you are coming from, but even if you keep it relatively simple I think somebody else will just start over. 208 automations seems to be too much for anybody to understand. Unless of course they are really motivated.

Thank you very much for your help!