#Custom sentence
1 messages ยท Page 1 of 1 (latest)
not entirely, some things will be missing: predefined lists (e.g. entity names and aliases), custom lists, slot values etc.
intent scripts + custom sentences are much more powerful, but harder to create and maintain
Also automation always says stupid "done!" ๐
Ah disregard that. You can set conversation response.
Also @warm quest there are slots, done with {slot_name}. I guess there's no system slots like area though...
I want HA to have area (or basically satellite) restricted intents, and dynamic intents, that live while automation runs. That would allow for defining voice flows without spoiling main intent set. ๐
those are all wildcards. no numbers, no predefined lists, no system lists, no in/out values
True, just a string
context is available in intent scripts and (starting this release) in sentence triggers. use that as you wish
I'll create separate thread for this, to stop spoiling current one. Sorry @hybrid violet
Huh is that documented somewhere? Wasn't aware of that ๐ฎ
the context in sentence triggers I mean
unfortunately, no https://community.home-assistant.io/t/wth-sentence-trigger-doesnt-contain-any-context/802386
trigger.user_input iirc
Thanks for pointing it out.
I was already wondering how Lists and in/outs would be done in automations.
Wait, but how context will help you with lists?
Ah you mean mentioning that it's not there?
I think you can do something like "Your sentence with list (item1 | item2 | item3)" and then get exact item by parsing text of response - but yeah it's very inconvenient.
Intent scripts have been very finicky for me. I wish the documentation was better. For instance, I have never been able to get set conversation response to work well, leaving me with needing to use speech, which it seems cannot be used in the "action" block. This also means that I usually have to define any variables in both action: and speech:. I am also constantly running into troubles with templating and properly passing variables to things. Maybe I am doing something wrong or not understanding the scope and limitations of set conversation response, but I am not finding a lot of documentation on this stuff.
Yesterday I was working on getting a "check schedule" intent going. The idea is a lot like a "daily briefing" but expanded to use common language, eg "What's on my agenda tomorrow" "Whats on my agenda next Tuesday". I have some automations like it (sensors that hold calendar events for a time period) for my favorite sports teams so that they can be read off later and, of course a "daily briefing" for instance. I ended up creating a sensor (because input_text is limited to 255 characters) that held 2 weeks worth of events from 3 different calendars, but I had an impossible time trying to figure out how to then parse what was in the sensor. It seems this task would be better suited to input_text but because of the 255 character limitation I cant use it, and the sensor holds all of the data as a single string instead of a list or dictionary. On top of that, intent scripts just dont seem to support half of the things that you can do with automations so I have found the experience very frustrating. I have to find a lot of hack-y ways to get things working and often need to use the help of an llm like claude just to debug some of this stuff because it gets over my head.
For things like that it's easier to write a simple tool to just get the data, expose it to an LLM, and then let it do the summarization. That's what I am doing for my calendar and weather forecasts ๐
Looks like you went hard path.
I do everything in scripts (tools), combiming them like bricks. Since scripts have return values they're basically functions - so i call them, gather the result and then either give it to LLM (in complicated cases) or put them to the speech (with action_response field you can transfer any data from action to speech section).
It's much easier to put generic script like "game events" with fields "team" and "time period", than having sensors for everything...
Honestly, using scripts is probably a better idea. Do you use pyscript or appdaemon or something or just the native scripts in HA?
just HA scripts ๐
@fiery shuttle I have the script working, but i am still having issues with set_conversation_response. My input_text has all of the events, and my custom sentences are triggering the intent script, but the VA just keeps telling me "Nothing in your calendar", despite me be able to see that the input_text state has that days events. Here is my intent script, how am I still going about this wrong?
action:
- variables:
resolved_date: >
{% if schedule_date is defined %}
{{ schedule_date }}
{% else %}
{{ now().strftime('%Y-%m-%d') }}
{% endif %}
- service: script.voice_fetch_family_calendar
data:
target_date: "{{ resolved_date }}"
- delay:
seconds: 2
- action_response:
response: "{{ states('input_text.voice_family_calendar_output') }}"
set_conversation_response:
text: "{{ action_response.response }}"
Am I still not properly using action_response? Apologies if these are dumb questions, I really have searched around for even an example but I cannot find a good one
You seem to be mixing everything from everywhere here ๐
let me paste some example
Honestly man, I get here after debugging. Maybe its my method for custom sentences thats flawed. Its hard to figure out where i am going wrong
Here's script that uses slots in speech response:
ListRemoveItem:
action:
service: script.remove_list_items
data:
f_items: '{{ item.replace("and", ",").split(",")|map("trim")|map("title")|reject("eq", "")|list }}'
f_list: "{{ list_name }}"
speech:
text: "Removed {{ item|trim }} from the {{ list_name }} list"
mode: queued
And here's script that's using action response (your case):
ListGetItems:
action:
- service: script.get_list_items
data:
f_list: "{{ list_name }}"
response_variable: result
- stop: ""
response_variable: result
speech:
text: |-
{% set items = action_response["items"] %}
{% if (items|count > 0) %}
List contains {{ items|join(', ') }}
{% else %}
The list is empty
{% endif %}
In second case, your script should return result.items which is a list of items.
If you do everything in place, and use variable "calendar_items" - just use
- stop: ""
response_variable: calendar_items
Action response isn't something you're defining in script. It's pre-defined name for variable, that you're returning from action: block to speech: block.
To return it, use above stop action. To retrieve in speech, use action_response
If it's still confusing, let me know
No, that makes sense and I appreciate the examples. How would I go about set_conversation_response? Isn't that what I need to use to have LLM provide a summary?
set_conversation_response is nothing to do with LLM
set_conversation_response is used, when you're using automation with sentence trigger (NOT intent_script, NOT usual script, but automation). And then the text you're setting in set_conversation_response will be played by your TTS from your speaker. No LLM involved.
On the other hand, if you're working with LLM as conversation agent, and want to provide some information to the LLM, you create usual script (NOT automation, and NOT intent_script), gather that information in the script, and return it as script result. Then you expose this script to LLM, and it can use (call) that script as tool to get information.
So all this is different concepts.
And different approaches to how you construct your conversation agent.